issue with tile map refresh speed

Game development specific discussions.
fxm
Moderator
Posts: 12374
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: issue with tile map refresh speed

Post by fxm »

In a user loop long term, this will prevent the program from hogging the CPU, and will free time for other tasks.
badidea
Posts: 2609
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: issue with tile map refresh speed

Post by badidea »

Alternatively, sleep every 10 loops?

Ran my program on my netbook, still 115 fps.

CPU: Intel(R) Atom(TM) CPU N450 @ 1.66GHz
GPU: Integrated in CPU, VGA compatible :-)
OS: Ubuntu 14.04 (32-bit)
FreeBASIC Compiler - Version 1.00.0 (09-14-2014), built for linux-x86 (32bit)

Image
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: issue with tile map refresh speed

Post by Merick »

Why not put the map into a single large image buffer and then put only the part of the map you need to the screen? If you want to have objects that the player can walk behind then you would need to put those images after drawing the character sprites, but that would be faster than re-drawing the whole map.
fxm
Moderator
Posts: 12374
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: issue with tile map refresh speed

Post by fxm »

badidea wrote:Alternatively, sleep every 10 loops?
I think I already tried this kind of solution, but this may produce images a little choppiness.
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: issue with tile map refresh speed

Post by leopardpm »

Merick wrote:Why not put the map into a single large image buffer and then put only the part of the map you need to the screen? If you want to have objects that the player can walk behind then you would need to put those images after drawing the character sprites, but that would be faster than re-drawing the whole map.
this would limit the size of the world map, and start to be very memory intensive if rotated views are also used (which I will incorporate into the prog)

right now the world map is something like 2048 x 2048 which would take up a rather large chunk of memory (assuming 3 bytes per pixel for color and each tile is 16 x 16, then this would be a 3gb picture in memory! ack!)
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: issue with tile map refresh speed

Post by leopardpm »

badidea,
I do not understand why your little netbook running at 1.6ghz, single core is getting 115 fps and I am getting about half that with dual core & 2.16 ghz??? I am driving a 40" external monitor and will check to see if there is any improvement just going directly to the notebook screen and disconnecting external monitor. The only other diff is ubunto vs windows.... can it really be that mush difference in OS speed?

disconnected monitor, ran prog, same speed... about 64fps.... argh! netbook can't have a better graphics chip then a notebook, right? ridiculous!

I will have to see if I can dig up my old netbook, same specs as yours, with some version of linux installed and load up Freebasic and try it out to see if it is getting faster frame rate too...
badidea
Posts: 2609
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: issue with tile map refresh speed

Post by badidea »

can it really be that mush difference in OS speed?
Shouldn't be, the correct graphics driver is often more important. Does the windows GUI itself run smooth?

Can a test later on a windows system.

Edit: Just thinking, it could be that my linux is cheating and not all frames actually drawn to graphics card.
badidea
Posts: 2609
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: issue with tile map refresh speed

Post by badidea »

Another test on my first system, under Windows XP (Windows 7 refused to boot).

CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
GPU: GeForce GTS 250
OS: Microsoft Windows XP [Version 5.1.2600]
FreeBASIC Compiler - Version 0.23.0 (08-14-2011) for win32 (target:win32)

With sleep: ~64 fps http://nr100.home.xs4all.nl/badidea/hexa_winxp.jpg
Without sleep: ~634 fps http://nr100.home.xs4all.nl/badidea/hex ... osleep.jpg

OS: Ubuntu 14.04 (64bit)

With sleep: ~260 fps http://nr100.home.xs4all.nl/badidea/hexa_sprites.jpg
Without sleep: ~649 fps http://nr100.home.xs4all.nl/badidea/hex ... osleep.jpg
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: issue with tile map refresh speed

Post by leopardpm »

badidea wrote:
can it really be that mush difference in OS speed?
Shouldn't be, the correct graphics driver is often more important. Does the windows GUI itself run smooth?
I got a nasty virus and had to reformat etc.. so have a fresh OS windows 10 and GUI runs smooth... also am running latest version FB

am getting 168 with sleep, 270 w/o sleep, better, but not what should be showing compared to yours...
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: issue with tile map refresh speed

Post by leopardpm »

weirdness, rebooted computer, now getting 290 w/o sleep and 64 with sleep - i hate how it is not consistent, something is wrong here - I guess I can continue to program and just know that it will run about 4x faster on other peoples machines... lol...

I do want you to run my Isometric Voxel Scrolling Map though, but I use PNG's for my graphics because of enhanced alpha channel transparency (instead of just on/off - magic pink - I can make all my pixels 0-255 transparent... shadows, etc...) and I don't know how to get my PNGs to upload here....
Imortis
Moderator
Posts: 1948
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: issue with tile map refresh speed

Post by Imortis »

Something I saw a lot of the code and pseudo-code doing on this thread: more than just drawing inside the screenlock/screenunlock block. It is best to have only the drawing happen inside that block. That alone can give a pretty good boost in speed as well as remove some flicker that can happen.

Just a bit of advice.
badidea
Posts: 2609
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: issue with tile map refresh speed

Post by badidea »

I don't know how to get my PNGs to upload here....
I think, you can't. I upload images to another location an then link with (img)(/img), but square brackets.

Could it be some power management that causes sometimes high, sometimes low fps?

The reason I get higher fps is most likely a faster (desktop) graphics card, although already some years old. During 3d-games that thing alone consumes 3 times as such power as an average laptop maximum (~150W). geforce-gts250
Post Reply