World
Two possibilities exist: either we are alone in the Universe or we are not. Both are equally terrifying. ~ Arthur C. Clarke
The byond world object stores some basic byond level config, and has a few hub specific procs for managing hub visibility
Procs | |
ConfigLoaded | Runs after config is loaded but before Master is initialized |
---|---|
Genesis | WORLD INITIALIZATION THIS IS THE INIT ORDER: |
InitTgs | Initializes TGS and loads the returned revising info into GLOB.revdata |
New | World creation |
RunUnattendedFunctions | Runs after the call to Master.Initialize, but before the delay kicks in. Used to turn the world execution into some single function then exit |
_ | THE GENESIS CALL |
get_world_state_for_logging | Returns a list of data about the world state, don't clutter |
increase_max_x | Handles increasing the world's maxx var and initializing the new turfs and assigning them to the global area. If map_load_z_cutoff is passed in, it will only load turfs up to that z level, inclusive. This is because maploading will handle the turfs it loads itself. |
jatum_deserialize | Attempt to create a value from a JATUM JSON. |
jatum_serialize | Attempt to serialize a given value to the JATUM format. |
push_usr | Makes a call in the context of a different usr. Use sparingly |
send_cross_comms | Sends a message to a given cross comms server by name (by name for security). |
Proc Details
ConfigLoaded
Runs after config is loaded but before Master is initialized
Genesis
WORLD INITIALIZATION THIS IS THE INIT ORDER:
BYOND =>
- (secret init native) =>
- world.Genesis() =>
- world.init_byond_tracy()
- (Start native profiling)
- world.init_debugger()
- Master =>
- config *unloaded
- (all subsystems) PreInit()
- GLOB =>
- make_datum_reference_lists()
- (/static variable inits, reverse declaration order)
- world.Genesis() =>
- (all pre-mapped atoms) /atom/New()
- world.New() =>
- config.Load()
- world.InitTgs() =>
- TgsNew() *may sleep
- GLOB.rev_data.load_tgs_info()
- world.ConfigLoaded() =>
- SSdbcore.InitializeRound()
- world.SetupLogs()
- load_admins()
- ...
- Master.Initialize() =>
- (all subsystems) Initialize()
- Master.StartProcessing() =>
- Master.Loop() =>
- Failsafe
- Master.Loop() =>
- world.RunUnattendedFunctions()
Now listen up because I want to make something clear: If something is not in this list it should almost definitely be handled by a subsystem Initialize()ing If whatever it is that needs doing doesn't fit in a subsystem you probably aren't trying hard enough tbhfam
GOT IT MEMORIZED?
- Dominion/Cyberboss
Where to put init shit quick guide: If you need it to happen before the mc is created: world/Genesis. If you need it to happen last: world/New(), Otherwise, in a subsystem preinit or init. Subsystems can set an init priority.
THIS !!!SINGLE!!! PROC IS WHERE ANY FORM OF INIITIALIZATION THAT CAN'T BE PERFORMED IN SUBSYSTEMS OR WORLD/NEW IS DONE NOWHERE THE FUCK ELSE I DON'T CARE HOW MANY LAYERS OF DEBUG/PROFILE/TRACE WE HAVE, YOU JUST HAVE TO DEAL WITH THIS PROC EXISTING I'M NOT EVEN GOING TO TELL YOU WHERE IT'S CALLED FROM BECAUSE I'M DECLARING THAT FORBIDDEN KNOWLEDGE SO HELP ME GOD IF I FIND ABSTRACTION LAYERS OVER THIS!
InitTgs
Initializes TGS and loads the returned revising info into GLOB.revdata
New
World creation
Here is where a round itself is actually begun and setup.
- db connection setup
- config loaded from files
- loads admins
- Sets up the dynamic menu system
- and most importantly, calls initialize on the master subsystem, starting the game loop that causes the rest of the game to begin processing and setting up
Nothing happens until something moves. ~Albert Einstein
For clarity, this proc gets triggered later in the initialization pipeline, it is not the first thing to happen, as it might seem.
Initialization Pipeline: Global vars are new()'ed, (including config, glob, and the master controller will also new and preinit all subsystems when it gets new()ed) Compiled in maps are loaded (mainly centcom). all areas/turfs/objs/mobs(ATOMs) in these maps will be new()ed world/New() (You are here) Once world/New() returns, client's can connect. 1 second sleep Master Controller initialization. Subsystem initialization. Non-compiled-in maps are maploaded, all atoms are new()ed All atoms in both compiled and uncompiled maps are initialized()
RunUnattendedFunctions
Runs after the call to Master.Initialize, but before the delay kicks in. Used to turn the world execution into some single function then exit
_
THE GENESIS CALL
THE VERY FIRST LINE OF DM CODE TO EXECUTE Ong this must be done after !!!EVERYTHING!!! else NO IFS ANDS OR BUTS it's a hack, not an example of any sort, and DEFINITELY should NOT be emulated IT JUST HAS TO BE LAST!!!!!! If you want to do something in the initialization pipeline FIRST RTFM IN /code/game/world.dm AND THEN NEVER RETURN TO THIS PLACE
If you're still here, here's an explanation: BYOND loves to tell you about its loving spouse /global But it's actually having a sexy an affair with /static Specifically statics in procs Priority is given to these lines of code in REVERSE order of declaration in the .dme Which is why this file has a funky name So this is what we use to call world.Genesis() It's a nameless, no-op function, because it does absolutely nothing It exists to hold a static var which is initialized to null It's on /world to hide it from reflection Painful right? Good, now you share my suffering Please lock the door on your way out
get_world_state_for_logging
Returns a list of data about the world state, don't clutter
increase_max_x
Handles increasing the world's maxx var and initializing the new turfs and assigning them to the global area. If map_load_z_cutoff is passed in, it will only load turfs up to that z level, inclusive. This is because maploading will handle the turfs it loads itself.
jatum_deserialize
Attempt to create a value from a JATUM JSON.
- json - The JSON to deserialize.
jatum_serialize
Attempt to serialize a given value to the JATUM format.
- value - The var to serialize.
push_usr
Makes a call in the context of a different usr. Use sparingly
send_cross_comms
Sends a message to a given cross comms server by name (by name for security).