Side-scrolling beat 'em up
BlitzMax Forums/BlitzMax Beginners Area/Side-scrolling beat 'em up
| ||
When using 2D functions only, what would be the best way to do an engine similar to Golden Axe: viewed from the side and up a bit? Specifically: Drawing objects further down the screen to overlap higher-up ones, creating the illusion of depth. The only way I can think of is to have all objects in the list sorted by the y-coordinate of their 'footprint', and draw them in order. |
| ||
implementing a simple iso render system that behaves exactly like that. |
| ||
only way I can think of is to have all objects in the list sorted by the y-coordinate of their 'footprint', and draw them in order. Probably what I would do. As Blitzmax is 2D-in-3D it would be nice to have a 'Z' parm on drawimage. |
| ||
Can any of Blitzmax's 3D functions be used to do the same thing, if a simpler alternative does exist? I imagine sorting the list for each loop iteration may cause a considerable performance hit if plenty of objects are onscreen. Granted - in Golden Axe, as an example, a maximum of about six onscreen characters would have to be sorted. I'd potentially like to be able to handle swarms of bad guys without killing my CPU. |
| ||
I remember a Guy did a Robocop remake that was side scrolling like Golden Axe. There were plenty of characters on screen without any slowdown so I don't think it's that much of a performance hit. [edit] here's the link. http://www.blitzbasic.com/Community/posts.php?topic=72327#808425 written in BlitzMax. |
| ||
I remember that Bmax passes a Z=0 parm when drawing. It might be easy to change this. The problem , as always, is you have a nightmare time externalising the entire DrawImage process or you change the base modules. I haven't got time to check it out but somebody might have. <edit> TBH you might want to try out the 'y' value sort if it does what you're after. |
| ||
Golden Axe is strictly 2D. Just keep a array or list of your sprites and draw then zordered based on the Y position of their feet. ;) |
| ||
A sort of several thousand items will take a millisecond or so. Computers can do sums quite quickly now. I really wouldn't worry. |
| ||
... and, once sorted, you'd only be removing and inserting those objects which have changed since the last frame. |
| ||
I would just sort the whole thing each frame... it's not going to kill the weediest cpu these days and it's not worth the effort of trying anything more complicated. |
| ||
Perfect, thanks a mil guys. |
| ||
Agreed, use a list. I personally would only sort when a change occurred. |
| ||
Keep the previous results of your sort and then you only have to test each adjacent object against its neighbors in the list to see if they need to switch positions. Much faster than doing a fresh sort every frame. |
| ||
I think this should be (sticky) topic because on today console or pc games, you wont see any side scrolling beat em up unless the person making one( in any programming language), so Good to see the person making the game :) Yes I am big fan of Side scrolling beat em up such as Captain Commando Final Fight Street of Rage 2 Double Dragon 2 |