How to force what maps can be played with your mod
Moderator: Moderators
How to force what maps can be played with your mod
http://buildbot.no-ip.org/~satirik/ValidMaps.lua
here is an exemple made by trepan (his idea too)
place it in the mod's root
here is an exemple made by trepan (his idea too)
place it in the mod's root
-
- Posts: 1176
- Joined: 23 Aug 2007, 19:46
Re: How to force what maps can be played with your mod
Does that "look for maps with k" command also work when you replace the k with [modname] i.e. are brackets or other things like that allowed there?
Thanks for sharing btw...
Thanks for sharing btw...

Re: How to force what maps can be played with your mod
Add to BA plz-- remove any maps with 'metal' in them
Re: How to force what maps can be played with your mod
+1KDR_11k wrote:Add to BA plz-- remove any maps with 'metal' in them
Re: How to force what maps can be played with your mod
[Krogoth86] wrote:Does that "look for maps with k" command also work when you replace the k with [modname] i.e. are brackets or other things like that allowed there?
Thanks for sharing btw...
i don't know shit about lua :) ask trepan or jk
Re: How to force what maps can be played with your mod
Still pretty raw. Instead of removing map from list, can we just reorder list?
Can we read any random .smd tags instead just the map name?
Can we read any random .smd tags instead just the map name?
Re: How to force what maps can be played with your mod
Example / test code ...
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- ValidMaps.lua
--
local mapList = {
"Castles.smf",
"CastlesSDD.smf",
"UnknownTestMap1.smf",
"UnknownTestMap2.sm3",
"UnknownTestMap3.SMF",
"UnknownTestMap4.SM3",
"UnknownTestMap5.xxx",
"a.smf",
".smf",
}
local function PrintMaps(maps)
for _, map in pairs(maps) do
local mi = Spring.GetMapInfo(map) --- SLOW ---
if (type(mi) ~= 'table') then
for i = 1,10 do
print('Spring.GetMapInfo() error: ' .. map)
end
else
print(map)
for k,v in pairs(mi) do
if (type(v) ~= 'table') then
print(' ' .. tostring(k) .. ' = ' .. tostring(v))
else
print(' ' .. tostring(k))
for k2, v2 in pairs(v) do
print(' ' .. tostring(k2) .. ' = ' .. v2.x .. ',' .. v2.z)
end
end
end
end
end
end
local currMaps = Spring.GetMapList()
--PrintMaps(currMaps)
-- add SMF maps that start with K, and any SM3 maps
for _, map in pairs(currMaps) do
local lowerMap = map:lower()
if (lowerMap:find('%.sm3$') or
lowerMap:find('^[c]')) then
table.insert(mapList, map)
end
end
-- remove any maps with 'metal' in them
local newList = {}
local i = 1
for _, map in pairs(mapList) do
local lowerMap = map:lower()
if (not (lowerMap:find('metal') or
lowerMap:find('small') or
lowerMap:find('speed'))) then
newList[i] = map
i = i + 1
end
end
mapList = newList
-- only SM3 maps
if (1 > 0) then
mapList = {}
for _, map in pairs(currMaps) do
local lowerMap = map:lower()
if (map:lower():find('%.sm3')) then
table.insert(mapList, map)
end
end
end
-- add a dummy map if the list is empty
if (#mapList <= 0) then
mapList = { 'dummy' }
end
--PrintMaps(mapList)
table.sort(mapList) -- FIXME -- not needed
return mapList
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
- Complicated
- Posts: 369
- Joined: 06 Jun 2007, 18:51
Re: How to force what maps can be played with your mod
The end of speedmetal.
-
- Posts: 272
- Joined: 30 May 2006, 17:06
Re: How to force what maps can be played with your mod
Never. And i don't even like the damm map.Complicated wrote:The end of speedmetal.
Re: How to force what maps can be played with your mod
I hope nobody is serious about removing certain maps out of the map list for a certain mod.
I dont play speedmetal but i dont mind that OTHERS do.
such an option is only good in case a certain mod wants to make it easier to play only the maps that are at all playable with it.
I cant think of such a mod...not even kernel panic.
By the way,now that i tihnk about it ,you oculd paly kernel panic on my greenfields like map since it has 12 geo vents.
I dont play speedmetal but i dont mind that OTHERS do.
such an option is only good in case a certain mod wants to make it easier to play only the maps that are at all playable with it.
I cant think of such a mod...not even kernel panic.
By the way,now that i tihnk about it ,you oculd paly kernel panic on my greenfields like map since it has 12 geo vents.
Re: How to force what maps can be played with your mod
What about if a mod which has maps limited, is no longer maintained, but new maps are being released...
Re: How to force what maps can be played with your mod
Once I test it, I might put it on the KP autohost.Gota wrote:By the way,now that i tihnk about it ,you oculd paly kernel panic on my greenfields like map since it has 12 geo vents.
Re: How to force what maps can be played with your mod
AFAIK, this is just a client helper function, right? So it's up to the client to decide whether to
a) completely remove all non-appropriate maps from the list, or
b) simply put the mod-recommended maps to the top of the list
or whatever (maybe a button for "show all maps" or something).
I hope all clients will support this in an optional way - ignoring this would suck, and slaving the user to this would also suck.
And yes, Zsswsswswsg is quite right - a way to read map-tags out and use them to make the decision (so that maps can be tagged with mod names) and incorporate that into the mod's map-lua-script would be nice. Can we read arbitrary map tags in Lua? Are arbitrary map-tags safe?
a) completely remove all non-appropriate maps from the list, or
b) simply put the mod-recommended maps to the top of the list
or whatever (maybe a button for "show all maps" or something).
I hope all clients will support this in an optional way - ignoring this would suck, and slaving the user to this would also suck.
And yes, Zsswsswswsg is quite right - a way to read map-tags out and use them to make the decision (so that maps can be tagged with mod names) and incorporate that into the mod's map-lua-script would be nice. Can we read arbitrary map tags in Lua? Are arbitrary map-tags safe?
Re: How to force what maps can be played with your mod
the aim of the validsmaps is not to tell the player what map is the best for the mod but what maps can't be played by the mod, if you can play any maps but some are better dont use that ...
i think trepan made this mainly to allow campaign mods
i think trepan made this mainly to allow campaign mods
Re: How to force what maps can be played with your mod
This is a silly "feature", since it doesn't say which maps are the only ones allowed, but instead says that maps on the "do not allow" list are excluded. Should've been done the other way around, if the intention was to allow mods with really special map needs to have a special world.
Personally, I think that now that we can use LUA to manipulate the maps, this is a totally irrelevant issue.
We can put stuff like Geovents on any map. We can make maps flat, or rebuild the hills, or whatever. We can blow away all of the Features. We can create lakes. We can put Units into the gameworld, to control LUA that does... whatever, whenever. The limits are *gone*. What I've done with World Builder is just the tip of the iceberg here.
The only thing we can't do at the moment is mess with metal values... and that's irrelevant, too, since you could just build a map about, say, capping flags, and have a LUA script put the flags either where metal is heaviest, following the map-designer's flow (good or bad)... or just distribute them through a procedure...
Personally, I think that now that we can use LUA to manipulate the maps, this is a totally irrelevant issue.
We can put stuff like Geovents on any map. We can make maps flat, or rebuild the hills, or whatever. We can blow away all of the Features. We can create lakes. We can put Units into the gameworld, to control LUA that does... whatever, whenever. The limits are *gone*. What I've done with World Builder is just the tip of the iceberg here.
The only thing we can't do at the moment is mess with metal values... and that's irrelevant, too, since you could just build a map about, say, capping flags, and have a LUA script put the flags either where metal is heaviest, following the map-designer's flow (good or bad)... or just distribute them through a procedure...
Re: How to force what maps can be played with your mod
so do YOU want to try to construct an interesting and event filled mission that is map independent? have fun with that...Argh wrote:This is a silly "feature", since it doesn't say which maps are the only ones allowed, but instead says that maps on the "do not allow" list are excluded. Should've been done the other way around, if the intention was to allow mods with really special map needs to have a special world.
Personally, I think that now that we can use LUA to manipulate the maps, this is a totally irrelevant issue.
We can put stuff like Geovents on any map. We can make maps flat, or rebuild the hills, or whatever. We can blow away all of the Features. We can create lakes. We can put Units into the gameworld, to control LUA that does... whatever, whenever. The limits are *gone*. What I've done with World Builder is just the tip of the iceberg here.
The only thing we can't do at the moment is mess with metal values... and that's irrelevant, too, since you could just build a map about, say, capping flags, and have a LUA script put the flags either where metal is heaviest, following the map-designer's flow (good or bad)... or just distribute them through a procedure...
Re: How to force what maps can be played with your mod
Actually, I think that's quite possible, yes, and no offense is intended, but I think you should look at the World Builder screenshots- if I want to, I could just literally rebuild the heightmap to suit- not that that would be elegant.so do YOU want to try to construct an interesting and event filled mission that is map independent? have fun with that...
The elegant way would be to take a procedural approach. So long as you're not wanting the events to run on a super-tight tunnel, you could generate most of the actors through procedures, and have it scale to the size of the map- bigger map? No problem, add more good guys and bad guys, or just spread them apart.
The only parts where you'd have to force it would be whatever objects were 100% necessary for the tunnel, so if you ran a pass over the map before anything else was placed, to find valid points to place those things, then yeah, you could do it. Would it be a good solution for a very tight tunnel design? Hell no. Do I like tunnel designs? Hell no. I think they're boring. Give me XCOM's random battles over a scripted scenario any day.
Shall I make an automatic mission-generator, for P.U.R.E.? Hmm... why not? That might even be fun, and a hell of a lot cooler than the spawn-script...
Re: How to force what maps can be played with your mod
@Argh - maybe I'm misreading things, but I'm pretty sure it's a list of the only ones allowed that you return. Not a "lets ban maps X, Y, and Z" listing. And either way the distinction is pretty minimal since making an "invert" operation against a subset of maps, provided that you have the full list of maps available, would be trivial.
Re: How to force what maps can be played with your mod
On topic: How is this code meant to work? I've been trying to cut maps out of the battleroom maplist, with no success (it seems to be tied to the lobby though, since it threw an error once about lacking the dummy map..).
Argh:
Or if you're looking to do a specific map progression as part of a campaign, in which case this code is highly useful. Of course I'm not advocating tunnel games, but I just feel like a designer placing everything with intent will always be able to do a better job of crafting a mission than a script that just looks at a few variables and plops down enemies/frends.
Although go for it - it'd be neat to see such a thing.
Edit: and yes, I've seen the world builder screenshots, thank you. it just strikes me as a particularly ass-backwards way to go about fitting a map to a scenario (in terms of terrain, scripted events, ect) rather than the other way around. Don't get me wrong - the spawning neutral unit stuff is really cool. I just don't see the appeal of trying to bludgeon a map into conforming to a mission via an automated process.
Argh:
Or if you're looking to do a specific map progression as part of a campaign, in which case this code is highly useful. Of course I'm not advocating tunnel games, but I just feel like a designer placing everything with intent will always be able to do a better job of crafting a mission than a script that just looks at a few variables and plops down enemies/frends.
Although go for it - it'd be neat to see such a thing.
Edit: and yes, I've seen the world builder screenshots, thank you. it just strikes me as a particularly ass-backwards way to go about fitting a map to a scenario (in terms of terrain, scripted events, ect) rather than the other way around. Don't get me wrong - the spawning neutral unit stuff is really cool. I just don't see the appeal of trying to bludgeon a map into conforming to a mission via an automated process.
Re: How to force what maps can be played with your mod
Wait, so the idea is that a scenario is handled as a mod-file? And so the launcher would contain a list of mods for the progression? I understand that, in those cases, the mod would be useless for other maps...
I can see that, but it would still be nice to be able to use this feature to list *recommended* maps and elevate them above maps that may be less-appropriate for the game. Gundam woulnd't work well with TinyME, for example, and KP kinda needs a lot of Geotherms to play. Yes, as Argh said you can make scripts to make round holes into square ones, but being able to have it either way (designed or generated content) is nice.
I can see that, but it would still be nice to be able to use this feature to list *recommended* maps and elevate them above maps that may be less-appropriate for the game. Gundam woulnd't work well with TinyME, for example, and KP kinda needs a lot of Geotherms to play. Yes, as Argh said you can make scripts to make round holes into square ones, but being able to have it either way (designed or generated content) is nice.