Skip to content

Commit

Permalink
First commit, time to break the station.
Browse files Browse the repository at this point in the history
Atmo fixes here, should help lag a bit.  Turfs and air groups start skipping processing ticks if they haven't been doing anything lately.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2264 316c924e-a436-60f5-8080-3fe189b3f50e
  • Loading branch information
[email protected] committed Sep 24, 2011
1 parent 233b49a commit eba53b1
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
47 changes: 47 additions & 0 deletions code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ obj/indicator
Click()
process()


obj/window
verb
destroy()
Expand Down Expand Up @@ -550,6 +551,52 @@ mob
air_master.process_update_tiles()
air_master.process_rebuild_select_groups()

mark_group_delay()
set category = "Debug"
if(!air_master)
usr << "Cannot find air_system"
return

for(var/datum/air_group/group in air_master.air_groups)
group.marker = 0

for(var/turf/simulated/floor/S in world)
S.icon = 'turf_analysis.dmi'
if(S.parent)
if(S.parent.group_processing)
if (S.parent.check_delay < 2)
S.parent.marker=1
else if (S.parent.check_delay < 5)
S.parent.marker=2
else if (S.parent.check_delay < 15)
S.parent.marker=3
else if (S.parent.check_delay < 30)
S.parent.marker=4
else
S.parent.marker=5
if(S.parent.borders && S.parent.borders.Find(S))
S.icon_state = "on[S.parent.marker]_border"
else
S.icon_state = "on[S.parent.marker]"

else
if (S.check_delay < 2)
S.icon_state= "on1_border"
else if (S.check_delay < 5)
S.icon_state= "on2_border"
else if (S.check_delay < 15)
S.icon_state= "on3_border"
else if (S.check_delay < 30)
S.icon_state= "on4_border"
else
S.icon_state = "suspended"
else
if(S.processing)
S.icon_state = "individual_on"
else
S.icon_state = "individual_off"


mark_groups()
set category = "Debug"
if(!air_master)
Expand Down
16 changes: 16 additions & 0 deletions code/FEA/FEA_airgroup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ datum
//The use of archived cycle saves processing power by permitting the archiving step of FET
// to be rolled into the updating step

//optimization vars
var/tmp/next_check = 0 //number of ticks before this group updates
var/tmp/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way

proc
archive()

Expand Down Expand Up @@ -39,6 +43,8 @@ datum
suspend_group_processing()
update_tiles_from_group()
group_processing = 0
check_delay=0
next_check=0

update_group_from_tiles()
var/sample_member = pick(members)
Expand All @@ -52,6 +58,9 @@ datum
update_tiles_from_group()
for(var/member in members)
member:air.copy_from(air)
if (istype(member,/turf/simulated))
var/turf/simulated/turfmem=member
turfmem.reset_delay()

archive()
air.archive()
Expand Down Expand Up @@ -79,6 +88,13 @@ datum
turf/process_group()
current_cycle = air_master.current_cycle
if(group_processing) //See if processing this group as a group
//check if we're skipping this tick
if (next_check > 0)
next_check--
return 1
next_check += check_delay + rand(0,check_delay/2)
check_delay++

var/turf/simulated/list/border_individual = list()
var/datum/air_group/list/border_group = list()

Expand Down
3 changes: 3 additions & 0 deletions code/FEA/FEA_fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ turf
active_hotspot.just_spawned = (current_cycle < air_master.current_cycle)
//remove just_spawned protection if no longer processing this cell

//start processing quickly if we aren't already
reset_delay()

return igniting

obj
Expand Down
35 changes: 35 additions & 0 deletions code/FEA/FEA_turf_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ turf
var/pressure_difference = 0
var/pressure_direction = 0

//optimization vars
var/next_check = 0 //number of ticks before this tile updates
var/check_delay = 0 //number of ticks between updates

proc
high_pressure_movements()

Expand All @@ -80,6 +84,18 @@ turf
pressure_difference = connection_difference
pressure_direction = connection_direction

if (istype(src,/turf/simulated))
//P=nRT/V
var/turf/simulated/me = src
var/min_pressure = MINIMUM_AIR_TO_SUSPEND*me.air.temperature*R_IDEAL_GAS_EQUATION/CELL_VOLUME
if (connection_difference > min_pressure)
//enough air moved, reset wait
me.reset_delay()
//reset neighbor too
var/turf/simulated/enemy_tile = get_step(src, connection_direction)
if(istype(enemy_tile))
enemy_tile.reset_delay()

simulated
proc
consider_pressure_difference_space(connection_difference)
Expand All @@ -90,8 +106,11 @@ turf
air_master.high_pressure_delta += src
pressure_direction = direction
pressure_difference = connection_difference


return 1


turf
simulated

Expand Down Expand Up @@ -127,6 +146,7 @@ turf
mimic_temperature_with_tile(turf/model)
share_temperature_with_tile(turf/simulated/sharer)


super_conduct()

update_visuals(datum/gas_mixture/model)
Expand Down Expand Up @@ -194,6 +214,9 @@ turf
parent.suspend_group_processing()
air.merge(giver)
else
if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND)
reset_delay()

air.merge(giver)

if(!processing)
Expand Down Expand Up @@ -297,6 +320,13 @@ turf
processing = 0

process_cell()
//check if we're skipping this tick
if (next_check > 0)
next_check--
return 1
next_check += check_delay + rand(0,check_delay/2)
check_delay++

var/turf/simulated/list/possible_fire_spreads = list()
if(processing)
if(archived_cycle < air_master.current_cycle) //archive self if not already done
Expand Down Expand Up @@ -542,3 +572,8 @@ turf
being_superconductive = 1

air_master.active_super_conductivity += src

proc/reset_delay()
//sets this turf to process quickly again
next_check=0
check_delay=0
6 changes: 6 additions & 0 deletions code/game/objects/alien/resin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,9 @@
for(var/mob/O in viewers(src, 3))
O.show_message(text("\red An alien larva bursts from the resin wall!"), 1, text("\red You hear a high, alien screech nearby!"), 2)
return

/obj/alien/resin/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group) return 0
if(istype(mover) && mover.checkpass(PASSGLASS))
return !opacity
return !density

0 comments on commit eba53b1

Please sign in to comment.