Frame rate for the game? aka graphics rendering

Karsten75 · 6822

thepenguin

  • Hero Member
  • *****
    • Posts: 3038
  • "What if ..."
Reply #15 on: September 12, 2010, 05:05:39 pm
I've seen that when the game is paused and spores are in flight, they seem to jump a few pixels every second, is this a result of low framerates, or just your algorithim

We have become the creeper...


UpperKEES

  • Hero Member
  • *****
    • Posts: 5525
  • The Creeper is getting deeper.... into me.
Reply #16 on: September 12, 2010, 06:11:50 pm
Score wise, there is no frame reason for the way it is on CW1.  I basically just focused on "score" not time.  I had web site score integration in mind.  Time in CW2 (for scoring purposes) is calculated by the number of elapsed frames since mission start.  So it's a pretty accurate thing.  Scores reduce this accuracy by mashing a very accurate frame count into an exponentially decaying range of 10000 to 0.

Yes, the score is calculated off of "seconds" not frames.  So precision is lost there.  To get those extra points you have to shave off enough to keep the time from advancing once second more.

I'm not sure if I understand the exact relationship between above two quotes. Is time in CW1 also calculated by the number of elapsed frames since mission start? If so, i.e. 378 frames would be equal to 10.5 seconds, which could be converted into a precise score, right? (And yeah, I know it's too late for that now. I noticed it before, but I never said anything. ;)) Thanks again for all your answers!

Next question: Can I find the frame rate delivered on my system somewhere?

I wondered the same thing. I always had it on display when tweaking my Half Life setup years ago.

I've seen that when the game is paused and spores are in flight, they seem to jump a few pixels every second, is this a result of low framerates, or just your algorithim

This is just animation. They spin a little and because this animation isn't fluent (the end doesn't come back to the starting point exactly) the spore seems to 'jump' a little, but it doesn't actually move. Let the game run (in paused mode) for a while and you'll see they're still at the same spot.

My CW1 maps: downloads - overview
My CW2 maps: downloads - overview


knucracker

  • Administrator
  • *****
    • Posts: 11749
Reply #17 on: September 12, 2010, 08:08:56 pm
Yes, the score could be based on frame precision timing, it just isn't.  It's based off of the number of seconds that have elapsed.  So I take the frames counted, turn this into seconds and then use that to show the elapsed time and to calculate score.

Tap the "=" key during a mission then look in the lower hand corner and you will see the frame rate.  Keep in mind you may see fluctuations up and down... this is normal.  You may also see a number less than 36, and that is perfectly fine too.  The average person will probably see around 32-33 fps.  I've played the game down below 30 before.  Also note that the frame rate will appear to double when you activate double speed.



Karsten75

  • Hero Member
  • *****
    • Posts: 6823
Reply #18 on: September 12, 2010, 09:50:13 pm
Yes, the score could be based on frame precision timing, it just isn't.  It's based off of the number of seconds that have elapsed.  So I take the frames counted, turn this into seconds and then use that to show the elapsed time and to calculate score.

Tap the "=" key during a mission then look in the lower hand corner and you will see the frame rate.  Keep in mind you may see fluctuations up and down... this is normal.  You may also see a number less than 36, and that is perfectly fine too.  The average person will probably see around 32-33 fps.  I've played the game down below 30 before.  Also note that the frame rate will appear to double when you activate double speed.

Easter Egg!  Nice one, Oh Sneaky One!  :P

"Any leftover cabbage can and will be mixed with mayo"
   - Cole's Law


UpperKEES

  • Hero Member
  • *****
    • Posts: 5525
  • The Creeper is getting deeper.... into me.
Reply #19 on: September 12, 2010, 10:04:15 pm
Tap the "=" key during a mission then look in the lower hand corner and you will see the frame rate.

Nice indeed! And very useful now I'm testing something:

Some units check things only every 36 frames.

When I just filled my screen with collectors, reactors and relays only, CW slowed down a lot: 7.5 FPS on my rather fast computer (full screen or windowed very tiny actually didn't matter!). You would expect these rather static units not to affect the FPS too much (I guess CW only needs to check if they are still there and connected to the network, so probably a counter is updated per unit type. Same for speed and storage, so I always wondered why a map with 40 pre-built speed nodes suffers from so much lag. Aren't these the units that you check every 36 frames? Just asking because you might be able to improve this for CW2....

My CW1 maps: downloads - overview
My CW2 maps: downloads - overview


knucracker

  • Administrator
  • *****
    • Posts: 11749
Reply #20 on: September 12, 2010, 11:23:24 pm
Units check for connectivity back to OC about once a second.  But, as you add more of them you create a larger graph of nodes.  This makes the "search" for connectivity take longer while at the same time you are increasing the number of units.

I've made great progress increasing performance for cw2 in the A* algorithm and supporting data structures.  I pretty much has to if I wanted to pull of the game I've created in CW2.  Every terrain cell is a node in a graph, and the game space is 32 x 90 (currently).  Packets are also more plentiful in CW2 so they are path finding their way through this array all of the time.

That said, CW1 isn't bad... it gets away with a lot considering only about 25% of the total processing time is devoted to game computation... of that, more than half is devoted the the Creeper CA simulation.  What's left does path finding and everything else.
75% of the cpu load is from the flash player drawing everything.... and that's another reason why when you add more units things get a little slower.

Don't get too caught up with the fps, though.  You'll start experimenting with all kinds of variables (screen size, resolution, color depth, cpu settings, flash versions, air versions, game settings, mission content.....)  It's a black hole... :)



UpperKEES

  • Hero Member
  • *****
    • Posts: 5525
  • The Creeper is getting deeper.... into me.
Reply #21 on: September 12, 2010, 11:43:07 pm
75% of the cpu load is from the flash player drawing everything.... and that's another reason why when you add more units things get a little slower.

I'm surprised by that because none of these units have animated graphics, so there's no need to redraw parts of the screen.

Don't get too caught up with the fps, though.  You'll start experimenting with all kinds of variables (screen size, resolution, color depth, cpu settings, flash versions, air versions, game settings, mission content.....)  It's a black hole... :)

No worries, I won't. I'm done with it now, so back to playing! :)

My CW1 maps: downloads - overview
My CW2 maps: downloads - overview


Karsten75

  • Hero Member
  • *****
    • Posts: 6823
Reply #22 on: September 13, 2010, 12:04:56 am
Next question then:

When you animate a blaster in CW, its turret moves in the direction it fires. Do you simply have a library ful lof blasters pointing in the various directions and you replace the graphic, or how is that done?

"Any leftover cabbage can and will be mixed with mayo"
   - Cole's Law


Echo51

  • Sr. Member
  • ****
    • Posts: 1139
  • Always lurking in chat, just not always aware
Reply #23 on: September 13, 2010, 01:15:45 am
Karsten: im pretty sure its a single frame he rotates on a central pivor in the direction its shooting in

Join the chat! :D
- The only echo present here...


knucracker

  • Administrator
  • *****
    • Posts: 11749
Reply #24 on: September 13, 2010, 12:33:38 pm
Blasters are made of thee sprites, one for the body, one for the gun, and one for the beam.  The body pretty much forms the base, the gun in on top of the body and gets redrawn based on the direction of fire.  The beam sprite sits between the two.  It is transparent most of the time.  When the blaster fires, I draw the line.  I also add a glow filter to the beam sprite to make the line appear to have soft edges.

The game as a whole is made up of several different 'layers'. There is a terrain sprite that holds the background bitmap.  There is a sprite above that which holds the creeper bitmap.  There are several sprite layers for the units (when they are on the ground, when they are moving).  There's a sprite for the mist... then a couple more sprites for things like dialogs and popups.



UpperKEES

  • Hero Member
  • *****
    • Posts: 5525
  • The Creeper is getting deeper.... into me.
Reply #25 on: September 13, 2010, 01:01:08 pm
Reading all of this I think you're developing damn fast! :o

My CW1 maps: downloads - overview
My CW2 maps: downloads - overview


Blaze

  • Hero Member
  • *****
    • Posts: 2391
  • Busy busy busy.
Reply #26 on: September 14, 2010, 12:50:21 am
I've seen people on A.G take years to develop a game not even half as long as CW1 and nowhere as good.
I say, Virgil is the best developer ever. What was it? About a month or two ago and there were no screen shots, and now, it looks close to being done.


UpperKEES

  • Hero Member
  • *****
    • Posts: 5525
  • The Creeper is getting deeper.... into me.
Reply #27 on: October 20, 2010, 04:27:22 pm
Since CW is frame locked, I  do most of the game logic per frame.... just not every frame.  For instance, full creeper updates come only every 8 frames.  Some units check things only every 36 frames.  I literally have a frame counter and may do something like:
if (frameCount % 8 == 0) {
   updateCreeper();
}

[...]

I sometimes mod the frameCount by a prime number (and use different prime numbers for different tasks) to help mix things up.

After trying to determine a few of these prime numbers I found:

- blasters fire every 7 frames (pretty sure about this one)
- mortars fire every 103 frames (could also be 101 or 107)

Is that correct?

How do you solve the +15% firing rate upgrade? Can they still be prime numbers?
« Last Edit: October 20, 2010, 04:43:50 pm by UpperKEES »

My CW1 maps: downloads - overview
My CW2 maps: downloads - overview


Kamron3

  • Sr. Member
  • ****
    • Posts: 1722
Reply #28 on: October 20, 2010, 04:37:30 pm
Humans can only see 23.7 fps. The more FPS, the higher the quality.



Echo51

  • Sr. Member
  • ****
    • Posts: 1139
  • Always lurking in chat, just not always aware
Reply #29 on: October 20, 2010, 05:57:36 pm
Lies kamron, there isent a certain FPS people can see...

Join the chat! :D
- The only echo present here...