Page 1 of 1

Adventures in map rendering

Posted: Thu Jul 20, 2017 3:01 pm
by Atlanta-Ned
This is statbus' ugly sibling; an attempt to write a new map rendering tool.

The development VM has crashed my laptop
1 time
since work began on this.


Here's a giant, randomly updated todo list:

[DONE] Parse out the map files from the code base
[DONE] Split out definitions and tiles into distinct json
[DONE] Determine what each tile's turf and area is (since all(?) tiles at least have a turf and area specified)
[DONE] Render a minimap, where colors are determined by a hash of the tile's area. Tiles that have a turf with 'closed' in the string are rendered as black, so we can start to see the overall structure of the map.

------- Next up -------
• Manually get DMIs/PNGs for /area/ definitions from the game code, pick and place these icons on the render
• Determine what each tile definition corresponds to in the game code. Use this information to get a list of DMIs we need to render for the given map
• Account for layers and overlays (my biggest challenge with previous map rendering attempts)
• Do a full-size render (probably in parts)
• Tile the full size render and insert it into a mapping javascript engine so we can put it on the web

------- Far Future -------
• Figure out coordinate math (because of course Byond has to be weird about it)
• Start tying in all our given coordinates in statbus to these maps

------- Current Status -------

Here's my current best render of Box:
Image

Re: Adventures in map rendering

Posted: Thu Jul 20, 2017 3:25 pm
by bman
super sexy

Re: Adventures in map rendering

Posted: Thu Jul 20, 2017 8:10 pm
by John_Oxford
what's the ship thing with a H?

Re: Adventures in map rendering

Posted: Thu Jul 20, 2017 9:30 pm
by Remie Richards
AI sat, dummy

Re: Adventures in map rendering

Posted: Fri Jul 21, 2017 12:17 am
by RandomMarine
Can grilles, lattices, and windows be included or are non-turfs right out?

Re: Adventures in map rendering

Posted: Fri Jul 21, 2017 1:39 pm
by Atlanta-Ned
RandomMarine wrote:Can grilles, lattices, and windows be included or are non-turfs right out?
Eventually, yes. This is all rudimentary for the moment. Turfs and areas are only being rendered because I know every tile has those defined.

For shits and giggles, here's the map where I took every tile definition (which starts as an array), encoded the entire thing in json, passed that json through a hash function and used that to generate this mess:

Image

Re: Adventures in map rendering

Posted: Fri Jul 21, 2017 11:01 pm
by Ikarrus
Beautiful. Gets me nostalgic

Re: Adventures in map rendering

Posted: Sat Jul 22, 2017 1:12 am
by John_Oxford
imagine if that's how you played ss13 and it was turned based and every turn you can move onto another pixel

moving onto someone else is a 50% chance to either kill you or kill them

press e when next to the command console to call the shuttle

nuke ops have a 25% to 85% chance to kill you if they move onto you

Re: Adventures in map rendering

Posted: Sat Jul 22, 2017 1:17 am
by Armhulen
John_Oxford wrote:imagine if that's how you played ss13 and it was turned based and every turn you can move onto another pixel

moving onto someone else is a 50% chance to either kill you or kill them

press e when next to the command console to call the shuttle

nuke ops have a 25% to 85% chance to kill you if they move onto you
you move on them = you kill them

they move on you = you die

move towards eachother = 50 50

there

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 2:17 am
by oranges
language, repo, source?

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 2:17 am
by oranges
license?

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 2:11 pm
by Remie Richards

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 2:17 pm
by Atlanta-Ned
Actually I'll probably split it off into a new repo once I have something to show.

Currently working on grabbing every atom(?) and its icon and icon_state parameters (if defined) from the game code. This is proving to be an unmitigated pain in the ass. If anyone has any insights into a better way to do this I'm all ears.

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 2:31 pm
by Remie Richards
I would say parse the XML produced by dm.exe
however:
1. I don't know if that XML contains icon references
2. that XML is known to just produce garbage at times

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 2:49 pm
by Atlanta-Ned
I'm also assuming that it's something DreamMaker outputs and that we're not saving it to github. Dagnabit.

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 3:09 pm
by Atlanta-Ned
Progress!!

Code: Select all

Getting atom definitions from /renderbus/tgstation/code/game/area/areas.dm:
/area starts on 4 and ends on 69
/proc/process_teleport_locs() starts on 70 and ends on 90
/proc/area_contents(area/A) starts on 91 and ends on 100
/area/Initialize() starts on 101 and ends on 131
/area/Destroy() starts on 132 and ends on 135
/area/proc/poweralert(state, obj/source) starts on 136 and ends on 165
/area/proc/atmosalert(danger_level, obj/source) starts on 166 and ends on 196
/area/proc/ModifyFiredoors(opening) starts on 197 and ends on 214
/area/proc/firealert(obj/source) starts on 215 and ends on 240
/area/proc/firereset(obj/source) starts on 241 and ends on 261
/area/process() starts on 262 and ends on 266
/area/proc/close_and_lock_door(obj/machinery/door/DOOR) starts on 267 and ends on 272
/area/proc/burglaralert(obj/trigger) starts on 273 and ends on 292
/area/proc/set_fire_alarm_effect() starts on 293 and ends on 297
/area/proc/readyalert() starts on 298 and ends on 304
/area/proc/readyreset() starts on 305 and ends on 309
/area/proc/partyalert() starts on 310 and ends on 317
/area/proc/partyreset() starts on 318 and ends on 329
/area/proc/updateicon() starts on 330 and ends on 342
/area/space/updateicon() starts on 343 and ends on 351
/area/proc/powered(chan)		// return true if the area has power to given channel starts on 352 and ends on 367
/area/space/powered(chan) //Nope.avi starts on 368 and ends on 372
/area/proc/power_change() starts on 373 and ends on 378
/area/proc/usage(chan) starts on 379 and ends on 397
/area/proc/addStaticPower(value, powerchannel) starts on 398 and ends on 406
/area/proc/clear_usage() starts on 407 and ends on 411
/area/proc/use_power(amount, chan) starts on 412 and ends on 422
/area/Entered(A) starts on 423 and ends on 449
/atom/proc/has_gravity(turf/T) starts on 450 and ends on 463
/area/proc/setup(a_name) starts on 464 and ends on 473
Script finished in Time: 27 ms, Memory: 2.00MB

Re: Adventures in map rendering

Posted: Mon Jul 24, 2017 4:51 pm
by Atlanta-Ned
IT GETS BETTER

Code: Select all

Getting atom definitions from /renderbus/tgstation/code/game/area/areas.dm:
/area starts on 1 and ends on 50
	/area has an icon set to icons/turf/areas.dmi
	/area has an icon_state set to unknown
/proc/process_teleport_locs() starts on 51 and ends on 61
/proc/area_contents(area/A) starts on 62 and ends on 67
/area/Initialize() starts on 68 and ends on 91
	/area/Initialize() has an icon_state set to 
/area/Destroy() starts on 92 and ends on 94
/area/proc/poweralert(state, obj/source) starts on 95 and ends on 121
/area/proc/atmosalert(danger_level, obj/source) starts on 122 and ends on 148
/area/proc/ModifyFiredoors(opening) starts on 149 and ends on 165
/area/proc/firealert(obj/source) starts on 166 and ends on 186
/area/proc/firereset(obj/source) starts on 187 and ends on 204
/area/process() starts on 205 and ends on 208
/area/proc/close_and_lock_door(obj/machinery/door/DOOR) starts on 209 and ends on 213
/area/proc/burglaralert(obj/trigger) starts on 214 and ends on 229
/area/proc/set_fire_alarm_effect() starts on 230 and ends on 233
/area/proc/readyalert() starts on 234 and ends on 239
/area/proc/readyreset() starts on 240 and ends on 243
/area/proc/partyalert() starts on 244 and ends on 250
/area/proc/partyreset() starts on 251 and ends on 261
/area/proc/updateicon() starts on 262 and ends on 273
	/area/proc/updateicon() has an icon_state set to blue
	/area/proc/updateicon() has an icon_state set to red
	/area/proc/updateicon() has an icon_state set to party
	/area/proc/updateicon() has an icon_state set to blue-red
/area/space/updateicon() starts on 274 and ends on 275
/area/proc/powered(chan) starts on 276 and ends on 288
/area/space/powered(chan) starts on 289 and ends on 290
/area/proc/power_change() starts on 291 and ends on 295
/area/proc/usage(chan) starts on 296 and ends on 313
/area/proc/addStaticPower(value, powerchannel) starts on 314 and ends on 321
/area/proc/clear_usage() starts on 322 and ends on 325
/area/proc/use_power(amount, chan) starts on 326 and ends on 333
/area/Entered(A) starts on 334 and ends on 354
/atom/proc/has_gravity(turf/T) starts on 355 and ends on 367
/area/proc/setup(a_name) starts on 368 and ends on 377

Re: Adventures in map rendering

Posted: Tue Jul 25, 2017 7:49 am
by Remie Richards
you'll want to drop the procs, obviously.

Re: Adventures in map rendering

Posted: Tue Jul 25, 2017 1:24 pm
by Atlanta-Ned
Remie Richards wrote:you'll want to drop the procs, obviously.
Ooh I bet that'll solve my memory allocation issues

Re: Adventures in map rendering

Posted: Tue Jul 25, 2017 4:29 pm
by Atlanta-Ned

Code: Select all

    "\/obj\/machinery\/vending\/snack\/blue": {
        "start": 727,
        "end": 729,
        "icon_state": "female_assblastusa"
    },
''''''''''''progress''''''''''''

Re: Adventures in map rendering

Posted: Wed Jul 26, 2017 8:13 am
by Remie Richards
that is very wrong.

Re: Adventures in map rendering

Posted: Wed Jul 26, 2017 8:16 am
by oranges
female_assblastusa

Re: Adventures in map rendering

Posted: Wed Jul 26, 2017 4:19 pm
by Atlanta-Ned
The important thing is that I'm learning regex real fast.

Re: Adventures in map rendering

Posted: Wed Jul 26, 2017 7:49 pm
by Remie Richards
you can learn it in an hour (its what I did) using https://regexone.com/
do all the lessons and all the challenges.

Re: Adventures in map rendering

Posted: Thu Jul 27, 2017 5:56 am
by Jordie0608
Regex testing sites can also be quite a hand: https://regex101.com/

Re: Adventures in map rendering

Posted: Thu Jul 27, 2017 7:55 am
by Remie Richards
That too, I write the majority of my regexes on regex101.
very useful to run it live as you write it on test data.