Jump to content
  • Advertisement

Archived

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

CSharpMan

Non-rectangular maps?

This topic is 5176 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was playing Worms: Armageddon and I was looking especially at the maps. They are not rectangular, yet are changed in-game and the characters still sit on the edge of the curves. I would like to accomplish this in a game i am developing. It''s a worms clone, because I love the game. I could easilly make a map like that in paint, but the collsion and destroyable land has me baffled. Is there any opne who could help me with that, or point me in the right direction. An open-source project would help too.

Share this post


Link to post
Share on other sites
Advertisement
I might be totally wrong now, so don''t take the following for granted! If so, someone please correct me

I would say that the game uses a bitmap-based map. The maps are -in some way- still rectangular, which doesn''t necessarily have to be "tile-based" (every pixel resembles what a tile in let''s say an isometric tile-based game would be).

As for the collision response between the worms and the environment: you could do a search on "pixel perfect collision detection", that might clear some things up

Hope that helped!


Indeterminatus

--si tacuisses, philosophus mansisses--

Share this post


Link to post
Share on other sites
Worms:2 and Worms:Armageddon maps are lightly compressed real-time-modified bitmaps for hit detection, and several moderate-sized chunks of normal off-screen graphics for the visible terrain bitmap.

If I were to re-implement it, my collision map would have two bits per terrain pixel, stored in vertical columns instead of rows. The first bit says "solid or not", the second bit says "destroyable or not". For obvious reasons, if the first bit is set the second will also be.

Storage would column-minor for easy and fast scanning down for gravity; just increment until you reach bottom or until you hit a non-zero word, then find the non-zero by bitpair in that word. Except that I wouldn''t: I''d implement run-length compression. 2 bits for properties, and 6 (or 14) more bits for length of the run.

I''d then have a collection of probably 256x256 images, tiled together, to be a collage which the entire level map is built of. We have finite bounds of detail (infinite sea to both sides, infinite sky above, ocean level below) so we don''t need to store all that as more bitmaps, just draw it procedurally or out of small and easily tileable pieces.

Anything I missed?

Share this post


Link to post
Share on other sites
Thanks a lot guys. The only thing I don''t get is what Wyrframe said about columns instead of rows and column-minor. And wouldn''t the pixel-perfect collision bog down the speed a lot, I mean checking for every pixel individually would take some time, especially with a 3x2 grid of 256x256 tiles? Well, time to hit the sack, school tomorrow

Share this post


Link to post
Share on other sites
If you store the ''hit'' mask seperately with 1 bit for each pixel, then you can do pixel perfect collision detection on 64 pixels at once.
And you''d only do the collision detection along the path of the projectile(s) - not against the whole map. (give the projectile a bounding box - say its 32x32 pixels big - then you only need to do 32 checks (one per line of the projectile''s image) each time the projectile moves).

See http://www.ifm.liu.se/~ulfek/projects/2d_Collision_Detection.html
for an example of how to do multiple pixel at once collision detection.

- Wyzfen

Share this post


Link to post
Share on other sites
I read the tutorial you suggested Wyzfen, but I just made me more confused, I get what your saying about bounding boxes, but the tutorial on how to do check more than one pixel at once was confusing, I don''t know C so that might be a factor, but the big formula and everything else in there isn''t very clear to me.

Share this post


Link to post
Share on other sites
Hmm. Just had a look at that tutorial - it goes into details you wont really need for your game. All you really care about is the sections up to 2.3.

I originally just looked at the provided c code.

- What language do you use ?
- For now you could get by doing slower per pixel checks one at a time - making sure you use a bounding box to work out which pixels on the map to check.

- Wyzfen

Share this post


Link to post
Share on other sites
Hehe. didnt even click
Yeah, i use c# as my language of choice too. Much nicer to develop with.
I''ve been planning on converting that code over. Perhaps i should talk to the author first.

Although - you should be able to understand the code as it is

- Wyzfen

Share this post


Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!