I think this MapOptions.lua is quite cool thing, but so far havent seen any in real use. I think reason to this is that theres actually no usefull functions you could add to it (Or anyone to make these functions.)
What I'm personally looking for is for example:
Max Metal Max and min wind speed Hardness Gravity TidalStrength Typemap = "true/false" Water Damage = true/false AI Bonus
So I need someone to help me out a little... How can i make gadget to LuaGaia that would give access to manipulate .smd file ? Or is there other way to do this ?
(I renamed this test map to "SmallDivide-MapOptions.smf", as you can see.)
3) Add the following to MapOptions.lua:
Code:
local options = { { key = 'maphardness', name = 'Hardness', desc = 'How much the map deforms due to explosions', type = 'number', def = 100.0, min = 0, max = 500.0, step = 10.0, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, } return options
This will add map option to lobbies with which you can change hardness to any value (in steps of 10) between 0 and 500.
4) As last step, we need to make the .smd file read the map option, instead of having the value hardcoded in there. To do this, we get the map options table from Spring, and use this to read back all the map options from from the lobby:
Code:
local mapOptions = Spring.GetMapOptions()
local mapInfo = { maphardness = mapOptions.maphardness, // TODO: convert other SmallDivide tags to LUA } return mapInfo
5) Profit! Test it with mapoption-compliant lobby and you should be able to freely change hardness to about anything between 0 and 500.
Joined: 01 Jun 2005, 10:36 Location: The Netherlands
Can't really help you cause I'm LUA noob too, but I noticed some things:
Code:
local mapOptions = Spring.GetMapOptions() [...] maphardness = (mapOptions and mapOptions.maphardness)
I don't think this works as variant for what I suggested: the entire function GetMapOptions does not exist when the map is parsed in unitsync. That's different from the function existing but returning nil.
Code:
team0 = {
startPosX = 1364, startPosZ = 4494,
},
team1 = {
startPosX = 7889, startPosZ = 4494,
}, [...]
If I understood the Spring code correctly, this needs to be more like this (though I can't get it working either...), because it gets a subtable "teams" from there in an indexed subtable, and there in a subtable called "startPos":
Code:
teams = { { startPos = { x = 1364, z = 4494 } }, { startPos = { x = 7889, z = 4494 } }, -- etc. }
I don't know either about exact tags for the other variables, will have to reverse engineer more code sometime.
I don't think map options can be done without turning the .smd into LUA. It should be possible though to rename the original .smd and call the LUA TDF parser in your .smd but this will just make stuff complexer...
Joined: 01 Jun 2005, 10:36 Location: The Netherlands
Well I noticed that line but it also causes other stuff I couldn't immediately figure out, and I couldn't see mapinfo.lua or dependencies (the map tdf parser) defining mapInfo.defaultoptions anywhere.
So you'd still need a LUA'ed .smd to set mapInfo.defaultoptions, right?
IOW, it's nice you point out that that line is there, but I've no clue what to do with that information without more instructions or without reverse engineering the rest of the code: which I'd have to do anyway even without the hint.
Map loads now properly without errors. However seems that, while global parametres and start positions work properly, everything else is loaded by mapdefaults... (athmosphere, lightning, water etc.)
Whatsoever, from issue to another: Im still wondering if theres no possibility to do this without "manually" converting smd into lua. if we could include somekinda of converter/parser with other lua that it could be possible to leave smd as it is...
This would make possible to use these mapoptions by other mappers aswell without learning to write their smds into lua first..
I wanted to make lua that could be easily used by mappers like "just attach the files into your map directory!"
maybe that parse_tdf_map.lua parser could be changed to produce lua code instead of actually making that data structure ?
Tbh, it's pretty trivial to write your mapdefs in lua, just a couple of extra braces and whatnot right? I mean, you're not actually writing any code, just writing the mapdefs using lua formatting rules.
Also, the map editors by frostregen and sefidel should start writing smds by default using lua.
Thing is. You need to have presets. People will not just waste play time on testing some random value with a map. Most people do not even look there.
Stuff like animations of birds in the trees or wildlife or maybe some atmospheric effects...that would be hot.. Imagine you new map,Eye of Horus,with light dust storms coming randomly along with sound effects of a dust storm.. Or meteor showers. Light rain if the map looks all swampy or just grim and wet. rays of flickering light if the map is sunny..that's what will give maps a more natural feel to them..give them some character. Nobody is really gonna play with tens of different values when he hosts a game..people like to play a map study it and know how to play on it to develop a sorted out gameplay.like a musician needing to know the technique to than improvise using that basis. Players don't like to start playing a familiar map with some random experimental options that will probably not be used again and will just waste their time. IMO any changes to maps need to be compulsory and permanent. If the changes are cosmetic than you need a few presets that will only slightly modify the way the map looks but not how it plays.
Like a stormy preset sunny preset cold preset etc. That will be something people will want to use. Play the same familiar map but make it look slightly different and fresh.
Thing is. You need to have presets. People will not just waste play time on testing some random value with a map. Most people do not even look there. Stuff like animations of birds in the trees or wildlife or maybe some atmospheric effects...that would be hot..
There would still be the presets. and the presets are the settings that mapper have set. Changing these settings some people might find meaningless and waste of time but there are still some who would like to play around and adjust the map for their own taste...
I understand your point and agree with most of it... Well maybe those athmospherical settings and such are quite useless to be included because they are only for visual look. You can still modify the map in smd for screenshots or whatsoever. It doesnt have much global effect or effects on multiplaying dimensions.
my mapoptions lua are to make maps more flexible towards the style of gameplay you want. As also for maps that "fail" in some of these conditions. For example: DSD and folsomdamfinals typemap works with ba, but it may fail drastically for other mods, therefore it would be really nice option to turn off the typemap...
What comes natural effect luas, lups and such, I'd really like to include such luas you mention but there's none ! and no one is willing or skilled to make such things...
Other point is that these are options that are customable by your own choice. From now on, hopefully, you can easily add whatever you like to your mapoptions, whether it is gaia effects, athmospheric or global parametres etc...
just a bool that would allow us to also render the sun and cloud layer along with our skybox image.
Fogstartdistance
numeric saying how far away the fog will start.
name it what you want but they would be handy tags.
I hope this was the type of input you wanted SirArtturi, I am still terribly ill so I am not able to read the whole thread, sorry if I am repeating something already posted
Users browsing this forum: Bing [Bot] and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum