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.

Newcomers DBPro Corner / Frameskip?

Author
Message
Andrzejef
12
Years of Service
User Offline
Joined: 26th Dec 2011
Location:
Posted: 16th May 2014 12:26
Hi,
I have one - simple I hope - question. When I render my project in DBPro, it works nice and smooth, while main object (player) is near the edges of the map. The further it goes however, the worse is it's speed. Eventualy I feel like in matrix. On the other hand, some games (like Terraria) have the frameskip feature, that allows to move sprites with the "independent" (or rather constant) speed, instead of slowing down. Is there a way to set frameskip up in DBPro?
Thanks in advance.
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 16th May 2014 19:27 Edited at: 16th May 2014 19:28
Sounds like you have too many polygons in your terrain and/or level for your computer to render quickly... how detailed is your map?

666GO†O666
Andrzejef
12
Years of Service
User Offline
Joined: 26th Dec 2011
Location:
Posted: 16th May 2014 19:45 Edited at: 16th May 2014 19:50
It's plain. Just tilebased map with sprite character. Each tile is 128x128, player sprite is 64x64. Tiles and player are *.png, if that means a thing to it. Player sprite uses transparency (image colorkey set up for white). As it's pixel scrolling I reckon it's not the problem with rendering as such. I've set sync rate strict to 60, that's why I'm concerned with this framerate drop.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 16th May 2014 20:46
Just to be clear, this is a 2D game, right?

My guess is that you have something in your code that is slowing down the process. You didn't list your computer specs, but I assume you have a decent rig.

I would look at each subroutine / function to see how long it takes them to run in the game. You can store the perftimer() value prior to accessing a subroutine / function and then read the perftimer() again after the subroutine / function ends. You calculate the elapsed time and then print that value on the screen. Then you look at what is taking so long to process. You might want to collect, say, 10 elapsed time values and average them so that you don't constantly have a different number showing up on-screen. Anyway, this might point you to where the slowdown is occurring.

If that doesn't show anything, perhaps you could post the code you are using to move / display your map.

So many games to code.....so little time.
Andrzejef
12
Years of Service
User Offline
Joined: 26th Dec 2011
Location:
Posted: 16th May 2014 22:41
yes, this project (it's still hard to call it a game) is 2D.
I'll try that, I'll also try to make frames counter, just to see the results of sync (f only I understand it right that sync rate is the amount of refreshes per second).
Thanks for help so far, and I hope it will be solved next time I turn to write here.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 17th May 2014 00:07
Boost FPS:
Do you do collision checks? That bottlenecks things. Number of sprites also affects it so you need to "cull" sprites not in use.
If you do collisions, use the zoning system or distance formula to reduce collision checks to only those within player's range.
You must also manually sync only once at the end of the main loop so set sync on and sync twice before program start.

Frameskipping:
Possible but I would say a last resort because thinking of that extra hassle is enough to put me off writing a game.

"Oh nonZero, let me tell you, I love you." -- Dark Java Dude 64, Vice-Kapitan of nASA(nonZero's Awesomeness-Spreading Association)
Andrzejef
12
Years of Service
User Offline
Joined: 26th Dec 2011
Location:
Posted: 17th May 2014 14:37
Well, nonZero, for now I don't have a thing to collide with. There is just a map of tiles and a "player".
You mean to sync it before entering the main loop? I did that, but with no result.
Now that I think of it, I might have screwed something up when creating the map-drawing function, because it got slower each time it needs both to render and erease tiles, and it does just great when dealing with just one of those actions. I'll look into it.
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 17th May 2014 16:18
In Sprite system.
"SET SPRITE 1,1,1" is slow.


Attachment:

windowsXp

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th May 2014 17:22
Andrzejef, we can keep guessing what the problem might be, but it seems like it would be much easier to troubleshoot your code. pcRaider is correct about SET SPRITE, but if you are not using that, it is not going to help you. If you would post your map movement code, we might be able to help you.

So many games to code.....so little time.
Andrzejef
12
Years of Service
User Offline
Joined: 26th Dec 2011
Location:
Posted: 20th May 2014 16:03
Guys, call me an idiot, for I've found the reason. I indeed used 128x128 tiles, but I treated them like 32x32 (placing them in 32 pixels periods, but the tiles were still 128), forgetting to crop it (I also passed you wrong size of player sprite - itwas 32x32, old project was 64). And so they were overlapping, provoking lots of useless calculations.

Login to post a reply

Server time is: 2024-11-21 15:54:17
Your offset time is: 2024-11-21 15:54:17