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.

Dark GDK / Civ Game Discussion

Author
Message
Klas Wullt
14
Years of Service
User Offline
Joined: 7th Dec 2009
Location: sweden
Posted: 20th Oct 2011 04:10
I have been doing many various things with Dark GDK by now.
Hello.
I am trying to make a civ similar strategy game.
..and I have some questions.

Why is the game so slow?
I made sprites for tiles and the game takes so long to load
but this is just 2d graphics and I need thousands of sprites for all the tiles and cities.

Also each time I move the window that the game pops up in
the screen goes blank, why does it do that?

Is there some way I can speed the game up
or is dbImage somehow faster.
DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 20th Oct 2011 05:25
Quote: "Also each time I move the window that the game pops up in
the screen goes blank, why does it do that?
"

I don't know, but most projects do that. It doesn't really matter.
Quote: "I made sprites for tiles and the game takes so long to load"

If you mean that it takes a long time to load before the gameplay begins, don't be concerned. Images are some of the longest things to load and are actually much larger than 3D objects, typically.
One thing you could do to increase both the in game fps and the loading time would be to make sure the images you are using are not excessively large compared to there size in the actual game.

Also, While you would need very many sprites for a game like this, you could reduce the number by making objects that are made up of what would look like two sprites out of one sprite by using dbPasteSprite(intID).

While seting up the game you can use dbDrawSpritesFirst () to make pasted sprite appear on top of all other sprites. Then, you can manipulate the sprite and paste it multiple times to get any number of sprites(visually) from one sprite. Just make sure it is in the desired state before you Sync.


Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 20th Oct 2011 21:47
Although the game map may contain thousands of squares (or hexagons), I doubt that you need thousands of different images, since the tiles are surely repeating.

I don't have really good ideas to reduce the loading time. Maybe, if the tiles are now separate images in separate files, you could try to group them into big images, and break them up into tiles when the image is already loaded into memory. If the computer has to load one file, it might be faster than opening several files, but I'm not sure if that time is not lost again by having to process the image after loading.

I don't know what image format you use, but select one that compresses well (png), if you are not already doing so. Loading an uncompressed image takes longer.

To make the game fast when it is running, create sprites only for those tiles that are visible on the screen. If the map is much bigger than the screen, there is no need to process tiles that are not currently visible. It requires some calculations, but you can re-use a limited number of sprites to display changing portions of the map.

If the background tiles completely cover the screen, switch off background saving and transparency for the sprites (dbSetSprite), that could also gain a little performance.

These ideas come to mind, sorry if I told you something you already know.
DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 20th Oct 2011 22:31
I would recommend dds for a format instead of png because I have had issues getting transparency to work with png.
Don't use jpeg! It may not ruin the look of an image, but it will make it unusable in a game.


Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 23rd Oct 2011 19:20
Yes.. DDS is a very good format to use with DGDK, because it is native to the DirectX SDK. However, to make loading times shorter, try making the sprites for the ground tiles into one image, all of the buildings into one image (or more, based on building sizes maybe), ect. This way, you don't have to load each individual tile into memory, and you can just use dbPasteSprite to display ONLY what is currently on-screen. Sure, it may take more time and coding, but when weighed against the other methods, it is actually quite worthwhile.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Nov 2011 18:48
I agree -

DDS file format - Decent - has mip mapping - good for 3d LOD texturing...

PNG - Sweet - lossless compression - might load quicker

JPG - even more compress - BUT it loses DATA - DONT use for your originals - nasty side effects of "loss FULL compression - it can wreck your work!)


I also agree that making one image with tiles in it would be faster - less iterations of darkgdk code, more in one call grabbing the one image.. and yeah it is more work to calculate WHERE on the image you want to get your data and making it RIGHT but the speed gain might be slamming...

Every arcade game you used put quarters in....(going back 30 years or so) aside from Dragons Lair (which was a innovative cartoon on laser disk) used this technique to pack graphics into very little memory... so you're in good company!

Login to post a reply

Server time is: 2024-10-02 21:29:58
Your offset time is: 2024-10-02 21:29:58