Gosu Forums
Topic Gosu / Gosu Exchange / Simple physics and/or geometry (?) on the server side
By Naoya Date 2014-11-24 10:19
So, I ended up trying to make a 2d action mmo just for the sake of learning, and oh god, how much I learned already in a few days. But still there is much to learn haha.

I've read some very interesting articles about multiplayer server architecture and they said that I need to do most things server-side and client-side (to mask lag, and stuff). Right now I'm only using simple stuff like gosu distance and angle methods to play around with circles and mostly cones (for attack area) on the client side. The question is, what would you recomend to do the same thing on the server-side? I'm pretty sure I have to find some library in C++ as the calculations in pure ruby could slow down heavily the server.
By jlnr (dev) Date 2014-11-24 11:06
I'd keep the geometry simple. Rectangular bounding boxes or circles (depending on the perspective) should enough for most games :)
By lol_o2 Date 2014-11-24 18:53
If it's about physics, I'd recommend Chipmunk library. Especially for objects' collision detection, I made also a <collision thing> using Chipmunk that easily integrates into game and it's fast.
By Naoya Date 2014-11-24 22:36 Edited 2014-11-25 05:29
Amazing example lol_o2! :)
It will help me a lot.

Yeah, I thought chipmunk but wanted to make sure it was the best choice.
By arrow Date 2014-11-24 23:35
I'm working on a multiplayer platform fighting game where I do all the calculations with fixed point arithmetic. It's basically using integers and bit shifting them. The reason I looked into doing this was because I had some problems with different computers getting different results for the same float math.

If you want shapes colliding with shapes, circles, points, and lines you could look into SAT (Separating Axis Theorem).
http://www.codezealot.org/archives/55
By Naoya Date 2014-11-25 05:28
Hmmm interesting stuff.
I'm gonna look into it too, thanks :D
Topic Gosu / Gosu Exchange / Simple physics and/or geometry (?) on the server side