views:

1257

answers:

7

I'm currently trying to implement a marble maze game for a WM 5.0 device and have been struggling with developing a working prototype. The prototype would need the user to control the ball using the directional keys and display realistic acceleration and friction.

I was wondering if anyone has experience with this and can give me some advice or point me in the right direction of what is essential and the best way to go around doing such a thing.

Thanks in advance.

Frank.

A: 

I would recommend checking out XNA Studio 3, it has built in support for PC, Xbox 360 and mobile devices, and it's an official & free spin-off of Visual Studio from Microsoft.

http://creators.xna.com/en-US/

http://blogs.msdn.com/xna/

If you search around, people have written tutorials using physics (velocity on this one) http://www.xnamachine.com/2007/12/fun-with-very-basic-physics.html

TravisO
Except he asked about Windows Mobile, and XNA isn't supported on WinMo.
ctacke
A: 

Try XFlib. It is in c++, but most cool things for the mobile have to be in c++, unfortunately. The site has some very cool free games. You can also see the source of most of the game too. Many have the physics you want.

nportelli
A: 

Unfortunately, XNA doesn't support the windows mobile platform. However, as it seems that you're not having a problem with the technical issue of drawing on the WM device, but with the logic required to implement physics based movement, then it's not a bad idea to consider XNA to prototype the physics and movement code.

Check out some of the educational topics at creators.xna.com, and also "gamedev.net"

Joel Martinez
A: 

If you are at a loss, there's no mistake in trying a "lighter" tool for prototype. I would try Torque Game Builder - it spits out XNA, although maybe not meant for your platform.

Overflown
A: 

At the Samples of the Windows Mobile SDK (check out the WM 6.0 SDK too), there are a couple of game applications. One of them is a simple puzzle game; not much, but it is a starting point.

The use of physics in game development is not specific for Windows Mobile. You can find a huge literature about this subject. This comes up in my mind now. If you are serious about game development, in any platform, you should do a little research first.

kgiannakakis
A: 

I dont know if this may help but i saw a Marble application for the Android platform on google code. Check it out here, it may throw some insight on the actual logic of the game.

The code is open sourced and written in java (using the android sdk) put nevertheless it may be useful. Also to better understand the code checkout the documentation for the SensorsManager, SensorEvent etc here

I wouldn't recommend using the same architecture as this application thou.

kripto_ash
+1  A: 

When reading your answer I didn't get the feeling you are looking for a game framework, but more: how can I easily model a ball with acceleration and friction.

For this you don't need a full fledged physics framework since it is relatively simple to do:

First create a timer which fires 30 times a second, and in the timer callback do the following:

  • Draw the maze background
  • Draw a ball at ballX, ballY (both floating point variables)
  • Add ballSpdX to ballX and add ballSpdY to ballY (the speed)

Now check the keys...

  • if the directional key is left, then subtract a small amount of ballSpdX
  • if the directional key is topleft, then subtract a small amount of ballSpdX and ballSpdY
  • etc

For collision do the following:

  • first move the ball in the horizontal direction. Then check the collisions with the walls. If a collision has been detected, then move the ball back to its previous positions and reverse the speed: ballSpdX = -ballSpdX
  • move the ball in the vertical direction. Then check the collisions with the walls. If a collision has been detected, then move the ball back to its previous positions and reverse the speed: ballSpdY = -ballSpdY

by handling the vertical and horizontal movement separately, the collision is much easier since you know which side the ball needs to bounce to.

last nu not least friction, friction is just doing this every frame: ballSpdX *= friction; Where friction is something like 0.99. This makes sure the speed of the ball get's smaller every frame due to friction;

Hope this helped

Toad