Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / I need help pasting tile sprites on the screen!

Author
Message
CajunCoder
22
Years of Service
User Offline
Joined: 29th Nov 2002
Location:
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.
Belthazor
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Lafayette,Louisiana
Posted: 28th Jan 2005 04:42
Sorry...I can't help you, but can I ask where you are from?

Tryin hard...
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 30th Jan 2005 06:20
lol

Quote: "Have any of you ever tried pasting, say, a 30x30 tile matrix (tile size 16x16 pixels)? DBP comes to a HALT!"


My game doesnt come to a HALT..... if you use sprites, turn off their backsave state and use cls every loop:

set sprite *,0,1

CajunCoder
22
Years of Service
User Offline
Joined: 29th Nov 2002
Location:
Posted: 31st Jan 2005 02:20 Edited at: 31st Jan 2005 02:26
That does not work. For some strange reason, when I turn backsave off, even if I tell the sprite to be pasted on the screen every frame, it is only pasted once. Thus when I clear the screen, the sprite is not repasted. Now, this is unless I use the paste sprite command, rather than just using "Sprite". If I use paste sprite command, I only get a frame rate of 75! which is unacceptable for my project. Also, I am using Draw Sprites First, so, I cannot use CLS. But really, if you are pasting a tile over itself, there is no need to clear the screen, because you are already doing so by repasting it over itself, it is after all not a character or anything.
Of course, that still doesn't work with the sprite command, as it wont repaste the sprite, as I said earlier.

I think I will just use my original idea of several layers, being massive sprites. I'll just have to keep players and objects under 32 - 48 pixels tall.

I was born in louisiana (born in new orleans - never lived their though, aside from the first few days of my life), and my family (on my father's side) is from louisiana - gibson to be more specific. I live in mississippi though (bah, bubba does'nt understand rice! and he thinks gumbo is a... soup! So he serves it like one, in a high edged bowl, with no rice!).
Agent
20
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 12th Feb 2005 15:47 Edited at: 12th Feb 2005 15:51
Use images instead of sprites.

Investigate the PASTE IMAGE command instead of the SPRITE command. Much better for creating tiles. Far faster.

Keep your three layers. Draw the ground first, then the player characters, then the overhead graphics that the player can walk under/behind. So long as, for example, you set the tile for the base of the tree as a 'ground' tile, and the tall parts of the tree as 'walkbehindable' tiles then this method will work regardless of the size of player characters.

Login to post a reply

Server time is: 2025-05-17 10:10:43
Your offset time is: 2025-05-17 10:10:43