Skip to content

Commit ccf4288

Browse files
carlosrpgchrisinajar
authored andcommitted
Workaround to speed up load time (#2253)
1 parent cc36ac5 commit ccf4288

11 files changed

+56
-31
lines changed
-4.45 KB
Binary file not shown.

game/scripts/npc/abilities/sohei_flurry_of_blows_oaa.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//-------------------------------------------------------------------------------------------------------------
3939
"precache"
4040
{
41-
"particle" "particles/hero/ronin/flurry_of_blows_ground.vpcf"
41+
"particle" "particles/hero/sohei/flurry_of_blows_ground.vpcf"
4242
"particle" "particles/status_fx/status_effect_omnislash.vpcf"
4343
"soundfile" "soundevents/game_sounds_heroes/game_sounds_ember_spirit.vsndevts"
4444
}

game/scripts/npc/abilities/sohei_momentum_oaa.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
//-------------------------------------------------------------------------------------------------------------
3737
"precache"
3838
{
39-
"particle" "particles/hero/ronin/momentum.vpcf"
40-
"particle" "particles/hero/ronin/knockback.vpcf"
39+
"particle" "particles/hero/sohei/momentum.vpcf"
40+
"particle" "particles/hero/sohei/knockback.vpcf"
4141
"soundfile" "soundevents/units/game_sounds_sohei.vsndevts"
4242
}
4343

game/scripts/npc/abilities/sohei_wholeness_of_body_oaa.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
//-------------------------------------------------------------------------------------------------------------
3535
"precache"
3636
{
37-
"particle" "particles/hero/ronin/guard.vpcf"
38-
"particle" "particles/hero/ronin/knockback.vpcf"
37+
"particle" "particles/hero/sohei/guard.vpcf"
38+
"particle" "particles/hero/sohei/knockback.vpcf"
3939
"soundfile" "soundevents/units/game_sounds_sohei.vsndevts"
4040
}
4141

game/scripts/npc/npc_units_custom.txt

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169

170170
#base "units/minimap/minimap.txt"
171171
#base "units/buildings/azazel.txt"
172+
#base "units/misc/npc_dota_load_econ_dummy.txt"
172173

173174
"DOTAUnits"
174175
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"DOTAUnits"
2+
{
3+
// This unit was created to allow using PrecacheUnitByNameAsync to load econ particle
4+
// PrecacheResource requires as valid context that we don't have outside Precache method
5+
"npc_dota_load_econ_dummy"
6+
{
7+
"BaseClass" "npc_dota_creature"
8+
"Model" "models/development/invisiblebox.vmdl"
9+
"particle_folder" "particles/econ/items/" //Load all items particles
10+
}
11+
}

game/scripts/npc/units/npc_dota_hero_electrician.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
// General
99
//-------------------------------------------------------------------------------------------------------------
1010
"BaseClass" "npc_dota_hero_dazzle"
11-
"Model" "models/heroes/electrician/electrician.vmdl"
11+
"Model" "models/heroes/electrician/electrician.vmdl"
1212
"SoundSet" "Hero_Electrician"
13-
"HeroID" "129"
14-
"particle_folder" "particles/units/heroes/hero_electrician"
15-
"GameSoundsFile" "soundevents/game_sounds_heroes/game_sounds_electrician.vsndevts"
16-
"VoiceFile" "soundevents/voscripts/game_sounds_vo_electrician.vsndevts"
13+
"HeroID" "129"
14+
"particle_folder" "particles/units/heroes/hero_electrician"
15+
//"GameSoundsFile" "soundevents/game_sounds_heroes/game_sounds_electrician.vsndevts"
16+
//"VoiceFile" "soundevents/voscripts/game_sounds_vo_electrician.vsndevts"
1717

1818
// Abilities
1919
//-------------------------------------------------------------------------------------------------------------

game/scripts/vscripts/addon_game_mode.lua

+30-15
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ function Precache( context )
4040

4141
DebugPrint("[BAREBONES] Performing pre-load precache")
4242

43-
for _,Item in pairs( g_ItemPrecache ) do
44-
PrecacheItemByNameAsync( Item, function( item ) end )
45-
end
46-
47-
for _,Unit in pairs( g_UnitPrecache ) do
48-
PrecacheUnitByNameAsync( Unit, function( unit ) end )
49-
end
50-
5143
for _,Model in pairs( g_ModelPrecache ) do
5244
PrecacheResource( "model", Model, context )
5345
end
@@ -66,14 +58,37 @@ function Precache( context )
6658

6759
-- precache all hero econ folders
6860
-- this makes immortals and stuff work
69-
local allheroes = LoadKeyValues('scripts/npc/npc_heroes.txt')
70-
for key,value in pairs(LoadKeyValues('scripts/npc/herolist.txt')) do
71-
if value == 1 then
72-
local hero = string.sub(key, 15)
73-
-- PrecacheResource("particle_folder", "particles/econ/items/" .. hero, context)
74-
PrecacheResource("model_folder", "particles/heroes/" .. hero, context)
61+
-- I'm comment this out cause the prior code was only loading the particles (moved to later)
62+
-- And loading all the items models are just impossible cause it gives out of memory exception
63+
64+
-- local allheroes = LoadKeyValues('scripts/npc/npc_heroes.txt')
65+
-- for key,value in pairs(LoadKeyValues('scripts/npc/herolist.txt')) do
66+
-- if value == 1 then
67+
-- local hero = string.sub(key, 15)
68+
-- local modelFolder = "models/items/" .. hero
69+
-- print("Loading model folder :" .. modelFolder)
70+
-- PrecacheResource("model_folder", modelFolder, context)
71+
-- end
72+
-- end
73+
74+
-- Delay Precache particle
75+
-- Team Selection + Picking screen should be enough to load all the information needed
76+
-- This is better than using GameMode:PostLoadPrecache because it start the loading as soon as the players connect
77+
-- and gives less delay when loading to the next screen
78+
GameEvents:OnConnectFull( function()
79+
print("Precaching all hero particle cosmetics")
80+
PrecacheUnitByNameAsync( "npc_dota_load_econ_dummy", function( unit )
81+
print("Finish loading cosmetics")
82+
end )
83+
84+
for _,Item in pairs( g_ItemPrecache ) do
85+
PrecacheItemByNameAsync( Item, function( item ) end )
7586
end
76-
end
87+
88+
for _,Unit in pairs( g_UnitPrecache ) do
89+
PrecacheUnitByNameAsync( Unit, function( unit ) end )
90+
end
91+
end )
7792

7893
-- Particles can be precached individually or by folder
7994
-- It it likely that precaching a single particle system will precache all of its children, but this may not be guaranteed

game/scripts/vscripts/components/heroselection/heroselection.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ end)
2929

3030
-- list all available heroes and get their primary attrs, and send it to client
3131
function HeroSelection:Init ()
32-
Debug:EnableDebugging()
3332

3433
DebugPrint("Initializing HeroSelection")
3534
self.isCM = GetMapName() == "oaa_captains_mode"
@@ -135,6 +134,7 @@ end
135134
-- set "empty" hero for every player and start picking phase
136135
function HeroSelection:StartSelection ()
137136
DebugPrint("Starting HeroSelection Process")
137+
138138
DebugPrint(GetMapName())
139139

140140
HeroSelection.shouldBePaused = true

game/scripts/vscripts/gamemode.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ require('libraries/notifications')
3030
-- This library can be used for starting customized animations on units from lua
3131
require('libraries/animations')
3232
-- This library can be used for performing "Frankenstein" attachments on units
33-
require('libraries/attachments')
33+
-- require('libraries/attachments')
3434
-- This library can be used to synchronize client-server data via player/client-specific nettables
3535
require('libraries/playertables')
3636
-- This library can be used to create container inventories or container shops
3737
require('libraries/containers')
3838
-- This library provides a searchable, automatically updating lua API in the tools-mode via "modmaker_api" console command
39-
require('libraries/modmaker')
39+
-- require('libraries/modmaker')
4040
-- This library provides an automatic graph construction of path_corner entities within the map
4141
require('libraries/pathgraph')
4242
-- This library (by Noya) provides player selection inspection and management from server lua

game/scripts/vscripts/precache.lua

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ g_ItemPrecache = {
1212
"item_dagger_of_moriah",
1313
"item_dispel_orb_1",
1414
"item_reflection_shard_1",
15-
"item_heart_transplant",
16-
"item_manta_1",
15+
"item_heart_transplant"
1716
}
1817

1918
g_UnitPrecache = {
@@ -68,7 +67,6 @@ g_ParticlePrecache = {
6867

6968
g_ParticleFolderPrecache = {
7069
"particles/capture_point_ring",
71-
"particles/econ/items", -- Precache all hero cosmetics
7270
"particles/items",
7371
"particles/items/dispel_orb",
7472
"particles/items/dagger_of_moriah",

0 commit comments

Comments
 (0)