Commit Graph

23 Commits

Author SHA1 Message Date
skoglol
713ec805f4 Fixes chem dispenser button order (#44386)
* Fixes chem dispenser button order

* Fixes it properly.

* Okay, no nulls then.

* unneeded comment.
2019-06-09 17:20:19 -04:00
Jack Edge
9740ebb7ad Jobs code is in seperate files
🆑 coiax
code: Jobe code has been moved into seperate files. There should be no
change in behaviour.
/🆑

Every time I've ever gone into job code, this has annoyed me so much.
Some jobs have seperate files, some do not. So I put them in seperate
files, which I thought was a simple job. I removed some comments in the
process.

But it turns out the display order on the job preference screen was
literally determined by the ordering of the datums in the source files.
So I needed to add a way to order it. Now you can reorder the jobs by
changing the values of the defines.
2019-01-26 20:54:13 +00:00
Jack Edge
64e0cfd4e9 Traits are now sorted by positive,negative,neutral and then by name 2018-12-02 23:51:41 +00:00
Cruix
dedf5f5ed9 Disease antagonist (#35988)
* Virus antagonist initial commit

* Updated disease code

* Sentient virus improvements

* Renamed /mob/living/var/viruses to diseases, and /mob/living/var/resistances to disease_resistances

* Added sentient virus event

* Renamed VIRUS defines to DISEASE defines

* Fixed bugs in rewritten disease code

* Fixed advanced disease Copy()

* Finalized disease antagonist

* Made cooldown buttons stop processing if they are removed from an owner.
Made sentient disease active sneeze and cough not available if the host is unconscious.
Made sentient disease menu refresh when adaptations are ready or hosts are added or removed.
Made sentient disease following use movement signals instead of fastprocess.

* Added better icons to sentient disease abilities
2018-03-05 13:55:10 +01:00
AnturK
332e7ca474 Makes getFlatIcon slower. (Also more precise) (#34199)
* getFlatIcon fixes and improvements. DO NOT TOUCH

* Fixes area blendings

* Stuff

* Drops the named arg
2018-01-16 08:32:35 -05:00
Kyle Spier-Swenson
d7b537ce24 SSoverlay improvements and tweaks (#32371)
* Overlay per-type cost logging.

Overlays will now log how long each type took to process.

Changed up how overlays was done to account for the fact its a queue and not a processor. (it was using almost none of the processing subsystem framework)

Made the overlay loop faster by making it not cut the list until the end.

Added a simple generic benchmark stat tracking system.

I don't know how much overhead this adds to overlays. i may put it behind testing or something, but i do want to test this on the serbers to get some stats.

* Removes flush() as it was creating race conditions

* Use ref

* text2file

* Atoms added as an overlay will have their pending overlays compiled before being converted to an appearance
2017-11-10 20:25:29 +01:00
Kyle Spier-Swenson
b41ec6bf9e Merge branch 'master' into line-by-line-profiling 2017-10-27 09:42:33 -07:00
Kyle Spier-Swenson
dcef18078f Find references fix. (#32022)
* Find references fix.

Made it go from taking years to hours

Removed Datum based recursion, this was unneeded.

Fixed it calling a proc for what ended up being a costly noop millions of times (this was a moderate speed up as it would call DoSearchVar on every fucking number or string or null in a things vars list.)

Fixed it calling itself on the vars list. luckily it only checked keys, so this didn't stack overflow.

I'm intentionally leaving the debugging stuff in right now so that its on the record somewhere. I'll remove that when I pr line by line profiling as its own separate thing

* Remove debugging stuff

* i forgot
2017-10-27 11:56:34 +02:00
MrStonedOne
073bb122e2 debug verbs, less overhead, more sorts, fix for 16m call count bug 2017-10-26 15:01:41 -07:00
MrStonedOne
adb134e462 Line by line profiling system
This allows you to profile shit in a line by line fashion, getting a neat little report about how long (in milliseconds) was spent on what line(s).

Only one can be running at a time. You just have to call PROFILE_START then call PROFILE_TICK between lines, and finally, use profile_show(mob/client) to show the profile results to a mob. Profiles are sorted by avg cost per run.

Example usage: ef876c6fdb (diff-7664a9b9849fbd5b5d688654469b26d9R417)

Example output: https://gist.github.com/MrStonedOne/06a275be398499db41da702dde7fc518
2017-10-25 22:37:34 -07:00
Kyle Spier-Swenson
2f6df2a008 Garbage collection tweaks and refactors. (#30118)
* Garbage collection queuing rewriting

* Some Tweaks

* Fixes some queue tracking oddities

* More tweaks

* Remove the middle two queue steps. tis was a silly idea

* New logging.

We store logging datums for use in tracking the stats of shit qdeleted

Added logging for destroy time as well as hard delete time, per type. As well as a few others

* Fix compile for testing

* Does the cyberboss

* does the antur
2017-09-13 08:46:18 +02:00
Jordan Brown
3f1a50bf1b Subsystem PreInit() now respects init_order (#30092)
* Subsystem PreInit() now respects init_order

* Reh

* Yeah just nevemind then

* Update master.dm
2017-08-25 12:42:46 +02:00
Joan Lung
407e0e77e4 Ruin placement will try very hard to place any ruins with negative costs before attempting any other ruins (#28973)
* Ruin placement will try very hard to place all 0-cost ruins before placing any ruins with actual costs

* comment

* account for ruin variants properly please

* cost has a cost of 5

* tweak
2017-07-02 22:57:32 -04:00
Cyberboss
9e1ef0ffe2 Global variable wrappers (#25325)
* Add the system for managed global variables

* Travis ban old globals

* So you CAN inline proccall, that's neat

* Fix that

* master.dm

* Remove the hack procs

* Move InitGlobals to the proper spot

* configuration.dm

* Fix the missing pre-slash

* clockcult.dm

* This is probably for the best

* Doy

* Fix shit

* Rest of the DEFINES tree

* Fix

* Use global. for access

* Update find_references_in_globals

Always hated that proc

Whoever made it must've bee a r e a l idiot...

* __HELPERS tree

* Move global initialization to master.

Fix the declaration

* database.dm

* Dat newline

* I said DECLARATIVE order!

* Here's something you can chew on @Iamgoofball

* game_modes.dm

* Fix this

* genetics.dm

* flavor_misc.dm

* More stuff

* Do it mso's way. Keep the controllers as global

* Make master actually see it

* Fix

* Finish _globalvars/lists

* Finish the rest of the _globalvars tree

* This is weird

* Migrate the controllers

* SLOTH -> GLOB

* Lighting globals

* round_start_time -> ticker

* PAI card list -> pai SS

* record_id_num -> static

* Diseases list -> SSdisease

* More disease globals to the SS

* More disease stuff

* Emote list

* Better and better

* Bluh

* So much stuff

* Ahh

* Wires

* dview

* station_areas

* Teleportlocs

* blood_splatter_icons

* Stuff and such

* More stuff

* RAD IO

* More stuff and such

* Blob shit

* Changeling stuff

* Add "Balance" to changelogs

* Balance for changelog compiler + Auto Tagging

* Update the PR template

* hivemind_bank

* Bip

* sacrificed

* Good shit

* Better define

* More cult shit

* Devil shit

* Gang shit

* > borers

Fix shit

* Rename the define

* Nuke

* Objectives

* Sandbox

* Multiverse sword

* Announce systems

* Stuff and such

* TC con

* Airlock

* doppllllerrrrrr

* holopads

* Shut up byond you inconsistent fuck

* Sneaky fuck

* Burp

* Bip

* Fixnshit

* Port without regard

* askdlfjs;

* asdfjasoidojfi

* Protected globals and more

* SO MANY

* ajsimkvahsaoisd

* akfdsiaopwimfeoiwafaw

* gsdfigjosidjfgiosdg

* AHHHHHHHHHHHHHHHHHHHHHHH!!!!!

* facerolll

* ASDFASDFASDF

* Removes the unused parts of dmm_suite

* WIP

* Fix quote

* asdfjauwfnkjs

* afwlunhskjfda

* asfjlaiwuefhaf

* SO CLOSE

* wwwweeeeeewwwww

* agdgmoewranwg

* HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!?

* Fix syntax errors

* 100 errors

* Another 100

* So many...

* Ugh

* More shit

* kilme

* Stuuuuuufffff

* ajrgmrlshio;djfa;sdkl

* jkbhkhjbmjvjmh

* soi soi soi

* butt

* TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING

* lllllllllllllllllllllllllllllllllllllllllll

* afsdijfiawhnflnjhnwsdfs

* yugykihlugk,kj

* time to go

* STUFFF!!!

* AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!

* ngoaijdjlfkamsdlkf

* Break time

* aufjsdklfalsjfi

* CONTROL KAY AND PRAY

* IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

* Goteem

* Fix testing mode

* This does not belong in this PR

* Convert it to a controller

* Eh, fuck this option

* Revert controllerization Ill do it some other time

* Fix

* Working controllerization

* FOR THE LOVE OF CHRIST PROTECT THE LOGS

* Protect admins and deadmins

* Use the inbuilt proc
2017-04-06 23:26:13 -06:00
Cyberboss
31ee152489 Repaths subsystem to controller/subsystem (#24624)
* Repaths subsystem to controller/subsystem

* Fix the shit
2017-03-08 22:05:45 +01:00
Cyberboss
3ad9be1555 Subsystems are now ordered by name in MC tab 2017-03-02 14:45:40 -05:00
MrStonedOne
3f75fdb42d Addtimer refactor: Officially faster then byond's internal sleep system 2017-01-16 12:56:48 -08:00
Joan Lung
2c73d95e7f Fixes bad html handling for cult and clockcult messages (#20436)
* Fixes bad decoding for cult and clockcult messages

* NEATO
2016-09-13 09:09:54 +12:00
Kyle Spier-Swenson
235b79fb5a StonedMC, the bastard love child of GoonPS and CarnMC (#17987)
Basically, they key difference between StonedMC and CarnMC is that when multiple ticks want to run at the same byond tick, we divvy up the tick between the subsystems, rather then allow one subsystem to hog it all.

The key difference between StonedMC and GoonPS is that we allow the subsystems to tell us how to divvy up the tick using flags and priority.

The new SS_ flags allows us to select behaviors that used to be piggybacked as side effects of dynamic wait or default but sometimes unneeded behavior.

Dynamic wait is 100% gone, lower priority and SS_BACKGROUND are better more refined ways of doing this when combined with MC_TICK_CHECK

I have by design never looked at the inners of goonPS, so this is all original code but I know it uses two loops because of comments by goon devs on reddit threads, that design didn't make sense before, but when I can tell a SS how much of a byond tick it is allowed to have, knowing how many need to run this tick is helpful I also know a bit more about how it works from piecing together comments in #vgstation.

Detailed list of changes:

Subsystems now have flags, allowing fine grain control over things like rather or not it processes, inits, rather it's wait is how long between runs (post run timing) or how long between starts, and rather or not late fires should cause the next fire to be earlier.

Mc now has two loops One loop handles queuing shit, one loop handles running shit.

MC now splits up tick allotment rather than first come first serve Subsystems can even request a bigger share using higher priorities. (It will even resume subsystems it paused if other subsystems hadn't used as much as it predicted they might need)

Default fps is now 20 This is related enough to the MC and it's a change that's really long since over due

All code oddities are most likely to be necessities to lower overhead on the mc since it runs every tick
2016-06-16 18:01:16 +12:00
Remie Richards
984afed89f Adds a priority system for client.color effects 2016-04-07 21:55:31 +01:00
Bjorn Neergaard
531e4b947f Subsystem display tweaks 2015-12-05 10:13:59 -06:00
carnie
a029a49392 SubSystem rewrite
Misc:

+Fixes unreported issue with initializing lighting on a specific zlevel

+Fixes two similar issues with moveElement and moveRange. Where fromIndex or toIndex could be adjusted incorrectly in certain conditions. Potentially causing bad-sorts, or out of bound errors.

+Rewrites listclearnulls(list/L) to no longer iterate through L.len elements for every null in the list (plus 1). i.e. went from L.len*(number_of_nulls+1) list-element reads (best-case), to L.len list-element reads (worst-case)

+New proc/getElementByVar(list/L, varname, value) which finds the first datum in a list, with a variable named varname, which equals value. You can also feed it atoms instead of lists due to the way the in operator functions.

+Fixes an unreported issue with Yota's list2text rewrite. Under certain conditions, the first element would not be converted into a string. Causing type-mismatch runtimes.

+New global map_ready variable. This is not fully implemented yet, but will be used to avoid duplicate calls to initialize() for map objects.

+All turfs now maintain references to all lights currently illuminating them. This will mean higher memory use unfortunately, due to the huge number of turfs. However, it will speed up updateAffectingLights significantly. I've used list husbandry to reduce baseline memory usage, so it shouldn't be any worse than some past atmos modifications memory-wise.

-Removed 'quadratic lighting', can add this back at some point. Sorry.

+modified the way lum() works slightly, to allow turfs to have overridden delta-lumen. i.e. space cannot be illuminated more than its default ambiance. This allowed removal of some iffy special-snowflake lighting areas implemented by somebody else.

+Lighting images in the dmi can now use arbitrary naming schemes. It is reliant on order now. This allows the dmi to be replaced by simply dropping in a new dmi.

-Removed all subtypes of /area/shuttle. Shuttles now create duplicate 'rooms' of /area/shuttle. (More on this later). This will conflict with most maps. Guide on how to fix to follow.

+All verbs/tools relating to world.tick_lag were refactored to use world.fps. However old config text for setting tick_lag will still work (it converts the value to fps for you)

+MC stats improved using smoothing. They now have their own tab so they dont get in the way when you're playing as an admin.

-removed the push_mob_back stuff due to conflicting changes. Sorry Giacom.

_OK, NOW THE ACTUAL INTERESTING STUFF_

Following systems moved over to subsystem datums:
air_master
garbage_manager
lighting_controller
process_mobs (aka Life())
nanomanager
power
sun
pipenets
AFK kick loops
shuttle_controller (aka emergency shuttle/pods), supply_shuttle and other shuttles
voting
bots
radio
diseases
events
jobs
objects
ticker

Subsystems hooks and variables should be commented fairly in-depth. If anything isn't particularly clear, please make an issue.

Many system-specific global variables have been refactored into

All tickers which previously used world.timeofday now use world.time

some subsystems can iterate before round start. this resolves the issue with votes not working pregame
2014-12-31 13:25:41 +00:00
carnie
05b76b123e TimSort for byond:
RESULTS:
sorting 10 random lists of length 3 to 303 in increments of 3
(Meh, I forgot to refresh this one, there were only 338 trials rather than 1010, can't be bothered to recode the test)
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           0.672       16.141       16.243       171226  <--TG's current mergesort(recursive, hence the higher number of calls)
/proc/sortTim                                            0.008        3.278        3.274          338  <--TimSort
/proc/sortMerge                                          0.011        2.839        2.855          338  <--new mergesort
/proc/sortInsert                                         0.010        2.124        2.103          338  <--binary insertion

Sorting 10 presorted lists with 3 inversions (3 elements shuffled up), Lists of length 3 to 303 (increments of 3)
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           1.290       23.056       23.254       308050	<--rather cataclysmic
/proc/sortMerge                                          0.015        4.077        4.068         1010	<--
/proc/sortInsert                                         2.639        3.472        3.464         1010	<--
/proc/sortTim                                            0.014        1.567        1.576         1010	<--TimSort is faaar more effective in these cases,
Timsort can exploit runs effectively

sorting 10 presorted lists which have been reversed
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           1.234       23.193       23.295       308050
/proc/sortMerge                                          0.023        4.681        4.686         1010
/proc/sortInsert                                         2.875        3.750        3.765         1010
/proc/sortTim                                            0.020        3.294        3.284         1010	//This can be lower by using a different comparison method
 *Corrected: /proc/sortTim                                0.017        0.665        0.663         1010	//Using a non-strictly ascending comparison

sorting 10 presorted lists
                                    Profile results (total time)
Proc Name                                             Self CPU    Total CPU    Real Time        Calls
-------------------------------------------------    ---------    ---------    ---------    ---------
/proc/sortList                                           1.199       21.391       21.517       308050
/proc/sortMerge                                          0.018        3.724        3.729         1010
/proc/sortInsert                                         2.497        3.302        3.309         1010
/proc/sortTim                                            0.024        0.586        0.584         1010

Summary, all the new procs are faster than the old ones. TimSort is ever so slightly slower than Insertion and Merging on random lists. But on lists with natural runs (partially sorted data) it is far faster than all others.

The old merge sort was removed and replaced with timSort. Other algorithms are provided as alternatives.

All algorithms use a central datum, so accept many of the same parameters. For instance, setting associative=1 will make them sort associative lists by their associated values, rather than keys.
They also accept a cmp argument. This allows sorting of lists of datums, text, numbers or whatever. The pre-existing helpers in lists.dm were rewritten as examples.
2014-09-01 11:29:49 +01:00