Page 2 of 2

Re: server init

Posted: Wed Nov 15, 2017 7:37 pm
by L'In20Cible
Speed0x wrote:you dont need to prove your point. ive already seen your point. i dont disagree with your point.

your point just doesnt help me.

Sorry, I misinterpreted your previous post and thought you were saying I was wrong for telling you that the tables are re-allocated every map and not that it was not affecting you because you never change the map on your server (which technically doesn't make me wrong, but whatever.).

Speed0x wrote:just a moment ago i wanted to create a simple loader via the server_ready listener. but then you kinda told me its a useless approach, although it suits my needs at least. so idk..
I didn't say it was useless; I said it was unnecessary. And I truly believe it is because I really don't understand why you persist to want to globalize the pre-cached indexes when all it does is limiting your plugin to a single map. But hey, if it does fits your needs, go for it! :wink:

Re: server init

Posted: Wed Nov 15, 2017 10:36 pm
by satoon101
Speed0x wrote:you are kinda wrong, because i know that i dont reload the map and your scenario never happens.. so it doesnt help me.. :(

Just because the indexes happen to be the same, doesn't mean that is by design. You shouldn't rely on that being true whatsoever. L'In20Cible is 100% right. I'm really not sure why you are trying to 'cache' the indexes anyway, that's a really quick lookup when you want to use the Decal object, and it only happens once per map (which is something that has to happen anyway).

Re: server init

Posted: Tue Nov 21, 2017 10:06 pm
by Speed0x
okay, using Decal().index is waaaaaaay too slow. ( i just tested it )

Re: server init

Posted: Tue Nov 21, 2017 10:16 pm
by Speed0x
what if i use these functions :

Syntax: Select all

def get_decal_index(path):
engine_server.precache_decal(path,True)
return string_tables['decalprecache'][path]

def get_model_index(path):
engine_server.precache_model(path,True)
return string_tables['modelprecache'][path]


and always reload my cache, every time the OnServerActivate listener is fired?? wouldnt this be the best solution??

Re: server init

Posted: Tue Nov 21, 2017 10:20 pm
by satoon101
I honestly don't see how it could possibly be slower, as that's pretty much all it does, as well:


The one improvement we could perhaps make for the Precache classes is to store the index and re-retrieve it on server_spawn when we re-precache.

Re: server init

Posted: Tue Nov 21, 2017 10:25 pm
by Speed0x
well the point is, that im only working with the indexes in my custom code.
so i dont need to initiate an entire Decal() class in python. i guess creating all the memory buffers and requirements for such are taking some time to load via python, because im loading the maximum amount in cache of both decals and models.

so since i would only need Decal().index, i guess my get_index classes are of better use here. but only, if i am correct, that reloading the indexes @ OnServerActivate, would work and never cause problems, such as "non-existing" index... etc...

Re: server init

Posted: Tue Nov 21, 2017 10:36 pm
by Ayuto
Speed0x wrote:so i dont need to initiate an entire Decal() class in python. i guess creating all the memory buffers and requirements for such are taking some time to load via python, because im loading the maximum amount in cache of both decals and models.

The instantiation of these classes only needs to be done once (when your plugin is loaded), so I'm not sure why you even care about that.

Re: server init

Posted: Tue Nov 21, 2017 10:41 pm
by Speed0x
because it takes too long. ( 30-60 seconds on low end machines). with my code it takes about (max 5 seconds) . if you had reat earlier posts, you would have seen that i don't restart the map usually anyway. but in case i do, i just wanted to know if the indexes will display correctly with my code. thats all. i dont need this constant attacks on my chosen approach without helping me with my approach... thats really just playing devils advocate ;)

Re: server init

Posted: Tue Nov 21, 2017 11:20 pm
by L'In20Cible
Speed0x wrote:what if i use these functions :

Syntax: Select all

def get_decal_index(path):
engine_server.precache_decal(path,True)
return string_tables['decalprecache'][path]

def get_model_index(path):
engine_server.precache_model(path,True)
return string_tables['modelprecache'][path]

Could simply be:

Syntax: Select all

def get_decal_index(path):
return engine_server.precache_decal(path,True)

def get_model_index(path):
return engine_server.precache_model(path,True)

Re: server init

Posted: Wed Nov 22, 2017 6:50 am
by Ayuto
Speed0x wrote:i dont need this constant attacks on my chosen approach without helping me with my approach...
You know that it's not an attack. So, please stop bringing up that point everytime.

I would rather like to fix any existing performance issues than finding any workarounds. That's why I'm not discussing yours or L'In20Cible's solution.

Re: server init

Posted: Thu Nov 23, 2017 8:34 pm
by Speed0x
with the recent changes in the autounload class, i might test using this class now. but what about the following scenario:

ent = Tempentity("")
ent.model = Model(path)

will this tempentitiy still have the correct prechached model, even after the map restarts???
or do i still have to reset the ent.model each maprestart manually, to display the tempent model correctly?

Re: server init

Posted: Thu Nov 23, 2017 8:40 pm
by Ayuto
You would have to reset after every map change/reload. If you don't want to create instances over and over, you could also do something like this:

Syntax: Select all

my_model = Model(path)
ent = TempEntity("blabla")

# Later before sending it or only after a map change
ent.model_index = my_model.index

Re: server init

Posted: Thu Nov 23, 2017 8:43 pm
by Speed0x
okay, that is also how i do my workaround... i will just stick with my current code then.. thanks