mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Fix some performance issues on startup.
This commit is contained in:
@@ -168,3 +168,10 @@
|
||||
else
|
||||
add_gamelogs(user, "added [amount]u to \a [target] with \the [source]", admin = TRUE, tp_link = FALSE)
|
||||
|
||||
|
||||
/**
|
||||
* Standardized method for tracking startup times.
|
||||
*/
|
||||
/proc/log_startup_progress(var/message)
|
||||
world << "<span class='danger'>[message]</span>"
|
||||
world.log << message
|
||||
@@ -4,14 +4,14 @@
|
||||
#define HOURS * 36000
|
||||
|
||||
//Returns the world time in english
|
||||
proc/worldtime2text(timestamp = world.time)
|
||||
/proc/worldtime2text(timestamp = world.time)
|
||||
return "[(round(timestamp / 36000) + 12) % 24]:[(timestamp / 600 % 60) < 10 ? add_zero(timestamp / 600 % 60, 1) : timestamp / 600 % 60]"
|
||||
|
||||
proc/time_stamp()
|
||||
/proc/time_stamp()
|
||||
return time2text(world.timeofday, "hh:mm:ss")
|
||||
|
||||
/* Preserving this so future generations can see how fucking retarded some people are
|
||||
proc/time_stamp()
|
||||
/proc/time_stamp()
|
||||
var/hh = text2num(time2text(world.timeofday, "hh")) // Set the hour
|
||||
var/mm = text2num(time2text(world.timeofday, "mm")) // Set the minute
|
||||
var/ss = text2num(time2text(world.timeofday, "ss")) // Set the second
|
||||
@@ -25,7 +25,7 @@ proc/time_stamp()
|
||||
*/
|
||||
|
||||
/* Returns 1 if it is the selected month and day */
|
||||
proc/isDay(var/month, var/day)
|
||||
/proc/isDay(var/month, var/day)
|
||||
//writepanic("[__FILE__].[__LINE__] \\/proc/isDay() called tick#: [world.time]")
|
||||
if(isnum(month) && isnum(day))
|
||||
var/MM = text2num(time2text(world.timeofday, "MM")) // get the current month
|
||||
@@ -36,3 +36,16 @@ proc/isDay(var/month, var/day)
|
||||
// Uncomment this out when debugging!
|
||||
//else
|
||||
//return 1
|
||||
|
||||
/**
|
||||
* Returns "watch handle" (really just a timestamp :V)
|
||||
*/
|
||||
/proc/start_watch()
|
||||
return world.timeofday
|
||||
|
||||
/**
|
||||
* Returns number of seconds elapsed.
|
||||
* @param wh number The "Watch Handle" from start_watch(). (timestamp)
|
||||
*/
|
||||
/proc/stop_watch(wh)
|
||||
return round(0.1*(world.timeofday-wh),0.1)
|
||||
@@ -51,11 +51,14 @@ datum/controller/game_controller/New()
|
||||
|
||||
master_controller = src
|
||||
|
||||
var/watch=0
|
||||
if (isnull(job_master))
|
||||
watch = start_watch()
|
||||
job_master = new /datum/controller/occupations()
|
||||
job_master.SetupOccupations()
|
||||
job_master.LoadJobs("config/jobs.txt")
|
||||
world << "<span class='danger'>Job setup complete</span>"
|
||||
//world << "<span class='danger'>Job setup complete in </span>"
|
||||
log_startup_progress("Job setup complete in [stop_watch(watch)]s.")
|
||||
|
||||
if(!syndicate_code_phrase) syndicate_code_phrase = generate_code_phrase()
|
||||
if(!syndicate_code_response) syndicate_code_response = generate_code_phrase()
|
||||
@@ -90,11 +93,17 @@ datum/controller/game_controller/proc/setup()
|
||||
setupfactions()
|
||||
setup_economy()
|
||||
SetupXenoarch()
|
||||
var/watch=start_watch()
|
||||
log_startup_progress("Caching damage icons...")
|
||||
cachedamageicons()
|
||||
log_startup_progress("Finished caching damage icons in [stop_watch(watch)]s.")
|
||||
|
||||
buildcamlist()
|
||||
world << "<span class='danger'>Caching Jukebox playlists...</span>"
|
||||
|
||||
watch=start_watch()
|
||||
log_startup_progress("Caching jukebox playlists...")
|
||||
load_juke_playlists()
|
||||
world << "<span class='danger'>Caching Jukebox playlists complete.</span>"
|
||||
log_startup_progress("Finished caching jukebox playlists in [stop_watch(watch)]s.")
|
||||
//if(map && map.dorf)
|
||||
//mining_surprises = typesof(/mining_surprise/dorf) - /mining_surprise/dorf
|
||||
//max_secret_rooms += 2
|
||||
@@ -145,7 +154,7 @@ datum/controller/game_controller/proc/cachedamageicons()
|
||||
species_blood = (S.blood_color == "#A10808" ? "" : S.blood_color)
|
||||
testing("Generating [S], Blood([species_blood])")
|
||||
for(var/datum/organ/external/O in H.organs)
|
||||
testing("[O] part")
|
||||
//testing("[O] part")
|
||||
for(var/brute = 1 to 3)
|
||||
for(var/burn = 1 to 3)
|
||||
var/damage_state = "[brute][burn]"
|
||||
@@ -153,43 +162,62 @@ datum/controller/game_controller/proc/cachedamageicons()
|
||||
DI.Blend(icon('icons/mob/dam_mask.dmi', O.icon_name), ICON_MULTIPLY)
|
||||
if(species_blood)
|
||||
DI.Blend(S.blood_color, ICON_MULTIPLY)
|
||||
testing("Completed [damage_state]/[O.icon_name]/[species_blood]")
|
||||
//testing("Completed [damage_state]/[O.icon_name]/[species_blood]")
|
||||
damage_icon_parts["[damage_state]/[O.icon_name]/[species_blood]"] = DI
|
||||
del(H)
|
||||
|
||||
datum/controller/game_controller/proc/setup_objects()
|
||||
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\datum/controller/game_controller/proc/setup_objects() called tick#: [world.time]")
|
||||
world << "<span class='danger'>Initializing objects</span>"
|
||||
sleep(-1)
|
||||
var/watch = start_watch()
|
||||
log_startup_progress("Initializing objects...")
|
||||
//sleep(-1) // Why
|
||||
//var/last_init_type = null
|
||||
var/count=0
|
||||
for(var/atom/movable/object in world)
|
||||
//if(last_init_type != object.type)
|
||||
// testing("Initializing [object.type]")
|
||||
// last_init_type = object.type
|
||||
object.initialize()
|
||||
count++
|
||||
log_startup_progress(" Initialized [count] objects in [stop_watch(watch)]s.")
|
||||
|
||||
|
||||
world << "<span class='danger'>Initializing pipe networks</span>"
|
||||
sleep(-1)
|
||||
watch = start_watch()
|
||||
count=0
|
||||
log_startup_progress("Initializing pipe networks...")
|
||||
//sleep(-1)
|
||||
for(var/obj/machinery/atmospherics/machine in atmos_machines)
|
||||
machine.build_network()
|
||||
count++
|
||||
log_startup_progress(" Initialized [count] pipe networks in [stop_watch(watch)]s.")
|
||||
|
||||
world << "<span class='danger'>Initializing atmos machinery.</span>"
|
||||
sleep(-1)
|
||||
watch = start_watch()
|
||||
count=0
|
||||
log_startup_progress("Initializing atmos machinery...")
|
||||
//sleep(-1)
|
||||
for(var/obj/machinery/atmospherics/unary/U in atmos_machines)
|
||||
if(istype(U, /obj/machinery/atmospherics/unary/vent_pump))
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/T = U
|
||||
T.broadcast_status()
|
||||
count++
|
||||
else if(istype(U, /obj/machinery/atmospherics/unary/vent_scrubber))
|
||||
var/obj/machinery/atmospherics/unary/vent_scrubber/T = U
|
||||
T.broadcast_status()
|
||||
count++
|
||||
log_startup_progress(" Initialized [count] atmos devices in [stop_watch(watch)]s.")
|
||||
|
||||
watch = start_watch()
|
||||
log_startup_progress("Sending assets to clients...")
|
||||
// MOVED from minimap hell.
|
||||
for (var/client/C in clients)
|
||||
C.send_html_resources()
|
||||
log_startup_progress(" Finished sending assets in [stop_watch(watch)]s.")
|
||||
|
||||
world << "<span class='danger'>Generating ingame minimaps.</span>"
|
||||
sleep(-1)
|
||||
//sleep(-1)
|
||||
generateMiniMaps() // start generating minimaps (this is a background process)
|
||||
|
||||
world << "<span class='danger'>Initializations complete.</span>"
|
||||
sleep(-1)
|
||||
//sleep(-1)
|
||||
|
||||
|
||||
/datum/controller/game_controller/proc/process()
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
message_admins("[key_name_admin(src)] accessed file: [path]")
|
||||
#ifdef RUNWARNING
|
||||
#if DM_VERSION > 506
|
||||
#if DM_VERSION > 506 && DM_VERSION < 508
|
||||
#warn Run is deprecated and disabled for some fucking reason in 507.1275/6, if you have a version that doesn't have run() disabled then comment out #define RUNWARNING in setup.dm
|
||||
src << ftp( file(path) )
|
||||
#else
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
message_admins("[key_name_admin(src)] accessed file: [path]")
|
||||
#ifdef RUNWARNING
|
||||
#if DM_VERSION > 506
|
||||
#if DM_VERSION > 506 && DM_VERSION < 508
|
||||
#warn Run is deprecated and disabled for some fucking reason in 507.1275/6, if you have a version that doesn't have run() disabled then comment out #define RUNWARNING in setup.dm
|
||||
src << ftp( file(path) )
|
||||
#else
|
||||
@@ -110,7 +110,7 @@
|
||||
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")].log"
|
||||
if( fexists(path) )
|
||||
#ifdef RUNWARNING
|
||||
#if DM_VERSION > 506
|
||||
#if DM_VERSION > 506 && DM_VERSION < 508
|
||||
#warn Run is deprecated and disabled for some fucking reason in 507.1275/6, if you have a version that doesn't have run() disabled then comment out #define RUNWARNING in setup.dm
|
||||
src << ftp( file(path) )
|
||||
#else
|
||||
@@ -135,7 +135,7 @@
|
||||
var/path = "data/logs/[time2text(world.realtime,"YYYY/MM-Month/DD-Day")] Attack.log"
|
||||
if( fexists(path) )
|
||||
#ifdef RUNWARNING
|
||||
#if DM_VERSION > 506
|
||||
#if DM_VERSION > 506 && DM_VERSION < 508
|
||||
#warn Run is deprecated and disabled for some fucking reason in 507.1275/6, if you have a version that doesn't have run() disabled then comment out #define RUNWARNING in setup.dm
|
||||
src << ftp( file(path) )
|
||||
#else
|
||||
|
||||
@@ -61,15 +61,18 @@ var/const/ALLOW_CENTCOMM = FALSE
|
||||
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/interactive_map/proc/queueUpdate() called tick#: [world.time]")
|
||||
|
||||
/proc/generateMiniMaps()
|
||||
spawn
|
||||
for (var/z = 1 to world.maxz)
|
||||
if(z == CENTCOMM_Z && !ALLOW_CENTCOMM) continue
|
||||
generateMiniMap(z)
|
||||
//spawn // NO
|
||||
for (var/z = 1 to world.maxz)
|
||||
if(z == CENTCOMM_Z && !ALLOW_CENTCOMM) continue
|
||||
generateMiniMap(z)
|
||||
|
||||
testing("MINIMAP: All minimaps have been generated.")
|
||||
minimapinit = 1
|
||||
for (var/client/C in clients)
|
||||
C.send_html_resources()
|
||||
testing("MINIMAP: All minimaps have been generated.")
|
||||
minimapinit = 1
|
||||
// some idiot put HTML asset sending here. In a spawn. After a long wait for minimap generation.
|
||||
// Dear Idiot: don't do that anymore.
|
||||
// You can put MINIMAP sending here, but we need HTML assets ASAP for character editing.
|
||||
//for (var/client/C in clients)
|
||||
// C.send_html_resources()
|
||||
|
||||
|
||||
/datum/interactive_map/proc/sendResources(client/C)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
|
||||
|
||||
//#define RUNWARNING // disable if they re-enable run() in 507 or newer.
|
||||
#define RUNWARNING // disable if they re-enable run() in 507 or newer.
|
||||
// They did, tested in 508.1296 - N3X
|
||||
|
||||
#ifndef RUNWARNING
|
||||
#warn If you have issues with retrieving logs update byond on the server and client to 507.1277 or greater, or uncomment RUNWARNING
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
author: N3X15
|
||||
delete-after: true
|
||||
changes:
|
||||
- rscadd: "Special role recruiting and polling has been completely reworked."
|
||||
@@ -1,2 +1,6 @@
|
||||
author: N3X15
|
||||
changes: []
|
||||
changes:
|
||||
- bugfix: "HTML assets are sent before minimap generation, probably making character setup load times more tolerable."
|
||||
- experiment: "Added additional profiling data to server startup messages, and improved logging of these messages."
|
||||
- tweak: "Minimap generation no longer done as a background thread."
|
||||
- tweak: "Removed some blood spatter caching messages, making logs more readable."
|
||||
|
||||
Reference in New Issue
Block a user