Page 1 of 1

lua loadscreen def

Posted: 22 Apr 2010, 05:47
by FLOZi
Currently loadscreens are hardcoded to be loaded from bitmaps/loadpictures. Filenames can be prefixed with a sidename to control which pictures will be shown for a given side. Beyond that, there's no control.

I'd like to see a lua def in gamedata which gave us better control, something like this:

Code: Select all

local loadscreens = {
  {
    filename = 'loadpictures/GBR/gbrinfantrypic.jpg',
    maintainRatio = true,
    scaleUp = false,
    side = {'GBR'},
  },
  {
    filename = 'loadpictures/Allies/genericalliespic.jpg',
    maintainRatio = false,
    scaleUp = true,
    side = {'GBR', 'USA', 'RUS'},
  }
}
I guess the attributes there are self explanatory, but just to be perfectly clear:
  • filename - path to the image file from bitmaps/
  • maintainRatio - if image is rescaled, maintain the ratio? (currently hardcoded to true)
  • scaleUp - if the image is smaller than the viewport, scale it up? (currently hardcoded to true)
  • side - table of sides which this loadscreen can be selected for, empty table can be loaded for any side
As a minor aside; it'd be nice for consistency's sake if all Devil image format types were supported instead of just BMP and JPG.

edit: Obviously it'd be set up so that the default base file in springcontent.sdz replicated the current behaviour.

Re: lua loadscreen def

Posted: 22 Apr 2010, 14:53
by hoijui
i though the idea was to move to fully Lua scrip-table load-screens. of course, someone needs to code support for that too, but it would be much nicer, and i think IF anyone is going to change load-screens stuff, it is going to be that.

Re: lua loadscreen def

Posted: 22 Apr 2010, 15:00
by zwzsg
Yes, I want load screen animated with ingame scenes. Of course that mean we will need to have loaded most of the engine before being able to play the load screen animation. So it would be preferable to include a pre-loadscreen, to display while the actual load screen is loading. But then we should not repeat the same mistake of making that preloadscreen passive, so the preloadscreen should be fully moddable as well. Which might require loading certain components, which might take some time to load. So we need a pre-pre-loadscreen ....

Re: lua loadscreen def

Posted: 22 Apr 2010, 15:11
by trepan
zwzsg makes with the fun.
zwzsg doesn't know how easy it actually is to setup the script.
from ignorance comes the hahas.

Re: lua loadscreen def

Posted: 22 Apr 2010, 15:21
by FLOZi
hoijui wrote:i though the idea was to move to fully Lua scrip-table load-screens. of course, someone needs to code support for that too, but it would be much nicer, and i think IF anyone is going to change load-screens stuff, it is going to be that.
Yeah, but noones really put forward any ideas how that would actually work. My request is a simple and sufficient improvement on the current system.

Re: lua loadscreen def

Posted: 22 Apr 2010, 15:24
by zwzsg
Yeah, now that even modinfo is a Lua file, I infer the Lua machine is already started before the loadscreen appears. But that's no reason to spoil this Hahas opportunity!

Re: lua loadscreen def

Posted: 22 Apr 2010, 15:46
by hoijui
i would say it needs basic lua engine running, plus access to the mod archive. of course, not all lua functions that spring offers can be used (getEnemyUnits() ), but it should usually be obvious which ones can and which ones can not be used, and best would be to stick to a minimum anyway, which would be archive access, some drawing functionality, and the info from the start script.

Re: lua loadscreen def

Posted: 22 Apr 2010, 16:56
by CarRepairer
zwzsg wrote:Yes, I want load screen animated with ingame scenes. Of course that mean we will need to have loaded most of the engine before being able to play the load screen animation. So it would be preferable to include a pre-loadscreen, to display while the actual load screen is loading. But then we should not repeat the same mistake of making that preloadscreen passive, so the preloadscreen should be fully moddable as well. Which might require loading certain components, which might take some time to load. So we need a pre-pre-loadscreen ....
Yo dawg!!!!! I heard you like loadscreens, so we load loadscreens before your loadscreens so you can preview your preview while you preview.

Re: lua loadscreen def

Posted: 22 Apr 2010, 17:06
by zwzsg
The thing that is really lacking now is some control over where the text is positionned: You always have those huge white letters in the middle, ruining so many nice loadscreens. Either read text font, color, size, position, alignement from a static TDF-like file, either pass the text string to a call-in function of a mod-side lua script, leaving to it the duty to gl.Text it.

If the second way is chosen, I'd also like to get an indicator of how far in loading we are, from 0 to 1, so we can draw loadbars. Yes, I know, load time estimate are purely indicative, and it's quite impossible to get a smooth loading progression bar, but still, non linear indicator is better than no indicator.

Re: lua loadscreen def

Posted: 22 Apr 2010, 17:38
by FLOZi
Text control could be handled by a gamedata/loadscreen.lua too.