Created: August 28 2011

Boxing2D


I finally got started on the joints topic, or should I say topics. It looks like there is enough content to cover that doing a detailed explanation will require a topic for each. I think I'll keep it to revolute and prismatic for now.

In the meantime I have been a bit slack lately, at least compared to the preceding 'tens weeks', but I have made some progress with the ragdoll boxing concept. I moved the project over to iPhone to try out control ideas and test the connection performance. I had ideas of making the player able to crouch and move back and forwards, and do different types of punches or kicks, and stand up if they fell over. This gradually got whittled down to a much smaller set of controls, but I think for the better.

The standing up idea, and then the kicks were the first things to go, due to their complexity and low ROE (return on effort). Next to go was the crouching and moving around - the player will always stand (this is boxing after all) and will automatically move to keep within a certain range of the opponent. Finally, I realised that attaching a mouse joint to the players fist and letting the user move it directly was the ideal way to control this, making it perfectly simple and intuitive in one fell swoop. Although this means there will not be much skill or strategy involved in winning, it will be accessible to a broader range of people. Think of it as the Wii strategy... I once went to a talk by Satoru Iwata where he stated that a major goal of the Wii design was to attract more people who did not think of themselves as gamers - even the wiimote was purposely made to resemble a TV remote control (which even your grandma uses right?) instead of a typical game controller.

Anyway, the control system I have now couldn't be simpler, just use one finger to move one fist. It did involve quite a bit of effort to restrict the mouse joint from toppling the player over, while still keeping it free to move within arm's length. Here is the latest build. This is being recorded from the simulator by using glReadPixels to dump every third frame into a bmp file - that's why the motion is a bit slow and stuttery - on the device the movement is perfectly fluid. I am playing the left fighter remotely from my iPod touch (the red dot shows the remote finger location), and the right fighter using the mouse on the simulator, so it's a bit hard to get a realistic looking fight going...


Finding and making connections with NSNetService turned out to be very easy. With the very small amount of data going over the wire at this stage, everything seems cool but I still have to tackle the problem of keeping the simulation in sync across both devices. Since the network will always be local, I am thinking the RTS style lock-step send-user-input-only method should be fast enough.