Newb Messing Around with SDK Code Thread!

Puzzlemaker

Newbie
Joined
Aug 1, 2004
Messages
914
Reaction score
0
Hiya, I am new to the whole modding buisness. As in, making the mods.

I know how to code C++. I am not an expert in any way, but I hope to learn, as it is a good skill to have.

Anyway, I was messing with the SDK code. That stuff is complex, and the valve wiki doesn't really explain what a lot of it does, plus what a lot of the functions do/where they are.

I made a small mod where when you shoot a rocket, it fires out 5 rockets with a shotgun-like effect (As in, random vectors). They dont fire off right away, it takes 5 seconds, so they fall to the ground, then five seconds later start shooting off randomly, meaning you can fire 30 rockets then have a giant rocket barrage.

I also made it so the explosion code creates shrapnel (AKA crossbow bolts; I could have used tracelines, but I wanted to use a physics prop). Its fairly glitchy, though, and doesn't work too well (The crossbow bolts most of the time don't spawn, I think they may be spawning behind the wall where the rocket hit, but I dont know how to fix that).

That was all fairly simple to do, just cutting and pasting parts into other parts and muddling my way through untill it works.

I was wondering if there was anywhere on the valve wiki or something that could explain what a lot of the functions and commands do. I am beggining to grasp the basics of it, but a lot of it still alludes me, and oftentimes to find out what it does I have to go through a scavenger hunt using find.
 
Hello Puzzlemaker. As a frequenter of the ZM forums, you get preferential code lovin'.

So, what would you like to know? There's no "official" documentation - it's all self-taught. But I think I've got a strong enough grasp to tell you what does what.

And by the way - you've now got a hundred times more experience than 99% of the modding community. Bask in the knowledge that, as a coder, you're just plain better.

-Angry Lawyer
 
Angry Lawyer said:
Hello Puzzlemaker. As a frequenter of the ZM forums, you get preferential code lovin'.

So, what would you like to know? There's no "official" documentation - it's all self-taught. But I think I've got a strong enough grasp to tell you what does what.

And by the way - you've now got a hundred times more experience than 99% of the modding community. Bask in the knowledge that, as a coder, you're just plain better.

-Angry Lawyer


Hehe.

Well, I was wondering what the main... tree, I guess would be the best way to put it. What I mean by this is, what is inherited from what which is inherited from what? There are some confusing inheretence trees out there. What does the _shared mean in a name? What exactly does CBaseEntity handle? Does everything inherit from CBaseEntity?

Also, I was tryinig to find where the code to handle bullets are, but I couldn't find it, or I think I couldn't find it.

Another thing that was confusing me: Vector and QAngle objects.

Vectors are just arrays with three data thingies: Z, Y, and X, right?

QAngle is the same thing, except its Pitch, Yaw, and Roll?

Is that right, or is there more to it?

Also, the server stuff is midly confusing, although I think I am getting the hang of it; if you have any advice for that, go ahead and tell me. I was also surprised by how much was handled by the server code... it seems a lot of that could have been handled by the client.

Thanks for the help!

EDIT: Oh, and one more thing... What are some of the flags or whatever you call them? Like these:

SetMoveType( MOVETYPE_FLY );
AddSolidFlags( FSOLID_NOT_SOLID );
 
Find in files and Go To Definitions are your best friends.
I searched for the MOVETYPE_FLY and this is what I found out:

MOVETYPE_FLY, // No gravity, but still collides with stuff
FSOLID_NOT_SOLID = 0x0004, // Are we currently not solid?

Basically, the trick is to right click on a function and go to definition, then you look at the code and when you reach something you don't understand you go to definition, deeper and deeper youll find out how the SDK is structured and what inherits from what.
 
Ti133700N said:
Find in files and Go To Definitions are your best friends.
I searched for the MOVETYPE_FLY and this is what I found out:

MOVETYPE_FLY, // No gravity, but still collides with stuff
FSOLID_NOT_SOLID = 0x0004, // Are we currently not solid?

Basically, the trick is to right click on a function and go to definition, then you look at the code and when you reach something you don't understand you go to definition, deeper and deeper youll find out how the SDK is structured and what inherits from what.

Errm...

Well, I... actually didn't know that there was a go to definition search. Thanks, that helps a lot.

But I still dont know what the _shared in names mean. Or really how vectors and QAngles work.
 
Vectors and QAngles are a maths thing. I've yet to get the full concept of them.

As for the way the game works - the engine (beyond what you can see) copes with the game by having what's called an EntList - a big list pointers to each object in the game. Things don't collide as such, or hit each other - they simply check each other object in the linked list and look at their boundaries and velocities and stuff. The server.dll holds this linked list, and a list of all the actions that are taking place. These are sent in little packets to the client.dlls (of all people connected, including the guy hosting), which then interprets them, and if the client in specific can see the object, it'll draw it.

-Angry Lawyer
 
Angry Lawyer said:
Vectors and QAngles are a maths thing. I've yet to get the full concept of them.

As for the way the game works - the engine (beyond what you can see) copes with the game by having what's called an EntList - a big list pointers to each object in the game. Things don't collide as such, or hit each other - they simply check each other object in the linked list and look at their boundaries and velocities and stuff. The server.dll holds this linked list, and a list of all the actions that are taking place. These are sent in little packets to the client.dlls (of all people connected, including the guy hosting), which then interprets them, and if the client in specific can see the object, it'll draw it.

-Angry Lawyer

Ah, alright, thanks. That helps a lot, actually.
 
Back
Top