adeonc@Posted: Sun Sep 13, 2009 8:50 am :
Hello everyone.
Today I spent like the whole day trying to figure out a way to get my code returning a player's clientNum.

For testing, I made the following:
Quote:


In theory, if I put the right function to be used with the printf, the hoster will see in console the message: "Your client number: 0" everytime that he spawns, and the message: "Your client number: 1" everytime the player 2 spawns and so forth. Right?

How can I have the player clientNum being returned in this case?

Thank you.



Sikkpin@Posted: Sun Sep 13, 2009 9:11 am :
You should be able to cycle through the numbers with "gameLocal.GetNextClientNum( int current )" with your number being stored in "gameLocal.localClientNum". I don't know if these will help.



TinMan@Posted: Sun Sep 13, 2009 10:32 am :
Since the player is being passed in to SelectSpawnPoint
player->entityNumber



adeonc@Posted: Sun Sep 13, 2009 5:23 pm :
TinMan wrote:
Since the player is being passed in to SelectSpawnPoint
player->entityNumber
Awesome! The answer was pretty simple and solved my problem. I was going nuts.
Worked perfectly. Thank you sir. To you both for your time :)

By the way, how did you get knowledge on the SDK? By reading the whole code or is there any good reference related to it on the internet? I've never seen a complete/good tutorial of the SDK :?



TinMan@Posted: Mon Sep 14, 2009 6:21 am :
There's some information here: http://www.modwiki.net/wiki/Coding#Coding_tutorials
Otherwise, as the saying goes, good code is it's own documentation.
My addition would be, with Visual Studios 'Go to Declaration/Definition' :)
So, a combination of rummaging through the code and stepping through execution with the debugger.
Naturally the larger the code base the longer it takes to figure things out.



adeonc@Posted: Mon Sep 14, 2009 3:05 pm :
TinMan wrote:
There's some information here: http://www.modwiki.net/wiki/Coding#Coding_tutorials
Otherwise, as the saying goes, good code is it's own documentation.
My addition would be, with Visual Studios 'Go to Declaration/Definition' :)
So, a combination of rummaging through the code and stepping through execution with the debugger.
Naturally the larger the code base the longer it takes to figure things out.
Uhmm... I see.
I've been having headaches trying to figure out this SDK. Specially because I'm kinda newbie at C++. Pointers still get me badly.

Yesterday I got pretty happy when I finished some piece of code that makes a player spawn in a specific info_player_start according to its player->entityNumber by adding a "playernum" parameter in the spawnspot followed by an integer number. So the hoster spawns at player_start with playernum 1, the player 2 spawns at player_start with playernum 2 and so on. If there's no spawnpoints with "playernum" set letf, the game proceeds the default method of sorting.
Anyways, seems simple, but, after all, I spent two days trying to develop it just because I couldn't read many parts of the code at all :(

All in all, really appreciate programming.

Thanks for reply.



RedFox@Posted: Fri Oct 09, 2009 12:20 am :
I am working on a Proof-of-Concept of something and will need to to do some spawn point selecting too in the near future. I haven't had a dig at the spawning code yet, but I saw your post and thought I'd ask: could you outline the changes in the code that you made to create the spawn point selection? This would help me a lot. Anyway, thanks in advance and happy coding!



chuckdood@Posted: Fri Oct 09, 2009 9:08 pm :
I found the best way to learn about pointers was to add some watches in VC++ while debugging, and watch the address of the variable you're watching. You can see it change, or stay the same for a bunch of calls to a variable. in Doom3, they use idStr all over the place in a bunch of functions, but it is referring to only one idStr variable, so by watching all of the used versions, and the original variable, I started to notice that they were the same thing, because their address was the same. something like 0x024a6bf1 for each variable I watched, as an example. Only then did I start to understand pointers.



adeonc@Posted: Sat Oct 10, 2009 1:37 pm :
RedFox wrote:
I am working on a Proof-of-Concept of something and will need to to do some spawn point selecting too in the near future. I haven't had a dig at the spawning code yet, but I saw your post and thought I'd ask: could you outline the changes in the code that you made to create the spawn point selection? This would help me a lot. Anyway, thanks in advance and happy coding!
Sure, pal. I'll be posting that later for you.



adeonc@Posted: Sun Sep 13, 2009 8:50 am :
Hello everyone.
Today I spent like the whole day trying to figure out a way to get my code returning a player's clientNum.

For testing, I made the following:
Quote:


In theory, if I put the right function to be used with the printf, the hoster will see in console the message: "Your client number: 0" everytime that he spawns, and the message: "Your client number: 1" everytime the player 2 spawns and so forth. Right?

How can I have the player clientNum being returned in this case?

Thank you.



Sikkpin@Posted: Sun Sep 13, 2009 9:11 am :
You should be able to cycle through the numbers with "gameLocal.GetNextClientNum( int current )" with your number being stored in "gameLocal.localClientNum". I don't know if these will help.



TinMan@Posted: Sun Sep 13, 2009 10:32 am :
Since the player is being passed in to SelectSpawnPoint
player->entityNumber



adeonc@Posted: Sun Sep 13, 2009 5:23 pm :
TinMan wrote:
Since the player is being passed in to SelectSpawnPoint
player->entityNumber
Awesome! The answer was pretty simple and solved my problem. I was going nuts.
Worked perfectly. Thank you sir. To you both for your time :)

By the way, how did you get knowledge on the SDK? By reading the whole code or is there any good reference related to it on the internet? I've never seen a complete/good tutorial of the SDK :?



TinMan@Posted: Mon Sep 14, 2009 6:21 am :
There's some information here: http://www.modwiki.net/wiki/Coding#Coding_tutorials
Otherwise, as the saying goes, good code is it's own documentation.
My addition would be, with Visual Studios 'Go to Declaration/Definition' :)
So, a combination of rummaging through the code and stepping through execution with the debugger.
Naturally the larger the code base the longer it takes to figure things out.



adeonc@Posted: Mon Sep 14, 2009 3:05 pm :
TinMan wrote:
There's some information here: http://www.modwiki.net/wiki/Coding#Coding_tutorials
Otherwise, as the saying goes, good code is it's own documentation.
My addition would be, with Visual Studios 'Go to Declaration/Definition' :)
So, a combination of rummaging through the code and stepping through execution with the debugger.
Naturally the larger the code base the longer it takes to figure things out.
Uhmm... I see.
I've been having headaches trying to figure out this SDK. Specially because I'm kinda newbie at C++. Pointers still get me badly.

Yesterday I got pretty happy when I finished some piece of code that makes a player spawn in a specific info_player_start according to its player->entityNumber by adding a "playernum" parameter in the spawnspot followed by an integer number. So the hoster spawns at player_start with playernum 1, the player 2 spawns at player_start with playernum 2 and so on. If there's no spawnpoints with "playernum" set letf, the game proceeds the default method of sorting.
Anyways, seems simple, but, after all, I spent two days trying to develop it just because I couldn't read many parts of the code at all :(

All in all, really appreciate programming.

Thanks for reply.



RedFox@Posted: Fri Oct 09, 2009 12:20 am :
I am working on a Proof-of-Concept of something and will need to to do some spawn point selecting too in the near future. I haven't had a dig at the spawning code yet, but I saw your post and thought I'd ask: could you outline the changes in the code that you made to create the spawn point selection? This would help me a lot. Anyway, thanks in advance and happy coding!



chuckdood@Posted: Fri Oct 09, 2009 9:08 pm :
I found the best way to learn about pointers was to add some watches in VC++ while debugging, and watch the address of the variable you're watching. You can see it change, or stay the same for a bunch of calls to a variable. in Doom3, they use idStr all over the place in a bunch of functions, but it is referring to only one idStr variable, so by watching all of the used versions, and the original variable, I started to notice that they were the same thing, because their address was the same. something like 0x024a6bf1 for each variable I watched, as an example. Only then did I start to understand pointers.



adeonc@Posted: Sat Oct 10, 2009 1:37 pm :
RedFox wrote:
I am working on a Proof-of-Concept of something and will need to to do some spawn point selecting too in the near future. I haven't had a dig at the spawning code yet, but I saw your post and thought I'd ask: could you outline the changes in the code that you made to create the spawn point selection? This would help me a lot. Anyway, thanks in advance and happy coding!
Sure, pal. I'll be posting that later for you.



adeonc@Posted: Sun Sep 13, 2009 8:50 am :
Hello everyone.
Today I spent like the whole day trying to figure out a way to get my code returning a player's clientNum.

For testing, I made the following:
Quote:


In theory, if I put the right function to be used with the printf, the hoster will see in console the message: "Your client number: 0" everytime that he spawns, and the message: "Your client number: 1" everytime the player 2 spawns and so forth. Right?

How can I have the player clientNum being returned in this case?

Thank you.



Sikkpin@Posted: Sun Sep 13, 2009 9:11 am :
You should be able to cycle through the numbers with "gameLocal.GetNextClientNum( int current )" with your number being stored in "gameLocal.localClientNum". I don't know if these will help.



TinMan@Posted: Sun Sep 13, 2009 10:32 am :
Since the player is being passed in to SelectSpawnPoint
player->entityNumber



adeonc@Posted: Sun Sep 13, 2009 5:23 pm :
TinMan wrote:
Since the player is being passed in to SelectSpawnPoint
player->entityNumber
Awesome! The answer was pretty simple and solved my problem. I was going nuts.
Worked perfectly. Thank you sir. To you both for your time :)

By the way, how did you get knowledge on the SDK? By reading the whole code or is there any good reference related to it on the internet? I've never seen a complete/good tutorial of the SDK :?



TinMan@Posted: Mon Sep 14, 2009 6:21 am :
There's some information here: http://www.modwiki.net/wiki/Coding#Coding_tutorials
Otherwise, as the saying goes, good code is it's own documentation.
My addition would be, with Visual Studios 'Go to Declaration/Definition' :)
So, a combination of rummaging through the code and stepping through execution with the debugger.
Naturally the larger the code base the longer it takes to figure things out.



adeonc@Posted: Mon Sep 14, 2009 3:05 pm :
TinMan wrote:
There's some information here: http://www.modwiki.net/wiki/Coding#Coding_tutorials
Otherwise, as the saying goes, good code is it's own documentation.
My addition would be, with Visual Studios 'Go to Declaration/Definition' :)
So, a combination of rummaging through the code and stepping through execution with the debugger.
Naturally the larger the code base the longer it takes to figure things out.
Uhmm... I see.
I've been having headaches trying to figure out this SDK. Specially because I'm kinda newbie at C++. Pointers still get me badly.

Yesterday I got pretty happy when I finished some piece of code that makes a player spawn in a specific info_player_start according to its player->entityNumber by adding a "playernum" parameter in the spawnspot followed by an integer number. So the hoster spawns at player_start with playernum 1, the player 2 spawns at player_start with playernum 2 and so on. If there's no spawnpoints with "playernum" set letf, the game proceeds the default method of sorting.
Anyways, seems simple, but, after all, I spent two days trying to develop it just because I couldn't read many parts of the code at all :(

All in all, really appreciate programming.

Thanks for reply.



RedFox@Posted: Fri Oct 09, 2009 12:20 am :
I am working on a Proof-of-Concept of something and will need to to do some spawn point selecting too in the near future. I haven't had a dig at the spawning code yet, but I saw your post and thought I'd ask: could you outline the changes in the code that you made to create the spawn point selection? This would help me a lot. Anyway, thanks in advance and happy coding!



chuckdood@Posted: Fri Oct 09, 2009 9:08 pm :
I found the best way to learn about pointers was to add some watches in VC++ while debugging, and watch the address of the variable you're watching. You can see it change, or stay the same for a bunch of calls to a variable. in Doom3, they use idStr all over the place in a bunch of functions, but it is referring to only one idStr variable, so by watching all of the used versions, and the original variable, I started to notice that they were the same thing, because their address was the same. something like 0x024a6bf1 for each variable I watched, as an example. Only then did I start to understand pointers.



adeonc@Posted: Sat Oct 10, 2009 1:37 pm :
RedFox wrote:
I am working on a Proof-of-Concept of something and will need to to do some spawn point selecting too in the near future. I haven't had a dig at the spawning code yet, but I saw your post and thought I'd ask: could you outline the changes in the code that you made to create the spawn point selection? This would help me a lot. Anyway, thanks in advance and happy coding!
Sure, pal. I'll be posting that later for you.