Garry's Mod

Garry's Mod

[GuthSCP] S-NAV Ultimate
Guthen  [developer] 26 Mar @ 4:56am
How to generate a minimap?
This article comes from this file[github.com] from Github repository.

Setup
You first need to have installed this addon in Garry's Mod either via Github[github.com] (in the `garrysmod/addons` folder) or with Steam Workshop

You'll then need an image editor such as Aseprite[www.aseprite.org], Krita[krita.org], GIMP[www.gimp.org], Affinity Photo[affinity.serif.com], paintNET[www.getpaint.net]...

Actually, I personally use Aseprite which is for pixel art (since we need to edit raw pixels, it's a nice choice) but I have been used to use GIMP and it worked well enough, so you can use any software you want. I'll assume you already have basic knowledge about how to use one of them.

Generating
So.. how to make a minimap?
We could draw it by hand but what's the texture size? Where should you put your pixels? It would take so much time to cover an entire map and the result may be bad, that's why I coded a simple command in order to generate a base texture to work with, run Garry's Mod and follow these steps:
1. Launch a singleplayer game by choosing the map you want
2. Enter `guthscpsnav_generate` in your game's console
3. Tweak the values in the panel to change the height region to capture
4. Press the `save to data` button
5. Find the generated texture file at `garrysmod/data/guthscp/snav/<map_name>.png`

Using the minimap generator:
Click to see the result[user-images.githubusercontent.com]

Generated texture:
Click to see the result[user-images.githubusercontent.com]

Image editing
This is the most boring part: editing the generated minimap to make it look like a S-NAV map

Setup
First, open the generated texture in your image editor, you'll see that the map void is black and all buildings are transparent (thanks to a bug in my minimap generator), which is quite nice, because we have less things to do (like removing all the colors...).

You should now follow these steps:
- (optional) Fill with black all non-desired locations (like admins zones, 106 dimension...)
- Show only the map walls
1. Select all black pixels (disable 'Contiguous')
2. Shrink your selection by 1px (usually in 'Select' tool list)
3. Delete selected pixels
- (optional) Reveal some hidden areas by creating an inside 'Outline'
- See the in-game result
1. Save the file in `garrysmod/materials/guthscpsnav/minimaps/<map_name>.png` or, if you're making an addon/map, at `garrysmod/addons/<addon_name>/materials/guthscpsnav/minimaps/<map_name>.png`
2. Restart the singleplayer game
3. Equip and activates the S-NAV
- Perfecting the image
1. Walk around in the map and compare the minimap with the world
2. Remove incorrect or add needed pixels
3. Save your changes, this will automatically updates in the game
4. See the in-game result
5. Repeat... again... and again...
- Already finish? Yeah, publish now!

Final result:
Click to see the result[user-images.githubusercontent.com]
Last edited by Guthen; 26 Mar @ 5:05am