Debug information on Pawns and Controllers

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Bob242

New Member
Aug 27, 2004
34
0
0
I'm trying to spawn extra computer controlled players for a game using the UT2003 engine.

Long story short, I'm trying to spawn them manually. I suspect that the way bots are normally spawned is located inside the native code when the map/level loads (probably basic knowledge, but it's my guess at this point. :)).

I have managed to spawn the pawn I want, and it looks fine.

This is where things get hard....

When I spawn a controller for the pawn, Level.controllerlist shows that for every controller I spawn, it actually spawns two controllers pointing to the same pawn.... I know this because if I spawn no controllers there are no controllers pointing to the pawns I spawned.

The controllers and pawns I'm using (stock) are quite some generations away from "AIController" and "Pawn". The exact class of the controller I'm using contains two references to the pawn, and the exact class of the pawn I'm using contains two references to the controller (for class specific purposes I'm guessing).

So... back to my two spawned controllers. For the one I spawned and have a variable pointing to, both references to its pawn are correct, as per my settings, however the other controller is only half correct since one of its references to its pawn points to none. I decided to try deleting the one that wasn't fully correct since it wasn't the one I had a variable pointing to.

That seems to have worked, but I'm still not sure why it spawns 2 controllers.

Now the computer players can run around nicely like I told them to, but the server crashes when it tries to run a native function determining a relationship of some sort with all of the other computer players.

I know I must either be forgetting to set something, or this is something that needs to be handled at the native level. Either way, I'm looking for a way to dump all of the variables of every controller and pawn in the map/level and all references to them. I really don't feel like having to go write a gigantic log() on every variable, although I've already started doing something like that. ;)

Basically, at this point I'm trying to find the difference between a normally spawned computer player, and my type of computer spawned player.
 

Dandeloreon1984

CXP Director
Jan 31, 2004
1,303
0
0
i'd recommend taking a look at the monster code used for the invasion gametype... it'll help you a ton with this issue... you can prolly use this to avoid two controllers for the pawn.
 

Dandeloreon1984

CXP Director
Jan 31, 2004
1,303
0
0
do you have unreal tournament 2004... your post says Unreal Tournament 2003... so i thought u had ut2k3... but if u have ut2k4, look at monster.uc and skaarj.uc
 

Bob242

New Member
Aug 27, 2004
34
0
0
No, I'm using a totally different game that is using the UT2003 engine. The developers of this game licensed the engine, but other than that, it has nothing to do with UT in any way. :)
 

Bob242

New Member
Aug 27, 2004
34
0
0
I've done enough research into the engine using this forum and mainly the Wiki, and I have been able to make some nice things. All I'm asking for is information on how to debug pawns and controllers, and information regarding the way bots are normally spawned (ie. When in the native code are they spawned?).
 

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
You see, the "engine" and the "game" are quite (and that is putting it lightly) different. The difference between unreal 2 and UT2003 are immense, even. Just because it says unreal engine, does NOT mean that it is compatible at all with another game that uses the unreal engine. For instance, many of the U2 native functions (especially the AI) are dramatically different than those found in UT200x. Therefor, we NEED to know what game in order to have a reference of wtf you're talking about.

Also, UT2004 has the DrawDebug function which can be used to show debug info on the screen in game. U2 has no such function. The differences in engines can very easily be quite large. Asking us to help you is useless, since we really dont know anything about what youre talking about if you wont provide more information.
 

Bob242

New Member
Aug 27, 2004
34
0
0
I'm just asking for two things:

1) How are bots spawned in UT2003? If at the native level when loading the map/level like I suspect, can I simulate the process in UScript?

2) How can I dump all of the variables of pawns and controllers in UT2003?

Since there are very few real modders for my games, I doubt it would assist you to know what game. Modding is not supported by the company that produced it.

It's crashing when trying to run a native function figuring out whether or not to request assistance from other bots. This leads me to believe there is something fundamentally different between my bots and the bot spawned normally. Hence I'm just asking for the two things mentioned above.
 

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
Well, it cant be native because mod users have to be able to spawn their own pawns and controllers in single player. I'm also pretty sure that spawning pawns in UT200x doesnt add them to the controller list, although I could be mistaken there.

And as I said earlier, UT200x has the DrawDebug function to display info on the screen. The only other way would be to manually write a dump method.
 

Bob242

New Member
Aug 27, 2004
34
0
0
Well, if modders are able to spawn their own bots, in what order do they do what?

I first spawned a pawn using the Spawn() method, and then a controller the same way. I tried to initialize some values and have the controller possess the pawn.

One thing that is noteworthy is that I could destroy() the controllers that didn't have all their references correct, but I couldn't destroy() the controllers that were correct as per my settings.

I would appreciate it if someone could post some code samples. BTW, thanks for the link. I'll take a look in there.

EDIT:

OK, this is where I'm at now....

I'm using an initialization method for the pawn found inside the pawn class I'm using, which I found out spawns its own controller (Yes, I see why I was getting 2. :lol: ). So I'm calling this method which spawns the controller and gets a reference to it with the variable "controller", and of course has the controller possess itself.

The controller has an auto state where it gets everything configured, including the class specific references to it's pawn. Well, I know it's coming to this state because it's accessing none, but it's definitely not setting the variable properly for whatever reason. If I manually attempt to set the variables, it works that way, but I still can't figure out why it can't initialize itself....

I'm still getting the crash when the bots that I spawn try to run the same native function.
 
Last edited:

Dandeloreon1984

CXP Director
Jan 31, 2004
1,303
0
0
Bob242 said:
Well, if modders are able to spawn their own bots, in what order do they do what?

I first spawned a pawn using the Spawn() method, and then a controller the same way. I tried to initialize some values and have the controller possess the pawn.

One thing that is noteworthy is that I could destroy() the controllers that didn't have all their references correct, but I couldn't destroy() the controllers that were correct as per my settings.

I would appreciate it if someone could post some code samples. BTW, thanks for the link. I'll take a look in there.

EDIT:

OK, this is where I'm at now....

I'm using an initialization method for the pawn found inside the pawn class I'm using, which I found out spawns its own controller (Yes, I see why I was getting 2. :lol: ). So I'm calling this method which spawns the controller and gets a reference to it with the variable "controller", and of course has the controller possess itself.

The controller has an auto state where it gets everything configured, including the class specific references to it's pawn. Well, I know it's coming to this state because it's accessing none, but it's definitely not setting the variable properly for whatever reason. If I man ually attempt to set the variables, it works that way, but I still can't figure out why it can't initialize itself....

I'm still getting the crash when the bots that I spawn try to run the same native function.

try just spawning a pawn... that seems to work most of the time.

edit: and also, i'll point you to the segment of code responsible for the controller management... and anyways, look at the monster code:
http://unreal.student.utwente.nl/uncodex-ut2003/Source_skaarjpack/monster.html
 
Last edited:

Bob242

New Member
Aug 27, 2004
34
0
0
Well, I tried spawning a pawn, and sure it enough it's there, but it doesn't really do anything. You get some regular animations, but he has no weapons, and he doesn't seem to really react to anything.

The part of the code where it spawns the controller for a monster in its postbeginplay() looks similar to the initialization code of the pawn class I'm working with...

One thing I've noticed is that the gameinfo class I'm using inherits a function that is named to reflect that it spawns bots.... What it really does it just initialize all spawn points, and then add all the bot pawns it can find to a dynamic array of bot pawns. Perhaps I should be adding my pawns to this list?

EDIT:

Well, OK, for fun I spawned my pawns, and then called the bot spawning function everytime.... and sure enough the normal bots respawned....
 
Last edited: