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.

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 24th Dec 2013 15:01
Hi.
Finally I Bought AppGameKit License and Want Begin Make the Game.
In 3d game engines for increase FPS should Use 3d model with low poly. But I don't know how can increase FPS in 2d Games?

can nyeone help me?

Thanks
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Dec 2013 15:10
Size sprite images in powers of 2 (64x64 , 128x128, etc)
Try to do as little as possible in loops that have animations.
Use this instead of Sync()
Update2D(0) : Render2DFront() : Swap()
It will speed up render times a little as it skips all 3D rendering.
Implement timer based motion.

Be aware that on Android and iOS your FPS will be seriously hampered. High end Android devices will achieve 60 FPS, but it is unstable. I'm sure iOS devices are simliar, but I've not tested them.

Using collision boxes/shapes on sprites can be very costly. Try to use collision shapes that are square.

If using physics then add a stepper like this:
while ( count < 4 AND timer()-time# >= physicsstep# )
StepPhysics( physicsstep# )
time# = time# + physicsstep#
count = count + 1
endwhile

Sprites that are not visible or are off the screen do not cost in frame rate, but will eat into your memory usage. If you need to load a lot of sprites then do it incrementally if possible.

Use clone sprite liberally. Clones are less costly than full sprites.

Those are all the tips I can think of. Timer based motion is a big one and you should spend time looking at the AppGameKit examples to learn it.

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 24th Dec 2013 15:22
These are some great tips already, just wanted to add that it's best to decide what you need/want from the start, and do tests to see how AppGameKit handles things. Like, layering alpha transparent sprites on top of eachother - that can really slow things down, so it's better to do tests, see what frame rates you get - then based on that, decide on a maximum number of sprites you can layer before things get too slow. Then you can consider this stuff when designing your game - it's better to start with a minimum, and add to it, rather than adding everything and having to take it out again. Often, you just won't know how things will run until later in development, when gameplay and AI and stuff is in place... so it's better to have a little performance leftover. Even just disabling transparency on any backdrop sprites that you can, will improve performance. As I say, it's best to experiment outside of your main project, then implement things there once you know how much it can handle. You might even be able to squeeze in an effect you didn't think it could handle, or an extra backdrop layer if your froogle with it from the start.

I'd suggest 30fps as a decent frame rate for 2D mobile games, saves battery, and allows for a fair bit of visual flair without things grinding to a halt.

I am the one who knocks...
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Dec 2013 15:25
Excellent tips, Van. 30fps is what I ended up capping dFenz at.

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 24th Dec 2013 18:58
Thanks All.
Quote: "
Size sprite images in powers of 2 (64x64 , 128x128, etc)
"


Mean My Sprite Sheet have Standard Size (64x64 , 128x128, etc)?

Quote: "
Use this instead of Sync()
Update2D(0) : Render2DFront() : Swap()
"

Mean Use Update2D(0) : Render2DFront() : Swap() together instead of Sync()?
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Dec 2013 18:59
Yes (also a note on iOS - sprite sheets max out at 1024x1024)
and
Yes

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 24th Dec 2013 19:20 Edited at: 24th Dec 2013 19:22
Thanks.

[quote]
Yes (also a note on iOS - sprite sheets max out at 1024x1024)
[\quote]

Thanks for note. for android there is Restriction?

if I use Standard Size and there is free space, no Problem? my attached sprite is standard right?

and another question no Problem if sprite sheet not square?

Attachments

Login to view attachments
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Dec 2013 19:26
I'm not sure what Standard Size is
Your sprite sheet should have no problems.
I try to size all of my subimages/animations in size of power of 2, which you've done. I'm never sure which is more important, the actual size of the sheet or the subimages... Just make sure your sheet isn't bigger than 1024x1024 for iOS compatibility

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Dec 2013 08:43
Thanks Naphier for good tips.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Dec 2013 10:30
Your images can be any combination of sizes IE. 1024x256 or even 16x1024 and not use excessive memory. It only means if you have an image of 600x600 it will get padded out to 1024x1024 for example.

oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Dec 2013 18:12
Thanks baxslash.

Login to post a reply

Server time is: 2024-11-24 23:21:07
Your offset time is: 2024-11-24 23:21:07