AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   question about performance (https://forums.alliedmods.net/showthread.php?t=105167)

joropito 10-01-2009 23:02

question about performance
 
what's better?

Case 1:
  • Create entity
  • Use entity
  • Remove entity
  • ....
  • Create another entity
  • Use entity
  • Remove entity
  • ....
  • Create another entity
  • Use entity
  • Remove entity

Case 2:
  • Create entity
  • Use entity
  • Hide entity (because now it's unused)
  • ....
  • Reuses old entity
  • Hide entity
  • ....
  • Reuses old entity
  • Hide entity
  • Remove entity

I think the second case it's better.

Another question.
What's the best method to hide that entity? Set origin to some location outside the map?

Thanks

Emp` 10-02-2009 00:49

Re: question about performance
 
How often (approximately) is this process?

Hiding can be achieved several different ways, origin somewhere weird, changing render values, setting a blank model, and more. Just choose whatever you want.

Arkshine 10-02-2009 04:41

Re: question about performance
 
Even if it's not called often, if you can reuse the same entity, go for that. Is it possible to see an example of what you want to do, what entity you want to use etc.

joropito 10-02-2009 09:10

Re: question about performance
 
Quote:

Originally Posted by Arkshine (Post 949853)
Even if it's not called often, if you can reuse the same entity, go for that. Is it possible to see an example of what you want to do, what entity you want to use etc.

I'm going to manage weapon health using func_breakable (on-hand, on-ground)

I need to choose the method to manage the quantity of weapons on map.

For example, if I'm going to create one breakable for each weapon in a map, for a 32 slots server, i would have around 64 entities but if you have unlimited buytime could be more.

So one way is to create one entity for each weapon but I'm not sure if it's the best way (the advantage with this is to store health and relations to real weapons on each entity).

When reusing entities, I need to store damage and relations in arrays.

I don't have this implemented yet so I don't have code to show.

Arkshine 10-02-2009 09:36

Re: question about performance
 
Not sure if it's worth to do it. Even if I would prefer to reuse. Well do the both and profile them. :D


All times are GMT -4. The time now is 22:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.