Raised This Month: $51 Target: $400
 12% 

Strange Occurrence when changing entity models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chief149
Member
Join Date: Sep 2010
Old 10-06-2016 , 02:11   Strange Occurrence when changing entity models
Reply With Quote #1

So I made a furniture plugin for an RP server. Because players want to decorate their apartments with props, the entity count can get really high. The solution I came up with was to have all player furniture models linked to a door. As players come and go, the plugin would see which doors have at least one player with access (door owner, keyholder, etc.) and load the furniture linked to that door.

I took it a step further, because two problems would arise from this:
1) Firing the Kill input on an entity does not free the entity index. It is up to the game engine to decide when or if to free an entity index. Because of this, it is possible to get a "No Free Edicts" error even though there are like 1200/2048 ents being used.
2) Killing and recreating too many entities can cause a "SnagMismatch" segmentation fault, crashing the whole server. If a player joins the server who is friends with everybody and has keys to too many doors, it can cause many entities to be created, risking this fatal error.

So I came up with a system which would create new entities where needed, or recycle existing entities by changing their model.
This leads to an odd effect where props have a different physics models it seems. The plugin for example might spawn a table, but that table will have the collision model of a piece of fencing.
To set the model, I've been using SetEntityModel. I'm not changing any other properties. Is there a way to fix this where the physics models are correct?
Chief149 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-06-2016 , 09:58   Re: Strange Occurrence when changing entity models
Reply With Quote #2

Depending on how the RP map is made you could just generate the props when there is a player near the door or if the door is opened.
As for the entity problem, i'm not sure what game you are playing.
https://forums.alliedmods.net/showthread.php?t=186830
Mitchell is offline
Chief149
Member
Join Date: Sep 2010
Old 10-06-2016 , 10:20   Re: Strange Occurrence when changing entity models
Reply With Quote #3

Quote:
Originally Posted by Mitchell View Post
Depending on how the RP map is made you could just generate the props when there is a player near the door or if the door is opened.
As for the entity problem, i'm not sure what game you are playing.
https://forums.alliedmods.net/showthread.php?t=186830
Well that addon is neat, but it doesn't work really well. In fact, I tried a while ago, and it didn't work at all. As I am aware, the reason Source Engine isn't using the correct entity indices (correct as far as we think, is because those indices aren't being reclaimed for some reason. Killing an edict does not free up its index. That's up to the source engine sadly (I wish we could manually free up indices ourselves).
Chief149 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-06-2016 , 10:38   Re: Strange Occurrence when changing entity models
Reply With Quote #4

Quote:
Originally Posted by Chief149 View Post
Well that addon is neat, but it doesn't work really well. In fact, I tried a while ago, and it didn't work at all. As I am aware, the reason Source Engine isn't using the correct entity indices (correct as far as we think, is because those indices aren't being reclaimed for some reason. Killing an edict does not free up its index. That's up to the source engine sadly (I wish we could manually free up indices ourselves).
That's exactly what the metamod plugin is doing, using unused edict slots.
Mitchell is offline
Chief149
Member
Join Date: Sep 2010
Old 10-06-2016 , 12:48   Re: Strange Occurrence when changing entity models
Reply With Quote #5

Unfortunately that metamod plugin doesn't work.
Chief149 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 10-06-2016 , 13:00   Re: Strange Occurrence when changing entity models
Reply With Quote #6

You still haven't mentioned the game being played, hl2dm, cs:s?
Mitchell is offline
Chief149
Member
Join Date: Sep 2010
Old 10-06-2016 , 16:07   Re: Strange Occurrence when changing entity models
Reply With Quote #7

hl2dm. Eventually CS:S as well.

But CEF only has builds for 2009+ at the moment. I guess I could build a version for hl2dm as well, but I don't have all the stuff set up.

Honestly I'd just like to know if there is a way to fix the physics model issue as that would be the fastest and least complex way to make everything work perfectly.

Last edited by Chief149; 10-06-2016 at 16:09.
Chief149 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-06-2016 , 16:41   Re: Strange Occurrence when changing entity models
Reply With Quote #8

Quote:
Originally Posted by Chief149 View Post
hl2dm. Eventually CS:S as well.

But CEF only has builds for 2009+ at the moment. I guess I could build a version for hl2dm as well, but I don't have all the stuff set up.

Honestly I'd just like to know if there is a way to fix the physics model issue as that would be the fastest and least complex way to make everything work perfectly.
HL2:DM and CS:S are both Source 2009 games.

This may be confusing, but Valve updated several of their older Source multiplayer games to a newer engine back in 2010.

Source 2009 titles are:
  • Half-Life 2: Deathmatch
  • Counter-Strike: Source
  • Day of Defeat: Source
  • Team Fortress 2

Well, technically Team Fortress 2 wasn't updated to this as Source 2009 / Source SDK 2013 is just Team Fortress 2's engine and the other games were updated to use it...
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-06-2016 at 16:51.
Powerlord is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:58.


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