CPU Usage


Miner49er

Active Member
Joined
Mar 1, 2004
Messages
655
Age
49
Website
www.lessermatters.co.uk
Hi there folks!


I have recently returned to hacking together a game for (primarily) the Pandora. However, I'm concerned or am wondering if I should be concerned about the cpu usage of my game...it's running at between 50% and 75%!! This is clocked at 500Mhz.


On my desktop it runs at 4% (it's an i5 or something like that - pretty good cpu)


So firstly should I care about this? I would like to know the cpu usage of other games out there but many don't run in a window so I can't use 'top' to watch and I haven't got around to logging the usage. Do any other developers bother to look at such details? Or is the philosphy "as long as it looks good, I don't care?"


Perhaps some folks have suggestions on how to optimise (I haven't really tried to optimise yet). I'm using SDL for graphics and drawing to several screen size off-screen buffers (this I may optimise...but will go back to simpler code if it has no effect)


well, any ideas/thoughts/suggestions would be well appreciated :)


cheers guys,


m
 
I'd say: If it runs fullspeed at 50-75% CPU usage and you can't optimize it a lot without extensive rewrites: Don't care :)
 
Thanks for you intput mcobit - it is well appreciated :) Still, I would be interested in as many opinions as possible.


Does anybody know if I will gain much by attempting to convert my SDL_Suface objects to openGL ones. I've implemented a Tile-based 'engine', so I have lots of blitting to offscreen-buffer's, then a final blit each frame.
 
Can you use a preblitted background (all static elements pre-blitted in a buffer) for erasing? Do you only blit things that need to be blitted? Blit smart, blit less :p
 
That is what I already do B-Zar. I blit all tiles to an offscreen-buffer, then on each frame blit that buffer to the visible display.


Yesterday, I implemented scrolling (just horizontal right now). So now, I store 3 off-screen buffers (middle, left and right) - I then display all 3 frames offset by relevent amounts. Yes, I realise that I can only display, at most, portions of 2 buffers at any one time but It was quicker (in coding terms) to blat all tiles to buffers either side of the visible screen...for now, I will look at optimising this later on.


I mean, I could just draw the next one or two 'columns' of tiles as and when they become visible but this would be more complicated in my current system (I started off with a flick-screen affair)


Well, It's fun anyway and looks pretty good on the Pandora (despite the CPU usage)...though there is screen-tearing.
 
For the screentearing, try to use notaz modified sdl.


More info of how to setup everything here:
 
Wow, just tried notaz SDL mod - super smooth...but slower. Do I need to remove my wait on each loop?


EDIT: I removed the SDL_Delay still same problem...oh well.
 
Last edited by a moderator:
Back
Top