Capstone Project Update #2: Polishing the Map Editor


Github repository for the project here.
Jump to a section in this update

Over the past two-ish weeks I’ve been refining the functionality of the map editor. While in the last update there was a rudimentary level creator for placing and connecting roads, this most recent update comes with a plethora of improvements that extend functionality and make the editor easier to use.

Improvements


Load Preset Maps, Save/Load Custom Maps:

I’ve implemented a saving/loading functionality, which allows for the user to load preset maps that I make and send out with the application, as well as save and load their own custom maps while they use the tool. Maps are broken down into an integer array representing prefab IDs and rotations, which are converted to .dat files and saved to/loaded from local storage. This way, after spending some time on customizing and perfecting a map, it can be saved and used for further refinement or observation. A feature to clear the entire map has also been added.

Here a preset is loaded, edited, and saved under a different name. The map is then cleared and the new cutsom map loaded.
Confirmation Dialogues:

While in hindsight I probably could have found some free asset for this, I implemented a few modals to warn the user and confirm actions. For example, when the user clears the map (as seen above), they are first asked to confirm that they want to proceed. The user is also warned when they save a map that has unconnected roads, which cannot be used for simulation.

Confirmation dialogue when saving a map with unconnected roads
Begin Simulation From Within Editor:

Once a map has been loaded or created, the user can begin simulation from within the editor by clicking “Simulate”. This spawns a number of cars (currently 20, will be configurable later) that drive around the map.

Currently, the cars are not at all interesting–they simply follow the paths in the map and pick a random direction at intersections. They also have no collision and cannot see each other, so hardly any “AI” at work here. That being said, it’s a good demonstration of the paths the ML-Agent drivers will navigate, and that all the paths are properly connected.

The "Simulate" button spawns cars on any map with no unconnected roads (only closed loops)
Miscellaneous Improvements:

I’ve made quite a few smaller changes along the way, the following being a few notable ones:

  • Roads can now be placed by holding Mouse1, instead of having to click to place each individual road piece.
  • Roads can be deleted by pressing/holding Mouse2 while hovering over a road. Surrounding roads will have the connection removed and will be converted accordingly.
  • Camera panning, rotation, and zooming are now implemented.
    • Panning: Use WASD, arrow keys, or move the mouse to the edge of the screen
    • Rotation: Use E and Q to rotate CCW and CW respectively
    • Zooming: Use mouse wheel to zoom in and out

Coming Up

I’ve been progressing a little more slowly than intended, and have spent more time on improving the editor than I had originally planned for. That said, the Map Editor is now in a good enough state to be used in the final product, given I don’t have enough time to polish it up towards the end.

As was the case with the last update, the next priorities are implementing traffic signals (essentially any and all special behaviour for intersections) and getting the framework for an ML-Agent driver ready. Modeling/prefab creation are just about done for the stoplights and stop signs, though there is certainly a bit of work to be done on the logic side. Here’s a peek at how the stoplights look:

Traffic lights are configurable with different light durations and with a variable number of directions.

And as with the previous posts, here is a rough timeline for how I intend to proceed. Note that I pushed ML-Agents Setup back a week to account for the extra time I’ve been spending on the Map Editor. This week, I’ll be integrating traffic signals into the level creation and getting started on a component for tracking car percepts. After that, the real ML-Agents work comes.

february
march april may
Task Week 1 Week 2 Week 3 Week 4 Week 1 Week 2 Week 3 Week 4 Week 1 Week 2 Week 3 Week 4 Week 1
Simulation Setup
ML-Agents Setup
ML-Agents Training
& Testing
Integrate ML-Agents
into Simulation
Polish
User Testing
Done!


I intend to make weekly updates, detailing my progress as I get work done on the project. You'll be able to view updates at the repository here and my website here.
⇠ Capstone Project Update #1: Creating a Road System
Capstone Project Update #3: Letting the Cars "See" ⇢