[WIP] Mapeditor

Discussion in 'Work-In-Progress Mods' started by cola_colin, October 14, 2014.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I clearly have not enough other projects so I thought I create a new one.
    There are a few things API-wise missing to make a "super easy to use" mapeditor, but custom maps are quite possible. Basically it boils down to making custom biomes with fixed location brushes.
    So I've build a simple and definitely not yet finished mapeditor, that is already useable for the more interested and tech-knowledgeable people.

    Watch this to get an idea of the workflow:


    So prerequisites for this:
    Download this package: http://nanodesu.info/stuff/pa/mods/PA-Map_Editor.zip
    Install nodejs
    In the package do npm install in a console
    The folder map-editor-ui is a pamm mod, put it to your other mods and activate it in pamm. Also make sure you have hidden biomes and instant sandbox active
    Also make sure you have the create unit cheat active
    Configure the nodejs program server/conf.json in the unpacked package.
    Start the nodejs server: node backend.js
    Follow what I did in the video, make sure to use a local server.

    So this works by altering the sandbox biome. The button to create a mod copies the modified sandbox biome into a server mod you can activate to play with other people.

    There is obviously a lot of things that can be done to make this work better and have more functions. It is definitely worth it so far to actually read the modified sandbox biome json, understand it and do some more by hand modifications. But I think the placement of brushes is a pretty important thing and by using the "build a wall where you want the brush" method you can actually place them in a somewhat accurate way without doing 3D math in your head.

    @Uber:
    From what I understand we are missing the following things to make a pretty nice mapeditor:

    1. crucial feature, should be easy to implement: A way to determine the worldposition of the mouse pointer in the system editor. This would allow to do this in the system editor directly and only reload the terrain instead of reloading a full game and placing walls. So a simple api like "api.whatever.getMouseWorldPosition()" which returns an array [x,y,z]

    2. crucial feature, probably not very hard to implement either: Allow features to have a position:[] attribute, just like brushes have it. This would allow us to directly place mex-features one by one.

    3. crucial feature, but we may already be able to hack our way with modified server scripts: Allow for a direction definition of the position of spawns.

    4. Not crucial but helpful: Allow to set a brush preview in the system editor. So an API that is given a brush papa path that makes the game display the brush model wherever the mouse pointer of the user is. Would serve as a simple visualization of the brush that will be applied when clicked. It would be very helpful if this would also allow to specify a rotation value to preview the rotation.

    5. Not crucial but helpful: An API call to add a single brush to the currently viewed biome. Should basically allow to change the map without rebuilding the whole map.


    Some Hints to easier usage
    • It's recommended to make a sandbox planet with exactly 2 spawns. First let it have 0 mex. That way you will be able to tell where both spawns are by the 2 lone mex on the map. Mark them with some brush and only then modify the system you are building the biome for to have more mex.
    • Only walls and pings trigger the mechanism that modifies the biome, you can freely build other units.
    • If you want to start based on some other biome you can replace the content of the sandbox biome files with the content of that other biome
    • To play maps generated with this editor the host needs to activate the generated server mod and select the planet config that was used during editing
    • To make the reload quicker you can change server-script/landing.js to have a FORCE_START_TIMEOUT of 0 and a START_PLAYING_DELAY of 0. Additionally in server-script/playing.js line 432/433 remove the defeatTimer to disable the possibility for players to be defeated and in line 374 replace the spawnUnit call by "undefined" to prevent the AI commander from spawning. In Line 391 replace spec: player.commander.UnitSpec with the string "/pa/units/commanders/avatar/avatar.json" to make the game directly spawn the avatar builder as your commander. You can also modify /pa/units/coommanders/avatar/avatar.json by adding this:
      Code:
          "observer": {
            "items": [
              {
                "channel": "sight", 
                "layer": "surface_and_air", 
                "radius": 800000, 
                "shape": "capsule"
              }
            ]
          },
      to have the whole map visible while editing the map.
    • After you've made a map and exported it to a server mod you should validate your PA installation to revert the sandbox biome file and the server files to the defaults.
    • Mergable and pathable together make it that units can walk up any brush with ease. Pathable alone makes only "flat" areas pathable: http://nanodesu.info/static/img/screens/20141014193221670.png
    • If instant sandbox fails to start a game it may be caused by server.exe already being present. Kill it and try again.
    • You can try to set the metal amount of the planet to 0 and instead run this code in the console of your PA to generate a json block:
      Code:
      for (var i = 0; i < 250; i++) {
          var step = 225;
          var b = i*step;
          var bx = b + 10;
          console.log('{"cluster_count_range":[1,1],"cluster_size":1,"feature_spec":"/pa/effects/features/metal_splat_02.json","layer":6,"pole_distance_range":['+b+','+bx+'],"scale":[1,1,1],"noise_range": [0,1]},');
      };
      
      The generated json, without the trailing "," belongs into the empty features: [] array of the file pa/media/terrain/sandbox/sandbox.json. To make mex more sparse in the generated features try to reduce the noise_range before generating the json. Though that may or may not created a balanced base distribution. Mex added like this will be removed if you place a no_features brush on top of them.

    Changes since the initial version:
    - the config inputs now capture the input, preventing it from triggering random hotkeys
    - there is a way to delete brushes now, you can specify a radius and check a checkbox. After that you can trigger an alert and it will remove all brushes that are in the given radius around the alert. Careful there is no way back. You could export to a server mod to save your progress.
    - When I say "trigger an alert" I mean either build a wall or make a ping. Those are now the 2 ways to trigger the mechanism that either places or removes the brushes. All other alerts will be ignored.
    - The mod now depends on hidden biomes and instant sandbox
    - You can scale brushes by separate values for x/y/z
    • There is a checkbox to mirror every brush addition now. If it is checked building a wall will cheat in another wall on the other side of the planet which will also add a brush there. It's mirroring through the center of the planet.
    • There is a new button to mirror all existing brushes as well. This can be used to basically mirror a complete map that was build on "half the planet".
    • A few more brushes are available, the metal planet uses some composite brushes that I have split into single ones now
    • Changed the way the server mod is created. It now copies the whole sandbox biome folder. So if you put custom files there they will be copied automatically. You should still make sure to create backups of your work in a safe place!
    Last edited: October 17, 2014
    nacs, datura2012, Jaedrik and 19 others like this.
  2. totalannihilation

    totalannihilation Active Member

    Messages:
    215
    Likes Received:
    168
    Yes! Yes! Yes!
    Finally we will take map making art to a whole new level!
    zihuatanejo likes this.
  3. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Well this so far only allows you to build a map around the existing mex and spawns with a few hassles (like having to reload the whole game to actually see your changes)

    But I think people addicted to making maps might like it already.
    If Uber could at least implement the crucial API points I mentioned that would be great ;)
    cptconundrum likes this.
  4. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    UBER PLS MAKE THESE THINGS OFFICIAL THEY ARE MORE THAN MODS!

    Honestly looks amazing, first step to completely custom maps.
  5. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    Nice video. Nice mod.

    Can you do that all again at 160 APM? :D
  6. zihuatanejo

    zihuatanejo Well-Known Member

    Messages:
    798
    Likes Received:
    577
    I was just thinking the other day that custom maps would be sweet, designing choke points and metal clusters and lakes and canyons/valleys. Could be super sweet! And along comes ColaColin :D
  7. Clopse

    Clopse Post Master General

    Messages:
    2,535
    Likes Received:
    2,865
    Awesome wip mod. Just put rocks on top of metal spots in existing maps to make them more balanced. Excellent work.
    squishypon3 and cptconundrum like this.
  8. mot9001

    mot9001 Well-Known Member

    Messages:
    833
    Likes Received:
    650
    wow this is gonna be awesome!
  9. superouman

    superouman Post Master General

    Messages:
    1,007
    Likes Received:
    1,139
    Time to work :flex:
  10. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I expect great work for you. The only map design I can come up with is a LOL writing.
    squishypon3, proeleert and reptarking like this.
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Is there anybody around who can make a render of all brushes (and have them named somehow, so selecting a brush isn't by memory anymore) in a way that does not take years? I can give you a file list with the papa files if you need it.

    EDIT:
    Also I upaded the zip with an improved version of the map editor:
    - the config inputs now capture the input, preventing it from triggering random hotkeys
    - there is a way to delete brushes now, you can specify a radius and check a checkbox. After that you can trigger an alert and it will remove all brushes that are in the given radius around the alert. Careful there is no way back. You could export to a server mod to save your progress.
    - When I say "trigger an alert" I mean either build a wall or make a ping. Those are now the 2 ways to trigger the mechanism that either places or removes the brushes. All other alerts will be ignored.
    - The mod now depends on hidden biomes and instant sandbox

    EDIT 2:
    Added hints for easier usage to the OP
    Last edited: October 14, 2014
  12. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    [​IMG]

    [​IMG]

    They have no issue at all to walk up there. Mappers will need to place non-pathaable brushes at the edges to make units not just jump up everywhere.

    Also updated the map editor zip again. It now allows to set each individual brush to pathable, mergeable (whatever that exactly means) and no_features (which means no mex on the brush).

    EDIT:
    And now I can't reproduce this anymore. wtfbbq. This may or may not work with the current map editor version.
    EDIT 2:
    That mysterious mergable attribute is what makes stuff be "easy to walk and build on". So it probably is a good idea to set it AND pathable.
    No idea what pathable alone is good for.

    EDIT 3: pathable alone makes only the flat parts pathable, only with mergable units may walk up walls.
    Last edited: October 14, 2014
  13. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    Sorry if this might have been answered in the OP, but can you place custom metal spots with this?
  14. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Sadly not. Read my requests to Uber and the last hint about a very-hacky-and-not-really-that-nice workaround.
  15. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Note to self: Implement a "mirror" functioon that creates a copy of every brush on the opposite side of the planet.
    So the mapper builds half the planet and then mirrors it.
    squishypon3, jojopuppe and proeleert like this.
  16. doud

    doud Well-Known Member

    Messages:
    922
    Likes Received:
    568
    Cola_colin, you're my god :cool:
    squishypon3 likes this.
  17. superouman

    superouman Post Master General

    Messages:
    1,007
    Likes Received:
    1,139
    Do you think you can release a symmetry tool in a shorter time than Blizzard in their starcraft2 map editor? (Read : in less than 2 or 3 years)
    squishypon3 likes this.
  18. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I am quite certain I can be better by a factor of .... more than 1000?
    Like really I'll look into this evening and I don't expect it will take more than an hour or two.
    squishypon3, doud and jojopuppe like this.
  19. nuketf

    nuketf Active Member

    Messages:
    702
    Likes Received:
    130
    remake
    Seton's Clutch ?
  20. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    No.
    Bsport likes this.

Share This Page