Bug in almost complete battle system
Displaying 1-6 of 6 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ErayMan

Hey! I am almost ready to release a demo of my game, but I have a nasty problem with performance in the battle engine.
You see, on my computer, it runs at a constant 200fps for about 62-65seconds, and then woop it goes down to 150-160fps for no apparent reason!
If anyone could help me with that I would be forever a happy man.
Except for that it works pretty well, so even if you can't help, go check it out! :)

Here's a screenshot:



The yellow number at the top is the time in millisecond, and the white underneat it is the estimated FPS.

Here's what I need to know:
- On my comp it runs at a constant 198-200fps, but my comp is very powerful (athlon 64 3800+), so I need to know how fast it is on other comps (it is playable up to 90fps, below that it sucks hehe)
- At about 6200ms to 6500ms (everytime) it loses 'bout 50fps for no reason at all!! How come?

Things to note:
- To get in a fight you need to enter the first house you see (eh)
- Most of the code and comment are in french :/ sorry (but not function names, so it should be alright)
- You can toggle Berserk status change on monsters by pressing B or N, it has a nice effect so try it :) (but takes a lot of juice hehe)
- For some reason it is MUCH faster in full screen than windowed, so be sure you run it that way (press alt-enter)
- Oh, and monsters are hand-drawn by a friend of mine :) Visit her here.

So, get it here: ErayManBattleBeta.zip (1.76meg)

Tell me what you think! :)

Edit: This time it took 90s to slow down instead of the usual 65s, so you might have to be patient a little bit ;)
Edit 2: Oh I just found out that once it has slowed down, if you alt-tab it and come right back in the game everything goes back to the top speed! :'( Help me!!

Posted on 2007-02-14 01:19:48 (last edited on 2007-02-14 01:43:18)

IkimashoZ

I couldn't reproduce the slowdown effect you mention. But then, maybe my computer's too slow to register a difference. I have a 1.2 ghz processor in this thing, intel pentium I think (don't really care either, when I bought it I just wanted something to do word processing on for work).

Anywho, I'm getting a very lame 50-56 fps during battle. There is no particular slowdown anywhere in the 6200-7000 ms range. It did seem to drop to somewhere between 46-52 fps anytime there was an attack animation on the screen, but save for those occurances, I got a consistent 50-56.

Very neat system by the way. I'm looking forward to seeing more.

[edit]
Oh yeah, and switching to fullscreen added about 5 fps to both ranges, but still no drops in speed for no reason.

Posted on 2007-02-14 06:20:28 (last edited on 2007-02-14 06:23:51)

Overkill

Upon testing, here are my results using a AMD Sempron 2600+ with a GeForce 7600GS and 1.5gb of ram.

Full-screen: 70 fps, always.
Windowed mode (automax off): Alternating 56/58 fps.
Windowed mode (automax off, meaning the 640x480 battle screen is scaled to 320x240 because changing the resolution doesn't resize the window): Alternating 130/136 fps.
Windowed mode (automax off, after manually resizing window to proper resolution): Alternating 68/70/86 fps.

Really, for a battle system that doesn't actually require much user feedback, framerate shouldn't be too much of a concern. Near or above 60 fps means you're not really missing much, and it's not like the in-game sprite animations are really 60 fps. Though, you're not exactly doing anything that intensive... so it leads one to worry slightly.

Posted on 2007-02-14 13:37:32 (last edited on 2007-02-14 14:01:31)

ErayMan

Ikimashoz: thanks for the feedback :) Yeah, it seems the slowdown problems only occur in some specific conditions outside of the game, as I moved my game in another folder then stripped it of unused files and all, and magically the 62-65 range became way off... so might be just me after all

Overkill: Yeah, I, too, think there is something wrong the way I handle things, cause blitting something like 3 .jpgs at a time reduces fps by 40 of so, and I don't think that's quite normal.
And yeah, at 60 fps, thing should run very well, since there's not a lot of things that moves on screen. Hell, even 30 fps should be playable hehe. I'll have to look into it later... but I had a terrible experience trying to time things with a fixed value, like the defined "timer" and such. But I'll try that again for sure.

I'm gonna have to optimize everything before an official release, that's for sure.
Thanks again for your time!

Posted on 2007-02-14 14:31:29 (last edited on 2007-02-14 14:35:39)

Arkhan

I dont know. If its just dorky jpegs and such it should run on hardware equivalent to a SNES.....

speaking of which, did you try blitting .bmps instead of .jpgs?

i didnt look at the battle system but how are the files organized....are they in a linked list or an array or something?...maybe all of the blitting is just hogging up resources and you need to do some buffer cleaner upping?

just some quick thoughts that stem from me playing a few MMORPGs where you occasionally have to type /flush to wipe the cache out to boost FPS back up there.....

:)!

Posted on 2007-02-16 13:48:03

basil

I unfortunately don't have the opportunity to play with the demo or look at the code, but if you're concerned about speed I have advice. Might be useful, might not.

For a typical battle system, any slow-down is going to be coming from blit functions (really the only other source is very big loops, which you probably don't have). Things like transparent blits will rapidly bring things down if there are a few large ones each frame. So:

a) if there is an instance where you are transparent blitting but the background is not changing, you don't have to be transparent blitting. Just get an image of the sprite with background and do a regular blit ( IkimashoZ knows about this). Obviously this won't work for something like a mouse cursor, but it will for a static enemy on a static background.

b) If you are individually blitting parts of your menu screen (e.g. blit the left border, blit the right border, blit a button etc), combine them into one image if possible.

In general, the simpler the blit varient and the fewer of them, the faster you'll be. I'm a little confused about the erratic-ness of the bug though, which more suggests that you are somehow entering a very long loop every now and again.

I'm very impressed, by the way.

Posted on 2007-02-22 01:40:07


Displaying 1-6 of 6 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.