|
|
This thread is locked; no one can reply to it.
|
1
2
|
| Alternatives to Tile Based Maps |
|
Tobias Dammers
Member #2,604
August 2002
|
IIRC, the Sonic The Hedgehog are tile-based with more-or-less arbitrary slopes as well. Even if you have vector-based collisions inside each tile, the tile map still makes sense in terms of speeding up calculations (by avoiding unnecessary calculations). --- |
|
Thomas Harte
Member #33
April 2000
|
Quote: IIRC, the Sonic The Hedgehog are tile-based with more-or-less arbitrary slopes as well. Even if you have vector-based collisions inside each tile, As I understand it, Sonic uses pixel based collisions, but retains a separate normal for each collision pixel. Quote: the tile map still makes sense in terms of speeding up calculations (by avoiding unnecessary calculations). Suppose you have a character that is not larger than the tile size. Then for each movement, you need to check only 4 tiles, instead of the whole map - which can make a difference of 2 vector-based collision checks against 2000, all for the tiny effort of finding the tiles you're on. But no half-decent vector map system would ever do the full 2000 checks and in any case the fact that something is faster doesn't necessarily make it better. It's faster to use 640x480 than any higher resolution but that still doesn't mean it is worth recommending. The principle is whether something is fast enough, which vector maps are – even on a tiny ARM like in the GBA. Look at it another way - what do you suddenly have processor time to do on a tile map that you cannot do on a vector map? [My site] [Tetrominoes] |
|
Richard Phipps
Member #1,632
November 2001
|
How would you reduce the unnecessary checks Thomas? Some kind of sector system? Could each tile have with it associated vectors, or is that too confining? I don't think there is a tilemap vector system available for Allegro is there? |
|
Audric
Member #907
January 2001
|
Damian Grove could answer any questions about the internals of Sonic. |
|
HoHo
Member #4,534
April 2004
|
Quote: How would you reduce the unnecessary checks Quadtree? __________ |
|
Thomas Harte
Member #33
April 2000
|
Quote:
Quadtree? The "Allegro demo game" (I don't have a better name for it) uses quadtrees for collisions and drawing, but isn't smart enough to factor in frame to frame position coherences. As you'll be aware but is worth pointing out for the purposes of discussion, quadtrees are good because you effectively place a limit on the number of checks you want to do, rather than picking an arbitrary size of space that you think it would be nice to use for sectors. This also makes them (usually) more memory efficient than a straight sector system. Even without coherences, you can find the node that a point is in in at worst log4(n) time where n is the maximum subdivisions of the tree. It is normal to have a maximum subdivision beyond which it isn't worth going because you end up dealing with stupidly tiny portions of space. The "demo game" actually cheats a little - it uses slightly overlapping nodes that allow for the size of the only object that collisions are done with. But whatever. That code can be seen at https://svn.sourceforge.net/svnroot/alleg/demos/skater/src/quadtree.c - it's reasonably compact and one of those nice things that you write once and then it automatically scales itself. [My site] [Tetrominoes] |
|
Richard Phipps
Member #1,632
November 2001
|
That code can be seen at https://svn.sourceforge.net/svnroot/alleg/demos/skater/src/quadtree.c - it's reasonably compact and one of those nice things that you write once and then it automatically scales itself. While it seems nicely commented, it's a bit over my head. |
|
Neil Walker
Member #210
April 2000
|
Very much not what is required but pixellate has a little section on slopes: http://pixwiki.bafsoft.com/mags/14/articles/jnrdev2/index.html Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
|
|
1
2
|