Data structure for cave

Started by
5 comments, last by Floru 23 years, 10 months ago
Hi! Has anyone played those games where you fly with a little ship in a cave? Possibly killing other players or collecting something etc. Well what would be the best data structure for a cave or just land land like in those tank games were two tanks shoot at each other (tank wars, scorched earth). Of course it should be in some way also realistic... If for example bomb hits the ground there should also appear a hole... etc. Thanks for any help Floru
Advertisement
You mean like Gravity force?

I think they used a realy big, compressed bitmap...
But you could use a sort of 2d polygon storage system that is transfered into bitmap when loaded (hmm, im not making much sense here )


========================
Game project(s):
www.fiend.cjb.net

Edited by - JonatanHedborg on June 15, 2000 10:19:09 AM
=======================Game project(s):www.fiend.cjb.net
Or you could use NURBS and a very high resolution bitmap...

__________________________________________________________
Remember: The snow is always brighter on the other side
Hi again..!

First of all: what is NURBS? And as a beginner in this kind of programming does someone know a piece of code as an example? Or at least tell a little bit more specific about the idea of these bitmaps?

Floru
i''d say go with a tile engine for ease for that tank game... so it is in a layout of squares... like bomberman..

for that flying one, have 2 long vertical bitmaps that scroll faster than the background simulating movement through the cave
have a big bitmap (stored in a directdraw surface, for example), then, to blow bits off, simply draw black pixels to the surface which your game interprets as "empty space" from then on.

so, in effect, you are using the same data for display and collisions eg:

if(BitmapSurface.GetPixel(x_pos, y_pos) != 0)
{
//we hit something
}
I don''t think isometric or tile programming would be nice ''cos it would get bad for animating. I think you''ve gotta do somethin'' like this(just an idea, for aerial view):
The ground is a large 3Dimensional array with a bitmap. A ship could have two position atribbutes:
- Position of Center
- Radius
So you make a linked list o'' the sprites, and test with all the other sprites, every time some of them wanna move, "is the distance between centers smaller than radius1 + radius2". If it is, possibility of movement = FALSE. You gotta test too if the sprite is gonna go directly against the wall. It''s the only thing I don''t know. How can I measure the distance between a point and a line? (What a extense and boring text I''ve made)

Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;

This topic is closed to new replies.

Advertisement