Game Development Community

Walker vehicle?

by Maddermadcat · in Torque Game Engine · 04/26/2008 (2:37 pm) · 2 replies

So I tried duplicating the player class into a completely separate one, and added the terrain conforming resource to it. Compiles fine and all, and just when I drop one in through the world editor, I get this error:

ProfilerRoot::ProfilerRoot - encountered duplicate profiler block name 'UpdateActionThread'. All block names must be unique!

I'm no coder, so I'd love it if someone could help me out with this. The two files can be downloaded here. I tried making it so that the walkers can be mounted, but of course I have no idea if it works. The password to the archive is torquetorque.

#1
04/26/2008 (3:56 pm)
The problem comes from the profiler code (obvious). You copied the player code exactly, the profiler block 'UpdateActionThread' is started at the beginning of Player::updateActionThread like so:
void Player::updateActionThread()
{
   PROFILE_START(UpdateActionThread);

Changing the name of the block in your custom clas should fix the problem (PROFILE_START(WalkerUpdateActionThread); or something) should fix the problem. Try reading a few books on C++ and learning a bit more before you attempt to write a new vehicle class, even if not from scratch. It will make your life a whole lot easier.
#2
04/26/2008 (7:52 pm)
Yeah, I know, Ishbuu. I can make my way around the code and hack some stuff together, and I didn't need much out of this class anyway, so. I figured it was just the name being off, but then I wasn't sure whether just changing the name would be enough or if it'd break something else. I was also hoping maybe someone would take it and see some other improvements to be made. Oh well.

If I have any more problems, guess I'll bump the thread with my question. : ]

EDIT: Okay, things seem to be working okay. The walker is mountable and all, but I think there's a problem with collision -- every once in a while the walker stops abruptly, as though it's walked into something, and I'm fairly sure that it's colliding with the player that's piloting it. I'll have a go at fixing it myself, but some help would be appreciated.

EDIT2: Added some enablecollision/disablecollision calls, and things are working alright now. Still needs some polishing here and there, but it's mostly in script. :]