Archived

This topic is now archived and is closed to further replies.

Floru

Data structure for cave

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Or you could use NURBS and a very high resolution bitmap...

__________________________________________________________
Remember: The snow is always brighter on the other side

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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
}

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites