Posted: 28th Jan 2005 01:58
Edited at: 28th Jan 2005 02:05
Ok, well, by the title it looks like a simple question I guess, but its something that I've been having a hard time with.
I am making a SNES RPG style engine (Very simular to Chrono Triggers graphic engine).
Have any of you ever tried pasting, say, a 30x30 tile matrix (tile size 16x16 pixels)? DBP comes to a HALT! Why does the number of sprites lag it so much? I mean heck, in Blitz I pasted 16x16 tiles across the entire screen without lag (though i dont know blitz well enough to use it for my project)...
But, anyway... I've found a way around this. That is; DBP does not get as laggy if you have much fewer sprites on the screen, but much bigger sprites. So, the solution is to make layers of sprites, lets say, 2 layers. One underneath the player, one on top. Now the game runs infinately faster! I still have a problem, though.
With this system, basically, we have 3 "Layers"
Two are graphical, and one is a collision layer, here is an example:
Tiles Under Player-xxxxxxx-Tiles On top of player
_________xxxxxxxxxxxxxxxxxxxxxxxxxx_________x
|~~~~~~~|xxxxxxxxxxxxxxxxxxxxxxxxx|~~~~~~~|x
|~~~~~~~|xxxxxxxxxxxxxxxxxxxxxxxxx|~~~~~~~|x
|~~~~~~~|xxxxxxxxxxxxxxxxxxxxxxxxx|~~~~~~~|x
_________xxxxxxxxxxxxxxxxxxxxxxxxxx_________x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxx-Collision Tiles for the Layer-x
xxxxxxxxxxxxxxxxxxxx_________xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx|~~~~~~~|xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx|~~~~~~~|xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx|~~~~~~~|xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx_________xxxxxxxxxxxxxxx
Edit > Meh, forums get rid of multiple spaces, so I had to fill in my pic with other letters. ~ = sprites and x = nothing (just the places i would have put spaces)
So basically, you have tiles which appear over the player (these are objects the player can walk under or behind, such as the very tops of trees or under bridges, etc. Then you have those which appear under the players feet (mostly terrain. Grass, the bottom of trees and other objects, etc.).
Here is my problem; With this method, I have to know exactly how tall the player is when im setting up the tiles. If your player is only 16x32 tall, it doesnt matter much. But wait, what if I want to add a giant monster into the game? Or a horse for the player to ride? Or an exceptionally tall character? It would totally mess up the graphic engine!
The other thing I could do, is take one big sprite with all of the tall objects (That you can walk both infront of and behind), and then cut it Height wise into the number of Y tiles on the screen, and paste them one at a time, the ones on the top first, and the ones near the bottom last. Then paste the player accordingly, so he either appears behind or infront of the objects. Still, though significantly fewer sprites than pasting each one on screen individually, this would still cause a great deal of lag.