Side-scrolling beat 'em up

BlitzMax Forums/BlitzMax Beginners Area/Side-scrolling beat 'em up

Schwang(Posted 2008) [#1]
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.


Dreamora(Posted 2008) [#2]
implementing a simple iso render system that behaves exactly like that.


tonyg(Posted 2008) [#3]
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.


Schwang(Posted 2008) [#4]
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.


Amon(Posted 2008) [#5]
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.


tonyg(Posted 2008) [#6]
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.


MGE(Posted 2008) [#7]
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. ;)


Rob Farley(Posted 2008) [#8]
A sort of several thousand items will take a millisecond or so. Computers can do sums quite quickly now. I really wouldn't worry.


tonyg(Posted 2008) [#9]
... and, once sorted, you'd only be removing and inserting those objects which have changed since the last frame.


Who was John Galt?(Posted 2008) [#10]
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.


Schwang(Posted 2008) [#11]
Perfect, thanks a mil guys.


Grey Alien(Posted 2008) [#12]
Agreed, use a list. I personally would only sort when a change occurred.


ImaginaryHuman(Posted 2008) [#13]
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.


Hotshot2005(Posted 2008) [#14]
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