Games for different resolutions and multisampling

Previous topic - Next topic

S.O.P.M.

Hey all,

it's a shame but I just realised what the multisampling option is for. I always thought that GLBasic cannot do anti aliasing which is common for every modern game of course. But this option does not work for me, I can't believe it. Have a GeForce 310M graphics card where you cannot tell me that it doesn't support that. So if I have the multisampling option activated all sprites are white rectangles :O and for DRAWLINE there's no effect. Also the application crashes often.

The second thing I struggle with is how to write a game that works with different screen resolutions? Almost every modern game isn't bounded to a fixed resolution, right? How to manage this in GLBasic, that's my question. One possible solution would be to draw everything in the game and then take the whole screen into memory and draw a resized image with the final resolution but as I fear this will not work properly because: to get fine looking graphics you would have to draw your game in the highest resolution and downsize it. Now if the resolution is set not to the highest one the game supports you would have to draw also outside of the screen and that content cannot be read by GRABSPRITE, right?

Another solution which cannot be the real one is to draw all the elements in the game already resized with percental values for the position on the screen - very inconvenient and hard to do for my understanding.
So which way you would do that task?
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

bigsofty

Ampos donated a very nice little lib for different resolutions here...

http://www.glbasic.com/forum/index.php?topic=7145.0

Never used the multi-sampling option before I am afraid so I am of no use here?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

Multi-sampling (anti-aliasing) is also controlled by the nVidia control panel, dont forget...

I dont know why all your sprites are white, as mine work fine...   I suspect you have found a limitation of a mobile graphics card (or you are using a very old driver).

Multi-sample tends to be noticed more on scaled sprites, as you can see from the included graphics.

I dont know why just one corner is anti-aliased, but the nVidia settings to drastically change what you see, which in turn can affect GETPIXEL.  These settings can either override GLBasic ones or "enhance" them...

I would keep multi-sampling off, and let the user change values in the control panel if they need anti-aliasing and what not...

As for screen resolution, I go for a multi-platform approach : Set an initial resolution that each platform runs at and allow the user to change the resolution in the program, after which ALL graphics are removed and then re-loaded.  This is important as some platforms dont take kindly to a screen resolution change and keeping the (apparently) loaded graphics.  I say apparently as on these platforms the graphics will have been partially removed and so trying to re-use them will either display nothing (or corrupted graphics) or crash your program.



[attachment deleted by admin]

S.O.P.M.

Quote from: bigsoftyAmpos donated a very nice little lib for different resolutions here...
Looks interesting but as I can see, 3D-commands are used and unfortunately I only have a licence for 2D/NET.

Quote from: MrTAToadMulti-sampling (anti-aliasing) is also controlled by the nVidia control panel, dont forget...
I dont know why all your sprites are white, as mine work fine...   I suspect you have found a limitation of a mobile graphics card (or you are using a very old driver).
Yes, I took a look in the control panel and noticed that the anti aliasing mode is set to "extend application settings" which should be the proper selection.

QuoteAs for screen resolution, I go for a multi-platform approach : Set an initial resolution that each platform runs at and allow the user to change the resolution in the program, after which ALL graphics are removed and then re-loaded.  This is important as some platforms dont take kindly to a screen resolution change and keeping the (apparently) loaded graphics.  I say apparently as on these platforms the graphics will have been partially removed and so trying to re-use them will either display nothing (or corrupted graphics) or crash your program.
Maybe I should try this way but it doesn't solve the problem how to specify the position of sprites without having a bad display due to mathematical inaccuracy.
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

MrTAToad

You would work out the position based on a multiplier between your base size and the current graphics mode.  Positioning would then be based on that.

Wampus

Quote from: S.O.P.M. on 2012-Mar-04
Another solution which cannot be the real one is to draw all the elements in the game already resized with percental values for the position on the screen - very inconvenient and hard to do for my understanding.
So which way you would do that task?

Just a side note. Things like this might seem hard at first, especially conceptually, but once you've solved a problem it stays solved. Also, every time you solve a problem you not only get a solution you can use again and again you also improve your skills by doing it.

ampos

Quote from: S.O.P.M. on 2012-Mar-05
Quote from: bigsoftyAmpos donated a very nice little lib for different resolutions here...
Looks interesting but as I can see, 3D-commands are used and unfortunately I only have a licence for 2D/NET.

mmm.... no, I don't use 3D, just POLYVECTORS, and they are not 3D.

BTW, I have another approach, to draw it to a virtual screen and redraw this virtual screen resized to target screen

http://www.glbasic.com/forum/index.php?topic=6906.0

spacefractal

There is many methods, hence you need to do multiply resolutions your self. Depend on content and style.

I using mostly polyvector and scaling directly on back buffer, since off buffer did slowdown by about over twice. But off buffer might been good.

Also I don't up scaling tiles, which might been too blocky on higher resolutions, so you might use different sizes of textures. But downscaling might remove details as well, but that ok in my game.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

S.O.P.M.

Thanks guys, I see now, it's not as difficult as I thought.

@ampos: The method using a virtual screen seems really great, thank you!
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

ampos

This method is the easiestto implement but it is the slowest, with less performance. Check my other code, Univesarl Scaling System (it is also in code snipets) as it scales on-the-fly using polyvectors.