tile classes
Hi, kind of a dumb question here. I know that a lot of people who are programming tile-based games use tile classes to hold different properties such as walkability, extra items in that tile, layers, etc. Is it acceptable to base these things without a tile class and just with the "tile ID?" What I mean by tile ID is the number you assign the tile in your map array. This is the way I''ve been doing it and it''s worked fine, but I want to find out if I''m missing anything.
Thanks,
Martin
______________Martin EstevaolpSoftware
Map array? ewww....
I would suggest learning how to use linked lists.
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
I would suggest learning how to use linked lists.
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
lpsoftware: That isn''t too bad of an idea. If I''m following you correctly, you have an array of tiles and then each entry in your map array is an index into the tile array? That might be more indirection than you really need, but shouldn''t affect you too adversely.
ImmaGNUman: How would you suggest using a linked list in this situation? If you mean using a linked list for the map itself, that would give absolutely horrid performance. The only way to get to a particular tile would be to step through every tile that comes ''before'' it in the map in order to reach the one you want. Maybe you misunderstood what lpsoftware meant by map array? Linked lists are a useful tool for some things, but when it comes to a data structure that needs rapid access, the linear nature of a linked list makes them impractical.
ImmaGNUman: How would you suggest using a linked list in this situation? If you mean using a linked list for the map itself, that would give absolutely horrid performance. The only way to get to a particular tile would be to step through every tile that comes ''before'' it in the map in order to reach the one you want. Maybe you misunderstood what lpsoftware meant by map array? Linked lists are a useful tool for some things, but when it comes to a data structure that needs rapid access, the linear nature of a linked list makes them impractical.
jaxson: Thanks for your reply. I''ve got a little more confidence in what I''m doing now.
Martin
Martin
______________Martin EstevaolpSoftware
Well, doesn''t the way lpsoftware does it also have the advantage of being less memory intensive? I mean, if every tile of your 256x256-Tile Map is a full blown class, then that takes up a lot of memory..well, actually not really A LOT these days, but even if we have 1 GB of RAM nowadays, we shouldn''t begin wasting it, no? However, on the other hand, if you have a 256x256-Array consisting only of integers and another Array, whose size is the number of tiles you use, isn''t that less memory-intensive? What are the disadvantages of the way lpsoftware does it? I ask this, because everybody seems to do it the more memory-hungry way...
--------------------------Ghosts crowd the young child's fragile eggshell mind...
Don''t make it any more complicated than it needs to be. I made a simple side scroller demo using a VERY basic tile engine using a similar technigue that you have. It works fine. K.I.S.S -Keep It Simple Stupid
(you''re not stupid, it''s just a saying)
(you''re not stupid, it''s just a saying)
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
It really depends on what information you want to store for each tile. For example, if your tile array contains the images AND game data (obstruction info, etc.) then you have a trade off. If you decide that, no matter what, tile number 7 (a grass tile maybe) is always unobstructed, then you can store that info in your tile array. This is less flexible than storing that information in the map array.
Everything really depend on what information you want to keep and how variable you want each tile of your map to be. If you want to have it where sometimes a water tile is unwalkable and then other time it is walkable (shallow water) then you will have to store that information for each location of the map array. This will use more memory, but will be more flexible.
It all really depends on what features you need in your game and what memory requirements you are willing to have.
Everything really depend on what information you want to keep and how variable you want each tile of your map to be. If you want to have it where sometimes a water tile is unwalkable and then other time it is walkable (shallow water) then you will have to store that information for each location of the map array. This will use more memory, but will be more flexible.
It all really depends on what features you need in your game and what memory requirements you are willing to have.
Horrid performance? hmm, i doubt that, considering most isometric guru''s and the games out use them. Most Tile games faqs even suggest linked lists, and i am currently working on the engine to a stupid zelda ripoff (hey, everyone starts somewhere :/) which uses linked lists, and doesn''t seem to go slow at all. Maybe in your experience, but not in mine.
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------
A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
ImmaGNUman: I guess we must be on different pages. I'm not sure what you mean about using a linked list for the map. Sure you could use a linked list to keep track of all the objects stored at a particular tile (you'd actually have height*width linked lists), but a linked list would not work at all for the map info itself. (By map info I mean which tile image should be displayed for each space of the map)
Edited by - jaxson on June 4, 2000 3:36:57 AM
Edited by - jaxson on June 4, 2000 3:36:57 AM
I would think that using an array would be best, since just how often does a map change size...
Array pros:
Fast tile finding.
Array cons:
Limited size. (without realloc)
Why use a linked list to stored the map? What advantages there?
http://www.ill-lusion.com
Array pros:
Fast tile finding.
Array cons:
Limited size. (without realloc)
Why use a linked list to stored the map? What advantages there?
http://www.ill-lusion.com
laxdigital.com
[email=ziggy@laxdigital.com]ziggy@laxdigital.com[/email]
[email=ziggy@laxdigital.com]ziggy@laxdigital.com[/email]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement