Hot swapping resolution?

Blitz3D Forums/Blitz3D Programming/Hot swapping resolution?

OrcSlayer(Posted 2007) [#1]
Is it possible to change the graphics resolution of Blitz3D during runtime? I'm working on the settings system for my game, and I know many commercial games let you do that but others warn that "some changes" (generally meaning, resolution and LOD settings) will not take effect until you restart the program.

It's ok if Blitz doesn't allow that, but if it dose I'd like to know so I can go ahead and implement it.


Danny(Posted 2007) [#2]
In principal yes, you can change resultion during runtime. Problem is however is that when setting resultion ALL your in-game graphics are purged! cameras, entities, lights, etc.

So whilst you're game is still in 'main menu->options->video' mode it can be done relatively easily (just rebuild the interface where the user left off).
But changing resoltions whilst PLAYING won't be a good idea - but not impossible (save the game, change resolution, load the game back up).

Hope this helps,
Graphics3D 320,200,32,0
Color 255,255,255
tmp=CreateCube()
cam=CreateCamera()
PositionEntity cam,3,4,-10
PointEntity cam,tmp
RenderWorld
Flip
Delay(4000)
Graphics3D 800,600,32,1
;PointEntity cam,tmp ;-> will give an error
RenderWorld
Text 10,10, "you see! It's empty! all gone..."
Flip
Delay(5000)
End


Danny


IPete2(Posted 2007) [#3]
Orcslayer,

Got to your 3d samples folder and check out any of the samples in MAK folder (Marks folder).

You'll see they all come up with a sort of pre game/demo screen and you choose resolution there.

IPete2.


Stevie G(Posted 2007) [#4]
Reloading all media would be a pain in the arse.

Personally I think the 'changes only taking place on reloading' method are acceptable. It only has to be done once by the user in most cases.

Stevie


OrcSlayer(Posted 2007) [#5]
Thanks Danny...I tried it out myself a moment ago and it does indeed work, despite clearing out all of your resources as you stated. The method used in the blitz samples doesn't appeal to me, and Stevie is right, there's nothing wrong with the classic method of "changes will not take effect until restarting the game" or somesuch...

However, Danny is also right that it may not be that big of a deal when the user is still in the interface and doesn't have a game started yet. In fact, I've seen many games that let you change resolution as long as you don't have an active game going on. I think I'll give it a try, since the menu will just show a simple 3D display that can be easily reloaded with a single command...and my interface can be rebuilt in much the same way.

Thanks for the help guys!


GfK(Posted 2007) [#6]
Reloading all media would be a pain in the arse
It actually isn't. If you have a LoadAssets() and a FreeAssets() function, simply call FreeAssets(), change the resolution, then LoadAssets().

You'll need to implement a 'flag' on your options screen which is usually 'false' but changes to 'true' if you select a different resolution/depth/whatever. That way you know you're going to have to change the resolution and reload everything when the user clicks "ok".

Its pretty simple really. Just needs a bit of thought.


jfk EO-11110(Posted 2007) [#7]
This is just another example on how important a powerful save-game system is. Implementing Save-game from beginning on, in a way that saves and restores every single thing, including variables, entities, settings etc. even the mouse position, will make it easier to deal with. In some cases it may force you to reinitialize things, like surface ids that may be diffrent when the mesh is reloaded, as well as all handles, of course.

It's a bit more complicated when you also try to optimize loading times, then you'll need to load-game modes, one after a new Graphics3D, that will reload everything, and one after an ordinary Load-Game action, that will load only what's required (eg: no need to reload menu gfx)

It surely is a pain to add a good Save-Game function to an existing game.


Stevie G(Posted 2007) [#8]

It actually isn't. If you have a LoadAssets() and a FreeAssets() function, simply call FreeAssets(), change the resolution, then LoadAssets().



Sorry but I don't agree - at least from my point of view. Alot of my media is loaded into different type structures so as well as re-loading just media I'd have to clear everything and re-build. Sure it'd be nice and it can be done but the effort involved far outweights the need imo.

Considering it's only likely to happen once ( in most cases ) is it really such a hastle for the user to re-load once they change resolution? I don't think so.

Stevie