Raised This Month: $32 Target: $400
 8% 

Some basic(?) coding questions regarding sourcemm


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 10-21-2005 , 05:27   Some basic(?) coding questions regarding sourcemm
Reply With Quote #1

This is my first question on these boards, and I'm sure someday I will look back on it and laugh, however, looking for documentation on sourcemod that contains information of it's capabilities compared to amx/amxx (of which i'm VERY accustomed to) I've come up a bit short. I've read these boards and seen a few posts with questions relating back to old amx/x commands, so it's clear there are people with similar questions.

I realize sourcehook is extremely powerful in allowing you to hook pretty much any function in the game, but I'm wondering how it handles (if at all) the old-style (1.5/6) server messages that were sent to the clients (ie- messages that affected the user's interface, like screenfade/health/armor/ammo updates/etc). Is there a similar way to access these messages in sourcemm? I noticed a hook in sample_mm called FireEvent.. is this what controls these messages?

Also I've read a couple of threads that mention spawning entities. Back in AMX, when I got more comfortable using vexd utilities, I was spawning entities with DispatchSpawn, rather than the simple create_entity function(s) available to the engine. Currently, it seems that DispatchSpawn is not able to work, but are there other ways of spawning/removing entities into the game world that can be used repeatedly?

And lastly, keeping with the entity example above, is how one would go about creating temporary entities like tracers and other effects, such as lightning/beams/cylinders/etc. I have seen a plugin that runs (it uses eventscripts) that has accomplished tracers, and other effects such as this, but I'm wondering if these temporary entites hold the same limitations currently as regular entities in their creation/removal.

Again I want to appologize if this post seems a bit beginner for these forums, but I learn from example and I've not found many open source projects that are really do anything (functional) to look at for guidance.


Thanks
-Ryan
Ryan is offline
Send a message via AIM to Ryan
BAILOPAN
Join Date: Jan 2004
Old 10-21-2005 , 07:38   Re: Some basic(?) coding questions regarding sourcemm
Reply With Quote #2

Quote:
Originally Posted by Infernal_Ryan
I'm wondering how it handles (if at all) the old-style (1.5/6) server messages that were sent to the clients (ie- messages that affected the user's interface, like screenfade/health/armor/ammo updates/etc).
This isn't a task for SourceHook unfortunately because of how Valve separated the various systems. SourceHook hooks virtual functions. The network message passing system isn't virtual, and therefore, you cannot hook it. You can find what message was sent, but not the number of parameters or how they're packed.

HL1 Method: Engine packed messages for you
HL2 Method: GameDLL packs message, sends byte stream to engine

The stream packing class is not virtual, meaning it falls outside of SourceMM's scope. It would need a detour (SourceDetours?) which I haven't written yet (but plan to in the far future).

The other thing you mentioned is called gameevents. They're internal within the gamedll/engine rather than engine->client.

Quote:
Originally Posted by Infernal_Ryan
Also I've read a couple of threads that mention spawning entities. Back in AMX, when I got more comfortable using vexd utilities, I was spawning entities with DispatchSpawn, rather than the simple create_entity function(s) available to the engine.
No, entities are almost completely mod-based now. There is no interface to abstract between an edict and a CBaseEntity. Furthermore, entvars_s is removed, so an edict is basically just a wrapper for very basic network states. Welcome to the hell that is Source modability for plugins you must basically hack apart the mod internals to get anywhere. See the SourceMod devlog earlier articles for more information on this.

Quote:
Originally Posted by Infernal_Ryan
And lastly, keeping with the entity example above, is how one would go about creating temporary entities like tracers and other effects, such as lightning/beams/cylinders/etc.
There is a temporary entity system. I have not used it, but the interface itself does not have to be exported by the GameDLL (I think).

These are valid questions coming from an AMX Mod X coder
__________________
egg
BAILOPAN is offline
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 10-21-2005 , 16:27   Re: Some basic(?) coding questions regarding sourcemm
Reply With Quote #3

Quote:
Originally Posted by BAILOPAN
SourceHook hooks virtual functions. The network message passing system isn't virtual, and therefore, you cannot hook it. You can find what message was sent, but not the number of parameters or how they're packed.
Does this mean that sending messages is not possible at all at this time, even if the parameters are known? And could they be found in the source code at all? or by running some kind of packet sniffer to approximate the parameters?


Quote:
Originally Posted by BAILOPAN
The other thing you mentioned is called gameevents. They're internal within the gamedll/engine rather than engine->client.
Ah, you mean like touch events, and damage events, etc... ?

Quote:
Originally Posted by BAILOPAN
No, entities are almost completely mod-based now. There is no interface to abstract between an edict and a CBaseEntity. Furthermore, entvars_s is removed, so an edict is basically just a wrapper for very basic network states. Welcome to the hell that is Source modability for plugins you must basically hack apart the mod internals to get anywhere. See the SourceMod devlog earlier articles for more information on this.
I've played CSDM a few times (great job, btw), and I've noticed that entities, such as players and weapons are almost immediately removed (from sight anyway) when a player is killed. Was this an implementation of entity removal or modification? I mentioned before I was very familiar with vexd_utilities.. I know you said the engine does not differenciate now between an edict (player ent?) and a baseent (regular entity?), does this mean that there are no tables for entity properties? like player speed/transparency/etc? Are we offset hacking for this information at this time? Entity manipulation was one of the defining aspects of my last mod, war3x, for amx/amxx, and I'm eager to attempt another mod for the source engine that would utilize this as well. Source has a lot more effects available to mod developers (such as the watery hologram!) that server-modders are anxious to take advantage of!


Quote:
Originally Posted by BAILOPAN
There is a temporary entity system. I have not used it, but the interface itself does not have to be exported by the GameDLL (I think).
Do you know of any examples that have been written that might be worth checking out?


And thanks a bunch again, Bailo. Your work on sourcemm/sourcemod are greatly appreciated!
Ryan is offline
Send a message via AIM to Ryan
BAILOPAN
Join Date: Jan 2004
Old 10-21-2005 , 16:42  
Reply With Quote #4

You can send messages if you know how to construct them. However, once Valve starts making messages that are undocumented, they will have to be deconstructed manually by their bitstream.

The engine DOES differentiate - that's the problem. The engine only knows about the primitive networkable state of an edict. There is no entity information. All entity information (that whole entvars table) is now in CBaseEntity.

That means you're doing offset/datamap/sendtable hacks which are easy but more painful that some nice, logical mod-independent interface.

Unfortunately I don't have any examples of temporary entities. I'd be glad to give you the CS:S DM source code if you want it, so you can see what I had to go through to make it work. The most entity manipulation thing I do is hook players dropping weapons and removing them. I also set transparencies on players but that was a bit easier (even without the property table).
__________________
egg
BAILOPAN 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 00:20.


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