How to force what maps can be played with your mod

How to force what maps can be played with your mod

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

How to force what maps can be played with your mod

Post by Satirik »

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
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: How to force what maps can be played with your mod

Post by [Krogoth86] »

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... :-)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: How to force what maps can be played with your mod

Post by KDR_11k »

-- remove any maps with 'metal' in them
Add to BA plz
User avatar
kiki
Posts: 859
Joined: 05 Nov 2007, 03:06

Re: How to force what maps can be played with your mod

Post by kiki »

KDR_11k wrote:
-- remove any maps with 'metal' in them
Add to BA plz
+1
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: How to force what maps can be played with your mod

Post by Satirik »

[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
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: How to force what maps can be played with your mod

Post by zwzsg »

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?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: How to force what maps can be played with your mod

Post by trepan »

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

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
User avatar
Complicated
Posts: 369
Joined: 06 Jun 2007, 18:51

Re: How to force what maps can be played with your mod

Post by Complicated »

The end of speedmetal.
CautionToTheWind
Posts: 272
Joined: 30 May 2006, 17:06

Re: How to force what maps can be played with your mod

Post by CautionToTheWind »

Complicated wrote:The end of speedmetal.
Never. And i don't even like the damm map.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: How to force what maps can be played with your mod

Post by Gota »

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.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Re: How to force what maps can be played with your mod

Post by NOiZE »

What about if a mod which has maps limited, is no longer maintained, but new maps are being released...
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: How to force what maps can be played with your mod

Post by Neddie »

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.
Once I test it, I might put it on the KP autohost.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: How to force what maps can be played with your mod

Post by Pxtl »

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?
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: How to force what maps can be played with your mod

Post by Satirik »

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
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: How to force what maps can be played with your mod

Post by Argh »

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...
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Re: How to force what maps can be played with your mod

Post by Nemo »

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...
so do YOU want to try to construct an interesting and event filled mission that is map independent? have fun with that...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: How to force what maps can be played with your mod

Post by Argh »

so do YOU want to try to construct an interesting and event filled mission that is map independent? have fun with that...
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.

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...
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: How to force what maps can be played with your mod

Post by Pxtl »

@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.
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Re: How to force what maps can be played with your mod

Post by Nemo »

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.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: How to force what maps can be played with your mod

Post by Pxtl »

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.
Post Reply

Return to “Game Development”