Commit Graph

34 Commits

Author SHA1 Message Date
Cyberboss
31ee152489 Repaths subsystem to controller/subsystem (#24624)
* Repaths subsystem to controller/subsystem

* Fix the shit
2017-03-08 22:05:45 +01:00
PJB3005
64db72a150 Merge remote-tracking branch 'upstream/master' into rebase-to-vg 2017-03-04 16:31:55 +01:00
Cyberboss
3ad9be1555 Subsystems are now ordered by name in MC tab 2017-03-02 14:45:40 -05:00
Pieter-Jan Briers
b5b93e51f7 Merge remote-tracking branch 'upstream/master' into rebase-to-vg 2017-02-18 16:52:07 +01:00
Leo
9c6803ae19 Ports Paradise error handler, with in game runtime viewer! (#24036)
* Ports paradise error handler, with in game runtime viewer!

* Changes to the old runtime error and removes inerror reference

* Oops

* Adds a wrapper for world.log so it displays both in the runtime diary and in DD window
2017-02-14 11:39:31 +11:00
PJB3005
3c8b98a3aa 9/11 2017-02-08 15:07:58 +01:00
Cyberboss
75d816eeb9 Makes SSlighting initialization more responsive 2017-01-19 14:08:40 -05:00
PJB3005
e2386a8bd8 Have some code 2017-01-17 22:54:05 +01:00
PJB3005
7356e80484 hey that should be everything except making it compile. 2017-01-17 22:08:27 +01:00
Kyle Spier-Swenson
e768cf195e Makes lighting more responsive. 2017-01-08 00:28:49 -08:00
FlavoredCactus
8c8e5d6e91 Fixes lighting hanging up with changed turfs (#19060) 2016-07-01 19:59:34 +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
Kyle Spier-Swenson
0c133555e2 Makes lighting tick as fast as it can. 2016-04-01 21:29:54 -07:00
MrStonedOne
aa328e404f Adds lag check to diseases and events (and removes lighting from dwait)
lighting removed from dewait because lag checks are better for it and lag checked subsystems that are also dwait systems are given lower priority, we don't want that to happen to lighting.
2016-03-15 03:39:44 -07:00
MrStonedOne
bc8ff11f3f Lag check on initialization (and on a missed del-all proc) 2016-03-15 03:39:43 -07:00
MrStonedOne
09fb8c2b10 Explosions and singulo use spiral range (and other changes) 2016-03-15 03:39:41 -07:00
MrStonedOne
2887dc7ce0 Removes lag.
This setup allows subsystems to pause themselves until next mc fire if they are about to go over a tick, and resume on the next mc tick
It also makes it so we prioritize running subsystems we skipped because there wasn't enough time in the current tick to run them based on their avg tick usage. (as well as subsystems paused mid way thru)

Adds a macro for adding this to non-mc procs. just drop it in the loop. There is a define version as well for if checks if you want to know if you just slept to avoid lag.

This is all inside #if DM_VERSION defines, so once i test that 509 still works to compile/test this should be good to merge
2016-03-15 03:39:39 -07:00
Firecage
332bde0f4f Does the rest of the if()'s/ else's 2016-01-17 19:03:12 +02:00
Bjorn Neergaard
531e4b947f Subsystem display tweaks 2015-12-05 10:13:59 -06:00
MrStonedOne
8c755da84f Adds a way to make certain area/space areas not force 100% brightness 2015-10-31 02:30:49 -07:00
Aranclanos
6b8ab6641a Replaces the Cut() usage in the processing lists from the different controllers for a Remove() 2015-08-18 06:52:57 -03:00
MrStonedOne
08b9f6c8c6 More Dynamic wait tweaks.
I forgot a step in the algo and made it so it was decreasing in its slowdown effect with more lag, not increasing.

I've also made the -1.5 magic number in the algo configurable. its was a simple buffer of cost the subsystem is allowed to use that isn't counted against it in dwait.
2015-07-10 23:25:34 -07:00
MrPerson
e507613fbe Lighting SS speedup
Best of both worlds: No colons AND no pointless typechecking!
2015-06-22 04:09:33 -07:00
MrStonedOne
14b258c655 Tweaks MC's dynamic rate system a bit
The MC will now track the total cost of all subsytems (normalized out to a per second cost number so that subsystems that only run every 10 minutes but are costly (looking at you server tasks) aren't accounting for 90% of the number when they shouldn't.)

This is now used in the dynamic wait subsystems to ensure they slow down when other things are being lagging

This mainly means that air won't lag things if the singulo gets free.

I also tweaked the scaling curve used by the dynamic wait system so that it scales less during slight lag, but much more during higher lag times.

I added qdel to the dynamic wait subsystem with a really high scale. This didn't make sense before, because it limits its run time, but now it can scale back how often it runs when the other subsystems are being laggy. I also lowered qdel's max runtime from 2ds to 1ds, because deletes take 0.9 ds on avg, so it would end up running for 2.9ds often.

This should prevent air+singulo+qdel causing excessive amounts of lag.
2015-06-10 05:04:56 -07:00
MrStonedOne
bd6d51a0b5 Massive MC and subsystem rewrite
MC:
	No longer tracks a subsystem's cpu usage. This was basically worthless and took up space on the stat panel
	Can calculate wait down to a tenth of a decisecond to make it fps/world.ticklag agnostic
	Now allows subsystems to have a dynamic wait, that is based on a ratio of how long that subsystem has been taking to process(cost). (This system allows for upper and lower bounds, and an changeable cost delta for each subsystem)
	MC can now be told to init a zlevel

All Subsystems:
	Stats panel now allows child subsystems to pass it a message to add to its stats entry. All subsystems have been moved over to this system - This should cut down on subsystems having to copy and paste the stats proc in order to add to it
	All subsystems now properlly handle being given a zlevel in their init proc

Subsystem changes:
	Air:
		Added air to the dynamic wait subsystem. upper bound: 50, lower bound: 5, cost delta: 3 times process cost
		Air now fires 4 times faster when it can do so without lagging things up
		Pipenet has been merged into air
		Atmos machinery now processes with process_atmos(), ticked by air, not machinery.
		Hotspots (the fire object) are now object pooled
	Pipenet:
		Deleted, added to air
	Machinery:
		Moved all atmos calcualtions in all objects's process() to process_atmos().
	Lighting:
		Added Lighting to the dynamic wait subsystem. upper bound: 20, lower bound: 5, cost delta: 3 times process cost
	Ticker:
		Fixed ticker not updating the lobby panel when game start delayed
		Fixed the game start timer updating rapidly from queued fires when game start delay is removed
	Garbage/qdel:
		qdel will now limit its process time to 2ds a fire.
		qdel can now be given hints as a return to Destroy() as to what should be done with the object.
		the options are:
			queue: (default) this is the normal behavior.
			letmelive: old default to non-null/zero. does nothing with the object
			iwillgc: functionally the same as above, mainly to let people working with objects know that the object will not be queued for GC checking
			harddel: this will queue the object to be deleted without storing a soft reference, mainly to save locate() processing time.
			harddel_now: this will del() the object. To allow for a clean removal of every del() not in qdel
		All objects have been updated to the new system, harddel and iwillgc was not added to any new objects.
		Fixed some objects not GCing because they didn't properlly clear references in Destory()
		Fixed some objects getting qdel'ed preventing other objects from getting GCed because they did not null their reference to that object.
2015-04-29 02:00:25 -07:00
MrPerson
01a8aa662a Moved lighting stuff from controllers folder to its own module
Lighting SS no longer cares about the return of check(); the light datums are responsible for deleting themselves.
Cap on lighting effects from turfs is now 8 because they're static and shouldn't be flashing lights too often. This means starlight actually works now instead of being capped at 1 measly turf.
Lighting related ChangeTurf() code is in the lighting module. Changed it up to be faster on lighting controller init and not leave dangling lights when a turf becomes or stops being opaque or when it turns into space. This diff log is gonna be useless sadly but take my word for it, it all works.
Lighting related Moved() code is also in the lighting module. Opaque objects will now update nearby lights when they move (mechs).
Opaque objects other than the light datum's owner on the same tile as its owner will block the effect of the light. In other words a mech standing on the same square as a light bulb will block all the light of that bulb.

Changed "cheap_hypoteneuse()" with an even cheaper version; actually calculating the hypoteneuse! I can prove it's cheaper if needed.
Removed move_contents_to() because it's unused and trying to use it would cause major bugs with lights and other shit and I have no interest in supporting that, so let's not even tempt people.
2015-04-12 02:25:28 -07:00
MrPerson
907e20c94d Lights are now told when to update instead of constantly asking if they need to. The lighting SS is a lot faster as a result and no longer has :'s everywhere
atom/movable/Destroy() in atoms_movable.dm now calls ..() to fix #8063
Light strength and light radius are no longer a single concept, although right now all lights are max strength for their radius
Updated the comment intro for _DynamicAreaLighting_TG.dm to account for modern fact and not talk so much about the old system(s)
And a changelog for all this lighting shit, not that anybody could possibly miss it
2015-03-31 12:35:10 -07:00
MrPerson
e4a3abdd70 Object based lighting system
Uses actual objects on each non-space, dynamically lit turf. Light levels are switched back and forth via animate() and the object's alpha. Supporting colors shouldn't be too hard. Some hacky efficiency improvements means it isn't that much more expensive than current (I think, needs testing). Most of the lighting ss's cost is in checking all the lights and doing big loops, not anything actually in the loops themselves.

Start PDA flashlights on. This was to speed up testing but frankly I think it's a good change in general.

Added a Moved() proc. Called after a successful move.

In the future I hope to move off the luminosity var entirely but that was too slow in testing for me. That's what all that "for(area in sortedAreas) area.luminosity = 1" stuff in the lighting ss is, tests on removing luminosity outright.
2015-03-31 05:09:42 -07:00
paprka
2d1642dd22 fixes another runtime with starlight 2015-02-24 16:48:06 -08:00
paprka
68d649b6e1 removes unnecessary crap 2015-02-22 21:07:57 -08:00
paprka
eee61482db removes giant loop 2015-02-22 20:07:38 -08:00
paprka
69915d0b1a actually fixes starlight with configs 2015-02-22 16:58:00 -08:00
carnie
e285bd0b3c Map Update 2015-01-04 01:45:02 +00: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