* Sends a toast notification when initializations complete. (#72465)
## About The Pull Request
Initialization is significantly slowed down by the presence of clients,
though when testing features, you need to join the server. I've been
told that some devs (particularly Mothblocks) are alt-tabbed out of
Dream Daemon while doing dev work, meaning that they are liable to miss
initializations completing, causing an effective slowdown in the dev
cycle. Mothblocks said it would be nice if there was a way to produce a
desktop notification when initialization completes.
I originally intended to add a function to rust_g that would produce a
Windows toast notification with a button allowing you to immediately
launch Dream Seeker. However, I couldn't find a reliable way to detect
if the OS version was Windows 7 or earlier, so running this function on
such an OS would cause a rust panic (which I was told is only a problem
because MSO probably still uses Windows 7).
Fortunately, PowerShell scripts can access the necessary .NET APIs to
produce toast notifications on Windows 10, while also failing more
gracefully than crashing the host process. So I recreated the
functionality I intended in PowerShell.
Toast notifications will only be sent on Windows, if the
TOAST_NOTIFICATION_ON_INIT config flag is enabled, AND there are no
clients on the server.
**Note for downstreams:** If you want the toast notification to have
your downstream's icon, copy it, scale the copy down to 16x16, and
either rename it "tg_16.png" or change that path in the call to
`world.shelleo` to the name of the new file.
Video Demo:
https://user-images.githubusercontent.com/12720844/210492033-963923d7-a1de-4326-9c9f-4f0c0b71d1a5.mp4
## Why It's Good For The Game
This isn't really a line item in the Dev Cycles Initiative, but even if
Mothblocks was exaggerating the benefits, it would still be a
significant speedup in the dev cycles.
## Changelog
No player-facing changes.
* Sends a toast notification when initializations complete.
Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net>
* The mc now keeps track of how many times a subsystem has slept in fire() (#72324)
## About The Pull Request
The mc now keeps track of how many times a subsystem has slept in fire()
## Why It's Good For The Game
The mc now keeps track of how many times a subsystem has slept in fire()
## Changelog
The mc now keeps track of how many times a subsystem has slept in fire()
Co-authored-by: Fikou <23585223+Fikou@ users.noreply.github.com>
* The mc now keeps track of how many times a subsystem has slept in fire()
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
Co-authored-by: Fikou <23585223+Fikou@ users.noreply.github.com>
* Saves on average 10 seconds from roundstart times (#71730)
## About The Pull Request
When runlevels change mid work, subsystems running behind have their
next_fire updated.
It's offset by a sum of random numbers, so things don't bunch up,
especially KEEPTIME SSs
The trouble is we have so many subsystems that get added at roundstart
that this offset gets LARGE, like 10 seconds on average.
So instead of randomly offsetting, why not "fill" a set of time slots?
Only 1 keeptime subsystem a tick, and 4 others. Then we just fill up
those buckets and get to it (also don't offset things that are already
processing)
I've talked to mso a bit about this. What he reccomended was sampling a
random time withing a 2 second window.
I'm not totally sure why, kinda waiting for him to tell me off, if he
does I'll fix things up.
This pattern takes the max possible delay from 16 (76 * 5 / 20)) seconds
to 0.7 (56 / 4 / 20)
It obviously scales with subsystem count, but I like this scaling a bit
better
I've applied the same pattern to the offsetting we do at the start of
Loop(), for ticker subsystems. I am less confident in this, it does take
last fire times from at worst 3.75 seconds (15 * 5 / 20) to a static
0.75 (15 / 20)
As stated I'm less sure of this, hoping to get mso'd so I can clean
things up
## Why It's Good For The Game
Makes roundstart snappier
## Changelog
🆑
code: Roundstart "starting" should be much snappier now
/🆑
Co-authored-by: Kyle Spier-Swenson <kyleshome@ gmail.com>
* Saves on average 10 seconds from roundstart times
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Kyle Spier-Swenson <kyleshome@ gmail.com>
* Removes bestF from Master Controller Crash Report Filtering (and uses voodoo magic to help cleaning up down the line) (#70610)
* Removes bestF from Master Controller Crash Filtering
We removed bestF from datums back in #2701, but this still remained in the filter. Bit silly, let's get rid of this old cobweb.
I couldn't find anything suggesting that the master_controller could get a statclick variable, but that's actually a term we use in the modern day so I'm not going to bug it since it's benign. The other five are still BYOND-level variables.
Co-authored-by: Kyle Spier-Swenson <kyleshome@ gmail.com>
* Removes bestF from Master Controller Crash Report Filtering (and uses voodoo magic to help cleaning up down the line)
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Kyle Spier-Swenson <kyleshome@ gmail.com>
* Biddle Verbs: Queues the Most Expensive Verbs for the Next Tick if the Server Is Overloaded (#65589)
This pr goes through: /client/Click(), /client/Topic(), /mob/living/verb/resist(), /mob/verb/quick_equip(), /mob/verb/examinate(), and /mob/verb/mode() and makes them queue their functionality to a subsystem to execute in the next tick if the server is overloaded. To do this a new subsystem is made to handle most verbs called SSverb_manager, if the server is overloaded the verb queues itself in the subsystem and returns, then near the start of the next tick that verb is resumed with the provided callback. The verbs are called directly after SSinput, and the subsystem does not yield until its queue is completely finished.
The exception are clicks from player input since they are extremely important for the feeling of responsiveness. I considered not queuing them but theyre too expensive not to, suffering from a death of a thousand cuts performance wise from many many things in the process adding up. Instead clicks are executed at the very start of the next tick, as the first action that SSinput completes, before player movement is processed even.
A few months ago, before I died I was trying to figure out why games at midpop (40-50 people) had non zero and consistent time dilation without maptick being consistently above 28% (which is when the MC stops yielding for maptick if its overloaded). I found it out, started working on this pr, then promptly died. luckily im a bit less dead now
the current MC has a problem: the cost of verbs is completely and totally invisible to it, it cannot account for them. Why is this bad? because verbs are the last thing to execute in the tick, after the MC and SendMaps have finished executing.
tick diagram2
If the MC is overloaded and uses 100% of the time it allots itself this means that if SendMaps uses the amount its expected to take, verbs have at most 2% of the tick to execute in before they are overtiming and thus delaying the start of the next tick. This is bad, and im 99% sure this is the majority of our overtime.
Take Click() for example. Click isnt listed as a verb but since its called as a result of client commands its executed at the end of the tick like other verbs. in this random 80 pop sybil round profile i had saved on my computer sybil 80 pop (2).txt /client/Click() has an overtime of only 1.8 seconds, which isnt that bad. however it has a self cpu of 2.5 seconds meaning 1.8/2.5 = 72% of its time is overtiming, and it also is calling 80.2 seconds worth of total cpu, which means that more than 57.7 seconds of overtime is attributed to just /client/Click() executing at the very end of a tick. the reason why this isnt obvious is just because the verbs themselves typically dont have high enough self cpu to get high enough on the rankings of overtiming procs to be noticed, all of their overtime is distributed among a ton of procs they call in the chain.
Since i cant guarantee the MC resumes at the very start of the next tick due to other sleeping procs almost always resuming first: I time the duration between clicks being queued up for the next tick and when theyre actually executed. if it exceeds 20 milliseconds of added latency (less than one tenth the average human reaction time) clicks will execute immediately instead of queuing, this should make instances where a player can notice the added latency a vanishingly small minority of cases. still, this should be tm'd
* Biddle Verbs: Queues the Most Expensive Verbs for the Next Tick if the Server Is Overloaded
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
* Adds MC initialization stages. Earlier stages can fire while later ones init. Fixes tgui chat reconnection banner showing during init. (#66473)
* Adds MC initialization stages. Earlier stages can fire while later ones init.
Removes TICK_LIMIT_MC_INIT config for barely doing anything to speed up init and being inconvenient to work with if fires and inits can happen at the same time.
* Adds MC initialization stages. Earlier stages can fire while later ones init. Fixes tgui chat reconnection banner showing during init.
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
* Adds load testing macros (#66178)
Adds a macro that consumes cpu up to some tick limit
Adds a define that uses said macro to leave verb processing just its
reserve of the tick
Adds a second subdefine that forces verb processing into total overtime
Mimicing the worst case scenario around maptick spikes
* Adds load testing macros
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
* The mc now detects if its priority budget gets out of sync with reality and soft resets. (#64498)
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>
* The mc now detects if its priority budget gets out of sync with reality and soft resets.
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@ users.noreply.github.com>
* Makes SSTimer actually recover (#64784)
Makes SSTimer actually recover properly when it needs to. This is a follow-up for #60846 (3da51f515d) with code I added in my port of that PR to bee.
There were 3 main problems, and each was uncovered after fixing the previous:
/datum/controller/master/New() was using faulty logic to find existing subsystems. It was adding Sound Loops twice and not adding Timer at all (Sound Loops being a subtype of Timer).
/datum/timedevent stores a ref to the timer subsystem in var/datum/controller/subsystem/timer/timer_subsystem for performance. It wasn't being updated to the new Timer subsystem, ultimately resulting in it runtiming as an invalid timer.
The buckets need to be reset during recovery. The TTR and other bucket-related handling is out of whack because SSTimer wasn't firing for however long recovery took. Luckily reset_buckets() can already handle all of this.
* Makes SSTimer actually recover
Co-authored-by: ike709 <ike709@users.noreply.github.com>
* creates SSspeech_controller so the MC can control say() execution
* Update mob_say.dm
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
* tgui Preferences Menu + total rewrite of the preferences backend
* nah, we dont need to ping those people
* trying to remove the funny stuff
* unmodularizing this
* prefs reset
* this may need to be reverted, who knows
* okay, this part
* perhaps
* EEEEEEEEE
* unsanitary
* E
* Stage 1 + loadout system
* more fixes
* E
* I mean, it launches?
* More fixes and reorganisation
* E
* customisation code is spaget.
* disable ERP prefs
* Update erp_preferences.dm
* Update erp_preferences.dm
* E
* Slowly getting there
* It may be time for help :)
* tri...colors... help
* preferences now pass preferences
* Update dna.dm
* Fuck this man
* missing savefile return, set_species works, removed dumb stuff from updateappearance
* https://github.com/Skyrat-SS13/Skyrat-tg/pull/8199
* https://github.com/Skyrat-SS13/Skyrat-tg/pull/8224
* https://github.com/tgstation/tgstation/pull/61519
* https://github.com/Skyrat-SS13/Skyrat-tg/pull/8278
* e
* le butonAZARAK HELLO
* hhh
* Proper recognition where it's due, MrMelbert!
* EEEE
* examine block
* Better gen hit sounds from whitedream
* final loadout touches, more bug fixes im sure to come
* i said there would be bugfixes
* Update LoadoutManager.js
* Missing preferences in the html menu
* LIVE TESTING PHASE BABY
* Update LoadoutManager.js
* EEE
* LAUNCH TEST FIRE
* Update job.dm
* Update new_player.dm
* 50gb DAY ONE PATCH
* EEE
* Update preferences.dm
* buggle fixes
* Update examine.dm
* >LOOC starts on
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: jjpark-kb <55967837+jjpark-kb@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
Co-authored-by: Azarak <azarak10@gmail.com>
* The Failsafe can now recover from an deleted MC
Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck
* Reset defcon level correctly
Oops left that in from debugging the levels
* Correctly recover SSasset
* Only decrease defcon if MC creation failed
Also add some sort sleep between emergency loops
* Makes the last two emergency actions manual procs
Since they are kinda unstantable its probalby best
if only admins call these manually
Its also more reliable and can handle a situation where its main Loop runtimes and the MC is stuck
You can also now debug Master/New()
While there will most likely never be any situation where the MC is just gone its still good to know that the game can recover from such a situation
For example maybe someone messed up a SDQL query or maybe someone wanted to delete the MC to create a new one hoping the Failsafe would do so for him
Co-authored-by: Gamer025 <33846895+Gamer025@users.noreply.github.com>
* Changes a line of the master controller to make it easier to read (#59974)
* Changes a line of the master controller to make it easier to read
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
* Properly fix postpones in the mc. (#59813)
I broke shuttles and other things by trusting queued_time.
This fixes it better, by tracking the ticks it's suppose to miss.
closes: #59805 (this doesn't actually work anymore it seems)
* Properly fix postpones in the mc.
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
* Makes master support ss.postpone()ing the next fire of running subsystems (#59792)
Sadly it can't apply this to the next fire resume of paused subsystems, but at least its not resetting that postpone.
* Makes master support ss.postpone()ing the next fire of running subsystems
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
* Remove SS_NO_TICK_CHECK (#57800)
## About The Pull Request
This is a whopper, will need @ MrStonedOne to review.
In theory this flag shouldn't be needed and my own testing didn't find any issues, but I'd feel better with a lengthy test merge.
## Why It's Good For The Game
Might make nightshift subsystem lag less, MC loop has less stuff to check.
* Remove SS_NO_TICK_CHECK
Co-authored-by: spookydonut <github@spooksoftware.com>
* [READY] Adds station traits: Small modifiers that can randomly be chosen each round
* conflicts
Co-authored-by: Qustinnus <Floydje123@hotmail.com>
Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
* Stack overflow detection for the Master Controller. (#56008)
* Stack overflow detection for the Master Controller.
Using a weakref, we can detect if the mc's stack was ended by byond due to a stack overflow, and restart it without waiting the entire defcon countdown in the failsafe controller.
I built a system around this concept under /datum/stack_end_detector and deployed it to the MC's main loop with checks in the failsafe controller.
* Stack overflow detection for the Master Controller.
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
* Finishes the allocation refactor (#55965)
#53841 continuation
I recall that the reason for infinite stuns and such was that the priority wasn't being cleared properly when something hitched and I fixed it and I don't remember where exactly but it works now (TM)
A variation of this is TMed on TGMC and it works fine
* Finishes the allocation refactor
Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
Replaces like 70-80% of 0 and such, as a side effect cleaned up a bunch of returns
Edit: Most left out ones are in mecha which should be done in mecha refactor already
Oh my look how clean it is
Co-authored-by: TiviPlus <TiviPlus>
Co-authored-by: Couls <coul422@gmail.com>
Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
Co-authored-by: Couls <coul422@gmail.com>
* [Ready] CDN browser assets! (#52681)
Rewrites the asset_cache system to handle sending assets to a CDN via a webroot.
see https://github.com/MrStonedOne/tgstation/blob/asset-cdn/code/modules/asset_cache/readme.md
Fixed a lot of bugs with assets, removed some dead code.
Changes:
Moved asset cache code to transport datums, the currently loaded one is located at SSassets.transport, asset cache calls made before the config is loaded use the simple browse_rsc transport.
Added subsystem call for when the config loads or reloads.
Added a webroot CDN asset transport. assets are saved to a file in a format based on the file's hash (currently md5).
Assets that don't use get_asset_url or get_url_mappings (such as browser assets referred to by static html files like changelog.html or static css files) can be saved to browse_rsc even when in cdn asset mode by setting legacy to TRUE on the datum returned by register_assets
Added a system for saving assets on a cdn in a hash based namespace (folder), assets within the same namespace will always be able to refer to each other by relative names. (used to allow cdn'ing font awesome without having to make something that regenerates it's css files.).
The simple/namespaced asset cache datum helper will handle generating a namespace composed of the combined md5 of everything in the same datum, as well as registering them properly.
Moved external resource from a snowflake loaded file to a config entry, added it to resources.txt
To ensure the system breaks in local testing in any situation that wouldn't work in cdn mode, the simple transport will mutate the filenames of non-legacy and non-namespaced assets and return this with get_asset_url.
Simple transport's passive send of all roundstart assets to all clients is now a config that defaults to off. this is to break race conditions during local testings from devs accidentally relying on this instead of using send() properly.
cl
refactor: Interface assets (js/css/images) can now be managed using an external webserver instead of byond's one at a time file transfer queue.
admin: Adds admin verb toggle-cdn that allows admins to disable the external webserver asset transport and revert to the old system. Useful if the webserver backing this goes down (thanks cloudflare).
config: New config file, resources.txt, (must be loaded by an $include statement from the main config)
server: The external_rsc_urls.txt config has been moved to the main config system.
/cl
Porting notes:
Interface webpages must refer to their assets (css/js/image/etc) by a generated url, or the asset must register itself as a legacy asset. The system is designed to break in localtest (on simple/legacy mode) in most situations that would break in cdn mode.
Requires latest tgui.
The webserver must set the proper CORS headers for font files or font awesome (and other fonts) won't load.
/tg/'s webserver config: https://gist.github.com/MrStonedOne/523388b2f161af832292d98a8aad0eae
* [Ready] CDN browser assets!
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
About The Pull Request
Extools maptick stuff is in the game. Stolen from BeeStation/BeeStation-Hornet#1119, improves performance. Requires ex-tools on the server, though.
Explosions have been refactored to do the actual exploding in a subsystem.
Credit to goon.
Here's some videos!
Why It's Good For The Game
Basically instant max-caps now.
We can now give more of a tick over to the sending of map updates
Changelog
cl Goonstation Coders, Beestation, Extools devs
refactor: Explosions have been heavily optimized.
/cl
SS_BACKGROUND Conflicts with SS_TICKER and SS_NO_TICK_CHECK's behavior in certain ways. This fixes that breaking the mc.
SS_BACKGROUND has its own priority bracket that assumes that all remaining subsystems to run are also SS_BACKGROUND, allowing one of these to run when running SS_TICKER subsystems would cause the MC to assume all subsystems that run after it that tick were background subsystems, breaking the math of how much time to allocate the subsystem.
When delaying a run of a SS_NO_TICK_CHECK subsystem for lack of time, the MC will modify it's priority so it runs sooner next tick, if this happened on a background SS_NO_TICK_CHECK subsystem, it would update the wrong running total and desync the running total of the priority of all queued subsystem from the actual sum of those subsystem's priority.
Basic multiZ mob movement procs (Observers can always move)
Open space, showing what things are below it, and everything that entails. No complex support for dynamic generation just yet.
Decide how openspace should look :/
Atoms falling through open space (NO MOB SUPPORT/DAMAGE/ANYTHING YET.)
//CANCELLED FOR ANOTHER PR - [ ] Being able to see upwards? Downwards is going to be handled by open space.
MultiZ tile atmospherics - EDIT: Working demo! https://puu.sh/B7mUs/3f6274740f.mp4
Bugtest the heck out of this trainwreck.
* Moves TgsInitializationsComplete call to immediately after world/New()
* Subsystem PreInit data directory audit
* world/New data directory audit
* Needful here too
* Remove SS_NO_INIT from SStitle
* Don't create banlist.bdb for SQL banning
* Stop creating legacy notes file
* Moves iconCache from data to tmp
This is primarily a compatibility layer that enables both forward and backward compatibility for all past and future APIs based on the detected running TGS version. It also bundles all it's includes to make future upgrades not have to modify the dme, heck, could even use a submodule if it wanted (not happening). No other changes necessary.
There's an upcoming event system and new chat management functions. Check them out here: 303448457e/DMAPI/tgs.dm
Also added /datum/proc/CanProcCall()