Multiple resolution support

Multiple resolution support

Postby Edward_Lii » 23 Mar 2012, 18:20

Hello all,

One of the tasks for V0.4 is the support for multiple resolutions.
I started working on it and encountered a problem that isn't easy to solve.

Since SDL is software rendering scaling will be too intensive to be done every frame.
For the menu background I only did it once and stored that surface for rendering.

The actual problem is the performance of the game on a higher resolution.
And it's bad, real bad. :cry:
Although a resolution like (1280x1024) is working fine going higher makes the framerate drop noticeable.

You can easily test it yourself by changing the SCREEN_WIDTH and SCREEN_HEIGHT in Globals.h.
The fading effect is also quite intensive. :|

So what are we going to do, implement it anyway or leave it out (at least for now).
I'm afraid that if we implement it new users will think: Small screen->options->higher resolution->not smooth == rubbish game.
Another option would be to use GL as the SDL rendering backend.

BTW, it does work smooth when I enable desktop effects in KDE, probably because the window becomes a texture so drawing is done on the GPU.
We could force people to use KDE as a requirement of the game. :p
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Multiple resolution support

Postby acme_pjz » 24 Mar 2012, 05:46

Hi,

IMHO SDL supports hardware accelerated 2D graphics internally (set some flags when calling SDL_SetVideoMode or some other functions), but it seems effectless under Windows :| Maybe we should try SDL 1.3 or some other 2D library?
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Re: Multiple resolution support

Postby Edward_Lii » 24 Mar 2012, 08:54

Hello acme_pjz,

acme_pjz {l Wrote}:IMHO SDL supports hardware accelerated 2D graphics internally (set some flags when calling SDL_SetVideoMode or some other functions), but it seems effectless under Windows :|

IIRC we have that flag set by default, I can't seem to notice the difference on Linux either.
After some searching I found this (http://linuxdevcenter.com/pub/a/linux/2003/08/07/sdl_anim.html)
linuxdevcenter {l Wrote}:...
The part that isn't obvious is that on my desktop system if I want a hardware surface, it has to be full screen. I can't get a hardware surface for a window. This is one of those things that is operating system and device driver specific. Some systems let you have a hardware surface for a window. Even if you can get a hardware surface for a window, you may not be able to get a double buffered hardware surface for a window.
...

So we can't rely on the hardware acceleration built into SDL. :|

acme_pjz {l Wrote}:Maybe we should try SDL 1.3 or some other 2D library?

I have nothing against SDL 1.3, but the problem is the distributing.
Most Linux distros don't have SDL1.3 in their repositories, meaning that getting the game in there will be virtually impossible.
Besides that the game will be harder to port to devices, because it's likely they'll use 1.2 instead of a newer version.

I think I'll look into the way a window is rendered in KWin when desktop effects are enabled.
It makes a huge impact, while all it can do is have the window texture on the GPU memory (meaning that only the blitting of the screen is accelerated).
Perhaps we can somehow use an openGL window and blit the SDL_Surface to it?
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Multiple resolution support

Postby Edward_Lii » 11 Apr 2012, 16:56

Hello all,

A quick update, since the first implementation of the "gl renderer" there were some artifacts.
The first fade out didn't work for example and sometimes text from the previous state could be seen in text boxes.

Finally I found the source of this problem and was able to fix it.
Turns out that the created screen surface had an alpha mask set, which caused some transparent parts on the current frame to "show" the previous frame.
The fix is in svn rev. 336. :)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Multiple resolution support

Postby ctdabomb » 11 Apr 2012, 16:58

YAY!!! so this means it's all good right?
Some people are like slinkies... not really good for anything, but you still can't help smiling when you shove them down the stairs.
ctdabomb
 
Posts: 1075
Joined: 13 Dec 2011, 21:21
Location: halfway there

Re: Multiple resolution support

Postby Edward_Lii » 11 Apr 2012, 17:02

Hello ctdabomb,

ctdabomb {l Wrote}:YAY!!! so this means it's all good right?

This means that it should look exactly the same as the software renderer, only a lot faster. ;)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Multiple resolution support

Postby acme_pjz » 12 Apr 2012, 06:29

Edward_Lii {l Wrote}:Hello ctdabomb,

ctdabomb {l Wrote}:YAY!!! so this means it's all good right?

This means that it should look exactly the same as the software renderer, only a lot faster. ;)


As long as we don't use too many lock-required operations... BTW it looks like SDL_gfx need to lock surface?
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 665
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Who is online

Users browsing this forum: No registered users and 1 guest