First commit, time to break the station.

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
This commit is contained in:
bbusse@gmail.com
2011-09-24 19:03:07 +00:00
parent 233b49a829
commit eba53b1287
5 changed files with 107 additions and 0 deletions

View File

@@ -480,6 +480,7 @@ obj/indicator
Click() Click()
process() process()
obj/window obj/window
verb verb
destroy() destroy()
@@ -550,6 +551,52 @@ mob
air_master.process_update_tiles() air_master.process_update_tiles()
air_master.process_rebuild_select_groups() 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() mark_groups()
set category = "Debug" set category = "Debug"
if(!air_master) if(!air_master)

View File

@@ -9,6 +9,10 @@ datum
//The use of archived cycle saves processing power by permitting the archiving step of FET //The use of archived cycle saves processing power by permitting the archiving step of FET
// to be rolled into the updating step // 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 proc
archive() archive()
@@ -39,6 +43,8 @@ datum
suspend_group_processing() suspend_group_processing()
update_tiles_from_group() update_tiles_from_group()
group_processing = 0 group_processing = 0
check_delay=0
next_check=0
update_group_from_tiles() update_group_from_tiles()
var/sample_member = pick(members) var/sample_member = pick(members)
@@ -52,6 +58,9 @@ datum
update_tiles_from_group() update_tiles_from_group()
for(var/member in members) for(var/member in members)
member:air.copy_from(air) member:air.copy_from(air)
if (istype(member,/turf/simulated))
var/turf/simulated/turfmem=member
turfmem.reset_delay()
archive() archive()
air.archive() air.archive()
@@ -79,6 +88,13 @@ datum
turf/process_group() turf/process_group()
current_cycle = air_master.current_cycle current_cycle = air_master.current_cycle
if(group_processing) //See if processing this group as a group 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/turf/simulated/list/border_individual = list()
var/datum/air_group/list/border_group = list() var/datum/air_group/list/border_group = list()

View File

@@ -39,6 +39,9 @@ turf
active_hotspot.just_spawned = (current_cycle < air_master.current_cycle) active_hotspot.just_spawned = (current_cycle < air_master.current_cycle)
//remove just_spawned protection if no longer processing this cell //remove just_spawned protection if no longer processing this cell
//start processing quickly if we aren't already
reset_delay()
return igniting return igniting
obj obj

View File

@@ -61,6 +61,10 @@ turf
var/pressure_difference = 0 var/pressure_difference = 0
var/pressure_direction = 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 proc
high_pressure_movements() high_pressure_movements()
@@ -80,6 +84,18 @@ turf
pressure_difference = connection_difference pressure_difference = connection_difference
pressure_direction = connection_direction 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 simulated
proc proc
consider_pressure_difference_space(connection_difference) consider_pressure_difference_space(connection_difference)
@@ -90,8 +106,11 @@ turf
air_master.high_pressure_delta += src air_master.high_pressure_delta += src
pressure_direction = direction pressure_direction = direction
pressure_difference = connection_difference pressure_difference = connection_difference
return 1 return 1
turf turf
simulated simulated
@@ -127,6 +146,7 @@ turf
mimic_temperature_with_tile(turf/model) mimic_temperature_with_tile(turf/model)
share_temperature_with_tile(turf/simulated/sharer) share_temperature_with_tile(turf/simulated/sharer)
super_conduct() super_conduct()
update_visuals(datum/gas_mixture/model) update_visuals(datum/gas_mixture/model)
@@ -194,6 +214,9 @@ turf
parent.suspend_group_processing() parent.suspend_group_processing()
air.merge(giver) air.merge(giver)
else else
if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND)
reset_delay()
air.merge(giver) air.merge(giver)
if(!processing) if(!processing)
@@ -297,6 +320,13 @@ turf
processing = 0 processing = 0
process_cell() 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() var/turf/simulated/list/possible_fire_spreads = list()
if(processing) if(processing)
if(archived_cycle < air_master.current_cycle) //archive self if not already done if(archived_cycle < air_master.current_cycle) //archive self if not already done
@@ -542,3 +572,8 @@ turf
being_superconductive = 1 being_superconductive = 1
air_master.active_super_conductivity += src air_master.active_super_conductivity += src
proc/reset_delay()
//sets this turf to process quickly again
next_check=0
check_delay=0

View File

@@ -158,3 +158,9 @@
for(var/mob/O in viewers(src, 3)) 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) 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 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