Hacker News new | comments | show | ask | jobs | submit login
Show HN: XMoto.js (github.com)
36 points by MichaelHoste on Apr 17, 2016 | hide | past | web | favorite | 15 comments



Looks really cool! Have you thought about adding multiplayer?

I really wish someone would do the same for Elma/Elastomania. I feel like it has much more funnier physics with it's elastic suspensions etc. Even the third party extension which added multiplayer support was amazing ten years back.

Btw, is this project still active? Last commit was nine months ago.


Yes of course I had multiplayer in mind the whole time. I even started a Rails application here for that purpose: https://github.com/michaelhoste/xmoto.io (it was more of a proof-of-concept)

But I'm afraid of the tweaking of the physics once the multiplayer game is started (and replays are created). Do I need to freeze them once-for-all and only work on supporting more levels or create an editor?

I still have plans for this project, but this is a side-project and like always, life happens and free time disappears...

EDIT : the work-in-progress is in fact in the "pixijs" branch, I almost finished the rendering engine switch to http://www.pixijs.com/ (higher level of abstraction, more cool 2D effects)


This is so awesome! I couldn't play yet because I am on mobile, but I will definitely do it later. I always liked this game.

As someone who never coded a game (a part from one that don't use any graphics: https://github.com/andreynering/sudoku ), I always ask myself how hard is to code a 2d/3d graphic game. I say this because a game seems much more impressive than other kind of (boring) coding projects.


I tried to start a blog to talk about the project's creation: http://xmoto.io But as always, I prefer to spend my time working on the code than writing blog posts... So they are not up-to-date (and will never be).

Games are not my branch of work and I was like you. What I can tell you is that learning to deal with the game loop is the hardest part. The synchronization between the physics, the drawing and the game logic is not very intuitive for a web application developer :-)


Looks like controls are completely different from https://xmoto.tuxfamily.org/. In Elastomania and original XMoto left/right just adds momentum, and in XMoto.js it just tilts the player forward or backward, which is more realistic. Is this behaviour intended? Compatibility with original XMoto is not planned, right?


The keyboard controls are the same as XMoto (up for acceleration, down for brake, left/right for rotation) but they are applied differently. The smallest difference in physical value (torque, acceleration, grip, weight, etc.) changes everything and it's very difficult (if not impossible) to have exactly the same behavior as original XMoto. So I just recreated some physics that are fun to play with and works well with the existing levels.

If you want to play with the physics, you can try to change some values here by clicking on them: http://js.xmoto.io/?level=1010&debug=true It's fun to do and I'm open to new modes :-)

If you are interested, the input code is here. As you can see, acceleration and brake are only applied on the wheels, like in real-life. But for the moto rotation, I cheat by applying some torque on the moto body because the driver was not heavy enough to make it rotate quicky: https://github.com/MichaelHoste/xmoto.js/blob/pixijs/src/mot...


Very nice work!

I noticed a pretty significant bug (i think). The ghost character actually clears the checkpoints for the current rider! As an example, on level two, the rider must go right for checkpoint A, then left for checkpoint B, back to center for the finish. After finishing once, the rider only needs to go left to checkpoint B, then back to the finish. (Checkpoint A is cleared by the ghost rider).

Very impressive all that you've done!


Thanks for the compliment!

Nice catch for the bug! I fixed it on the wip branch here: https://github.com/MichaelHoste/xmoto.js/commit/24855d191a43...

There is an abstraction between player physics and ghost physics and I think I need to refactor the collision system to avoid this kind of behavior.


Neat! I have loved Elasto Mania, Action SuperCross, XMoto and the likes for years and now I can play it on the browser! Apparently this project is 2 years old now, shame that I didn't know about this before hand (or was it not available?)

My favorite thing back in the day was making autorunner levels, where your wheels would be lodged against two tracks (of ground) and proceed to do all kinds of tricks.


I thought I was the only one who had played this.


oh my this is wonderful. I spent so much time playing this in high school.


Curious as to how hard it was to port the game to HTML5.


There were 3 difficult parts:

* The most difficult one was recreating the physics with a modern physics engine (box2D) to make them feel like the original ones. The smallest difference was making some levels impossible. It's not perfect but I tried to tweak them the best I could. And I created a debug mode to help me (and others) achieve this: http://js.xmoto.io/?level=1010&debug=true (I had way too much fun with this mode!)

* Levels: the level format was documented but not everything was "well"-documented. So I had sometimes to reverse engineer things. Like you could see, there are thousands of levels and they added layers of logics with time. So the first levels are usually compatible, but not the latests. And when I tried to add some logics (parallax, checkpoints, etc.), sometimes, the first levels broke (it's difficult to write tests for this). I wrote a blog post about it here: http://xmoto.io/2013/08/20/level-parsing.html

* Replays: I tried to find the smallest possible format to save all player's replays on a database. The original purpose was to create a kind of online community where people could challenge themselves and replay size matters. I first tried to save the replays as "keyboard inputs" but it wasn't reproductible as physics engine are not deterministic between browsers (I learned it the hard way). So I had to save both keyboard inputs and physics "checkpoints" (every x seconds) to adjust the replays. I'm quite happy with the results because it's about 20ko for 1 minute of replay. Here is a big monologue about my reasoning: https://github.com/MichaelHoste/xmoto.js/issues/8

It was fun because I'm a full-time Ruby on Rails developer and I was way out of my confort zone :-)


That is fantastic, great job!


Fun game




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: