A "pod" and ALOT of sprites, possible?

Topics: Developer Forum, Project Management Forum, User Forum
Jun 20, 2007 at 5:03 PM
Hi

I would very much like to create my own version of the flash game "Motherload" using XNA. The ideea is that you have this little "ship" or "pod" and you can dig your way down under the surface. So i have to make every dirt field a sprite (or whats is called?) so that my pod can collide with it. Every dirt field has to be static. Iv'e made that. But when addning like 10 * 10 fields that are 64 x 64 pixels wide, the game really slows down alot.

If you have trouble understanding what i meen, try the flash game that im talking about:
http://www.xgenstudios.com/play/motherload

Could someone rufly tell me how this could be done if even possible?
Jun 20, 2007 at 10:30 PM
I don't think the ground objects will need to be physics-based, really. The ground in the game seems to be tile-based, and they disappear as you run them over with your digging machine. Maybe you'd want some physics based chunks they fly out as the ground tiles disappear. You'll also want the ship to be physics based as it flies through the air.
Jun 21, 2007 at 8:41 AM
How could my pod collide and land on the ground then? it has to be able to collide with each dirt field from all sides
Jun 21, 2007 at 1:58 PM
The first way that popped into mind is to only simulate the squares that are around you. At each update, you know where you are in your game grid, so just move static objects to the positions that are filled in the area about 2 square perimeter around your pod.

If you are not going to have physics objects represent the ground, then you will still need a way to manually check collisions of the ground squares to the current boundary of your vehicle. I thought I saw a function for that before, but I can't find it now.

The next thing is, you would also need a way to force the pod to behave correctly. This is something I am trying to figure out how to do. In my case, I am just trying to stop my dynamic object from rotating, and always staying axis aligned. If you simulate outside the physics engine landing and interacting with the ground, you will have to apply all the right forces to do that.
Coordinator
Jun 21, 2007 at 4:55 PM
Not sure why it would be slowing down so much given that the tiles are static and therefore don't collide against eachother.

Do you have a sample you could post?
Jun 21, 2007 at 4:55 PM
I think i will try to only simulate whats near the pod, and then just move the static objects as it fly around
Jun 21, 2007 at 5:02 PM
Okay here is my code..

World class handles the ground, field class is my dirt squares, gamesettings class contains how many fields to draw

http://www.yousendit.com/transfer.php?action=download&ufid=9DB85F185B1F826A

Im on a laptop with Core Duo CPU, 2 GB RAM and standard Intel GFX, that should be okay
Jun 23, 2007 at 1:15 PM
Could anyone help me?
Jun 23, 2007 at 8:38 PM
I was having similar problems with a tile engine that I've been working on. Everything was suuuuper slow and it occurred to me that I had drawn things on top of each other multiple times over. After looking through your code and changing some colors around so that they had only 50% alpha, I saw the same problem that I was having: Things were physically piled up on top of each other. Here, check this out: http://img363.imageshack.us/my.php?image=alphachangezu6.jpg
I added a simple check to make sure that things didn't get placed on top of each other, and things started to work fine. Still ran a tad slow, but that's probably just my machine.
Good luck with fixing it!