Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: LCS Map Modding Guide  (Read 3280 times)

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
LCS Map Modding Guide
« on: January 09, 2013, 10:43:13 pm »

In the last major release, I added a new type of map editing and promised easier modding. I just committed a change to SVN that added support for multi-level maps and let you make new map layouts even in buildings that don't currently have one, just by use the appropriate file name. I've written a guide on how to do this, so you can try it out.

Note that the latest release doesn't fully support this, so in the current main download thread, the game will only try to load the Bank and NuclearPlant maps, and only for one floor; you can still edit, you just won't be able to make a killer military base and test it in game. The next big release will have full map support however, so dropping in additional floors and creating new maps will work. The latest build off of SVN will also have full map support.


How To Edit Maps

Edit maps using DAME, the "Deadly Alien Map Editor". You can find DAME here (try search engine if link is out of date):

http://dambots.com/dame-editor/

The easiest way to start editing maps is to use the existing DAME save file, maps.dam, in the /dev directory. The dev directory doesn't come with the game, but you can get it off SVN. If you don't want to mess with that, go here and download four files: 1) maps.dam.bak 2) maps.dam 3) siteblocks.png 4) specials.png. All of these files should go in a new "dev" directory in your LCS game folder.

Open up the maps.dam file in DAME. On one side, in the layers listing, you'll see the existing maps. Use the check boxes to hide and show maps. You can create new maps by copying the old ones; right click a top-level group (like NuclearPlant) and select Duplicate. Rename the new map based on the conventions described below.

Editing using the Paint tool ('B') is easy; click the tile you want in the tiles panel, then click the map view to paint with that tile. You may need to experiment a bit to figure out what the specials icons represent, but I've tried to make it pretty self-explanatory. Box-drawing to fill large areas is possible, but a little clunky -- use the Tile Matrix tool ('M') and fill the entire matrix with the tile you want to use by dragging tiles from the tiles panel. You can then box-drag to fill large areas.

When you're done editing, save maps.dam and use File->Export to create the map source files the game can run. In the Export Project dialog, use "csvTilemap.lua" for the LUA exporter. CSV dir should point to the LCS art directory, "../art" will probably work. File Extension should be "csv". These are probably the defaults. Press "Export" and it will automagically build the map source files. You're done -- run the game and visit that location to view the results in-game. You don't even need to make a new game.

To remove a map from the game and go back to the old map generation modes, just delete the .csv files. You may also want to clean up the maps.dam file, removing any old maps you don't want, since it'll try to generate them again next time you export.

Additional Notes:

1. All maps MUST have both a tile map and a special map, even if the special map is blank. This goes for both first floor maps and otherwise.

2. For multi-floor maps, add up stairs to the special map, then create a new set of maps for each additional floor, appending "2" to the location name for the second floor, "3" for third floor, and so on. For example, a second floor to the industrial apartments would have the name "ApartmentIndustrial2" in DAME, and export as "mapCSV_ApartmentIndustrial2_Tiles.csv".

Map naming conventions:

"mapCSV_[NAMEHERE]_Tiles.csv" - Tile map
"mapCSV_[NAMEHERE]_Specials.csv" - Special locations (vault, equipment, lockup, etc.)

[NAMEHERE] is one of the names below, and it's what the maps are called in the DAME layer list. For example, for the industrial apartment, the DAME name is "ApartmentIndustrial", and the exported file name is "mapCSV_ApartmentIndustrial_Tiles.csv". DAME should add the prefix and suffix to the exported files automatically.

ApartmentIndustrial (This stuff is a note, not part of the name)
ApartmentUniversity
ApartmentDowntown
Warehouse (LCS Safehouse)
HomelessShelter (LCS Safehouse)
CrackHouse
BarAndGrill (CCS Safehouse)
BombShelter (CCS Safehouse)
Bunker (CCS Safehouse)
CosmeticsLab
GeneticsLab
PoliceStation
Courthouse
Prison
IntelligenceHQ
ArmyBase
FireStation
Sweatshop
Factory
CorporateHQ
CEOHouse
RadioStation (AM Radio)
CableNews
JuiceBar
InternetCafe
CigarBar (Gentlemen's Club)
LatteStand
VeganCoOp
Park
Bank
NuclearPlant
« Last Edit: January 13, 2013, 02:32:43 am by Jonathan S. Fox »
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: LCS Map Modding Guide
« Reply #1 on: January 09, 2013, 10:45:53 pm »

This is kinda neat.
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #2 on: January 10, 2013, 08:07:01 pm »

Seconded.

Is it possible to make more than one map for a given location and have the one used randomly rolled at game start/site reopening? (So, there would be Bank layout A and Bank layout B--not as much a problem with Banks but for a corp HQ or nuke plant, kinda interesting.)   One disadvantage to the newer maps is that they're fixed; as a result having the recon from a sleeper or an informant isn't quite as useful.

Thanks for the documentation, in any event.  Hopefully will give it a shot over the weekend.
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Map Modding Guide
« Reply #3 on: January 10, 2013, 08:37:12 pm »

Seconded.

Is it possible to make more than one map for a given location and have the one used randomly rolled at game start/site reopening? (So, there would be Bank layout A and Bank layout B--not as much a problem with Banks but for a corp HQ or nuke plant, kinda interesting.)   One disadvantage to the newer maps is that they're fixed; as a result having the recon from a sleeper or an informant isn't quite as useful.

Thanks for the documentation, in any event.  Hopefully will give it a shot over the weekend.

It is not currently possible to make variant layouts, but that's a good point. I look forward to hearing about how it goes and seeing the result, if you give it a shot!
Logged

ed boy

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #4 on: January 11, 2013, 08:40:00 am »

Would altering a map layout be save-breaking?
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Map Modding Guide
« Reply #5 on: January 11, 2013, 03:58:48 pm »

Would altering a map layout be save-breaking?

No, but any terrain modifications you have carried out to the old site will be applied oddly to the new one -- spraypaint, fire damage, that sort of thing.
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #6 on: January 11, 2013, 08:27:38 pm »

Is there a way to repair/rebuild a safehouse after the Firemen have been through?  By the time Free Speech finally moved off C+ last game, Montana Manpower LLC was largely burnt-out for raid purposes, but otherwise perfectly functional.  I had over $1M so would appreciate being able to get some concrete, 2x4s, etc and rebuild the place.

Update:
Missed a step: people also need to d/l the .png files for your custom icons.  They're in the same folder you link in the OP.  Seems obvious now but wasn't when I was just starting up.
DAME interface is OK; I'm not clear on all the specials (the open-door checkpoints, mainly) but the primary problem is that the thing doesn't want to export.  First mod I've made is to put an alarm on the side door to the Nuke Plant (away from the armory building) but I can't get the thing to actually spit out a csv sheet.  Just says "Export button pressed at <timestamp>.  Load Lua." and sits there.  Doesn't chenge the timestamps (so no overwriting) on the existing csv files & doesn't create new files elsewhere.

Once that's resolved, the major question would be whether specials are or can easily be unlinked from their current locations.  Example: the Nuke Plant display cases.  Are they generic Vandalizable objects that simply drum up more public attention wherever smashed, or if i put some in (say) the Courthouse, would smashing them still affect Nuclear Power?
Second example: the Vault.  If I were to put a Vault Door in the CorpHQ, I think I'd also need to put in a Bank Teller so the LCS could threaten everyone and get them to open the Vault that way.  Or is there a way to have a sleeper Corporate Manager handle the biometrics?  (Likewise, if the LCS hits CEO Scrooge McDuck's estate, could they haul him over and get the vault open that way?)
Third question: is the No-Gun checkpoint (presumably a metal detector) operational, and if so, how does it work?  (Police Uniform/Police Body Armor ought to be able to take a gun through a Courthouse metal detector, and Guard Uniform ought to be able to go through a Prison detector.  Death Squad probably should NOT be able to go armed into the prison.  "Ease up, son.  Shooting's too good for this lot."
« Last Edit: January 12, 2013, 08:11:28 pm by KA101 »
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Map Modding Guide
« Reply #7 on: January 13, 2013, 03:03:07 am »

Missed a step: people also need to d/l the .png files for your custom icons.  They're in the same folder you link in the OP.  Seems obvious now but wasn't when I was just starting up.

Thanks for testing this and identifying this issue -- I hadn't thought of that. I've edited the guide to mention the additional files.

DAME interface is OK; I'm not clear on all the specials (the open-door checkpoints, mainly) but the primary problem is that the thing doesn't want to export.  First mod I've made is to put an alarm on the side door to the Nuke Plant (away from the armory building) but I can't get the thing to actually spit out a csv sheet.  Just says "Export button pressed at <timestamp>.  Load Lua." and sits there.  Doesn't chenge the timestamps (so no overwriting) on the existing csv files & doesn't create new files elsewhere.

Hmm, odd. I don't have the same issue. I hope this is easily resolved. Searching online shows not many mentions; my best suggestion from searching around is to try pressing Export again after this happens, and see if the second press works? Seems questionable to me, but one of the two posts I saw reporting this behavior said that was a solution.

Once that's resolved, the major question would be whether specials are or can easily be unlinked from their current locations.  Example: the Nuke Plant display cases.  Are they generic Vandalizable objects that simply drum up more public attention wherever smashed, or if i put some in (say) the Courthouse, would smashing them still affect Nuclear Power?

Second example: the Vault.  If I were to put a Vault Door in the CorpHQ, I think I'd also need to put in a Bank Teller so the LCS could threaten everyone and get them to open the Vault that way.  Or is there a way to have a sleeper Corporate Manager handle the biometrics?  (Likewise, if the LCS hits CEO Scrooge McDuck's estate, could they haul him over and get the vault open that way?)

It's on a case-by-case basis; some specials are very generic, others are very specific. The display cases are generic, they just give you a bit of juice and rack up sitecrime, which affects how high-profile your attack is. The signs say different things based on location and are designated in code; they have generic fallbacks if there isn't anything defined for a given location. The checkpoints check for different uniforms based on location. The Vault Door is very specific to the bank; you'd need a Bank Manager to work it.

Adding a Scrooge McDuck CEO Vault or a Corporate HQ Vault could be done, but would require editing the source code to define the behavior of some new vault door types. Or it could be an edit of the existing vault door type to make it vary in behavior by location. Either way, that would need to be coded.

You can look at this file to see the guts of the code on the special tiles; the link jumps to the bank vault, but you can search the document to see other specials:
http://sourceforge.net/p/lcsgame/code/627/tree/trunk/src/sitemode/mapspecials.cpp#l2108

Quote
Third question: is the No-Gun checkpoint (presumably a metal detector) operational, and if so, how does it work?  (Police Uniform/Police Body Armor ought to be able to take a gun through a Courthouse metal detector, and Guard Uniform ought to be able to go through a Prison detector.  Death Squad probably should NOT be able to go armed into the prison.  "Ease up, son.  Shooting's too good for this lot."

It isn't used anywhere, but should be operational -- it requires a disguise check and an appropriate uniform to get through, plus checks for weapons, even concealed ones. The metal detector version sets off the site alarm if you're armed. Wearing an appropriate uniform should get you through the metal detector without setting the alarm off. For example, if you buy a 9mm handgun, you can smuggle it through a normal checkpoint without being harassed. Taking it into a metal detector will set off the site alarm, unless you're wearing a police or security uniform, and that's an appropriate disguise for this location. The code for uniform-appropriate weapons isn't currently very robust for concealed weapons; an army uniform won't let you carry a handgun, for example, and there are no weapon associated with the prison uniform.

You can see the code for this here:
http://sourceforge.net/p/lcsgame/code/627/tree/trunk/src/sitemode/stealth.cpp#l465
« Last Edit: January 13, 2013, 03:06:09 am by Jonathan S. Fox »
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #8 on: January 13, 2013, 12:18:57 pm »

Not a problem--you'd mentioned those tile-sheets in another post, I'd noticed them in the dev folder, and the error message you get if you haven't got them calls the files by name.  Just one of those silly mistakes folks not accustomed to editing files would make.

I'll give repeated-button-pushing a shot.  FWIW I'm running WinXP on the computer involved.  Query: did you grab that Adobe Air thing DAME pushes?  I didn't think I needed it for the Windows installation (and judging by the files installed, I don't think I ought to need it) but since the installer throws up a license agreement perhaps that's something.

Problem found: it apparently doesn't like the filename "MapsModding".  Keep a backup of "Maps" (either the BAK or preferably a copy of the non-modded file) somewhere else, map-modders.

Thanks for the information re site specials.  I'll d/l and take a look.  Stealth in particular will be was interesting as my mod LCS armor (derived from SWAT/Heavy) was a valid disguise in the CCS Bomb Shelter.  (LCS weaponry-carried varied between Martial Arts, Sword, MP5, M4, M16, and M249.)  I'm not sure how that happened, but it's certainly entertaining.
Apparently the CCS has a surprisingly, uh, Liberal dress code.  I suspect that if I wanted to mess with a compiler again adding the relevant item defs to the Never In Uniform section (roughly line 670?) ought to suffice.

Update: -BEEEP-  -BEEEP-  -BEEEP-

Unfortunately the Conservative metal detector insists on alarming no matter the situation: my test-character couldn't take his .44 Magnum (IIRC that's acceptable for security or police) through the front door of the nuke plant even in a Security, Police, or even Death Squad Uniform.  Death Squads are active at the moment.  Not sure if my having a Lab Tech sleeper on-site derails the disguise-check, but I'm thinking that might be the culprit.  It does cancel mentioning that the squad actually goes through the detector, which they might or might not depending on the site/badges.
« Last Edit: January 13, 2013, 03:41:15 pm by KA101 »
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #9 on: January 13, 2013, 04:58:30 pm »

Double-posting,  apologies therefor: Here are the csv copy/pastes for the new, more secure, Nuke Plant.  If this takes off remind me to get a Dropbox or something--I've got a referrer link but need to actually go sign up.


Thanks much.
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Map Modding Guide
« Reply #10 on: January 14, 2013, 12:38:25 pm »

Update: -BEEEP-  -BEEEP-  -BEEEP-

Unfortunately the Conservative metal detector insists on alarming no matter the situation: my test-character couldn't take his .44 Magnum (IIRC that's acceptable for security or police) through the front door of the nuke plant even in a Security, Police, or even Death Squad Uniform.  Death Squads are active at the moment.  Not sure if my having a Lab Tech sleeper on-site derails the disguise-check, but I'm thinking that might be the culprit.  It does cancel mentioning that the squad actually goes through the detector, which they might or might not depending on the site/badges.

This sounds weird. The intended behavior when you have a sleeper is that you flash badges and get waved in. If you see the badge flashing text, there shouldn't be any way you'd get the metal detector going off -- the same trigger that shows that text should also prevent the game from checking for weapons at all.
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #11 on: January 14, 2013, 08:13:00 pm »

Gets weirder: the maps.dam file managed to lose the specials-tiles for the bank (which still works fine in-game--just that if you load it up in the editor, the specials-layer is blank and will remain blank as it doesn't populate the tile-picker).  Further, now that I've made some designs for the CCS safehouses & Courthouse, DAME now refuses to export them (same error as before).

I'll take the metal-detector problem to the LCS-programming thread as that's some sort of bug, not a map-modding issue.
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #12 on: April 06, 2013, 09:46:52 pm »

Necro-doubleposting Liberally because I finally got DAME to cooperate.  Got a zip containing csv files for a slightly tighter Nuke Plant, a more interesting Courthouse, and new/improved CCS facilities.  Let me know if you want it; apparently Bay12 doesn't like attachments?

(5 KB zipped.)
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: LCS Map Modding Guide
« Reply #13 on: April 06, 2013, 11:11:28 pm »

You can upload attachments on mediafire or any other hosting. It would be nice to see.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

KA101

  • Bay Watcher
    • View Profile
Re: LCS Map Modding Guide
« Reply #14 on: April 07, 2013, 01:04:44 pm »

OK, got a Dropbox.  Hopefully this works: https://www.dropbox.com/s/1o56kknmoxdqcea/04062013LCSMaps.zip
Logged