Adding to Player class
by Dave Strock · in Torque Game Engine · 05/20/2002 (2:18 pm) · 7 replies
Hi all, I got the SDK a couple weeks ago and I'm just now starting to wrap my head around it.
I'm working on an RPG type game, and one of the first things I'm trying to do is add attributes to the player. Things like stats, as well as a leveling system and a skills system. I have most of the system working with stubs, but now I'm trying to integrate it into the torque.
So, my question is, what is the best way to add to the Player class?
I read a thread here somewhere that said subclassing Player was bad, why is that? If thats correct, does anyone have any advice on where to start with this? Maybe a resource or something that I missed?
Any advice on this topic would be great. Thanks in advance.
I'm working on an RPG type game, and one of the first things I'm trying to do is add attributes to the player. Things like stats, as well as a leveling system and a skills system. I have most of the system working with stubs, but now I'm trying to integrate it into the torque.
So, my question is, what is the best way to add to the Player class?
I read a thread here somewhere that said subclassing Player was bad, why is that? If thats correct, does anyone have any advice on where to start with this? Maybe a resource or something that I missed?
Any advice on this topic would be great. Thanks in advance.
About the author
#2
Subclassing ShapeBase instead of Player was one of the things I'd thought about. I figured I'd subclass Player, atleast first, to keep the functionality of Player that I don't want/have to reimplement.
Sounds like we are doing very much the same type of thing.
05/20/2002 (3:48 pm)
Ok, I'm thinking along the same lines as you here. I'd rather subclass it and have it be maintainable, than to hack up the Player class too much.Subclassing ShapeBase instead of Player was one of the things I'd thought about. I figured I'd subclass Player, atleast first, to keep the functionality of Player that I don't want/have to reimplement.
Sounds like we are doing very much the same type of thing.
#3
Same with ShapeBase it actually has alot of things I would think should be in Player or even farther up/down like all the muzzle calls.
Anyway good luck on which ever direction you take.
05/20/2002 (4:11 pm)
the way Player is set up right now it have lots of baggage from Tribes 2.Same with ShapeBase it actually has alot of things I would think should be in Player or even farther up/down like all the muzzle calls.
Anyway good luck on which ever direction you take.
#4
03/03/2010 (9:21 am)
anyone have a working subclassed player that they want to post?
#5
You might get more feedback by making a new thread in the engine forum that you're using (T3Dprivate).
03/03/2010 (9:42 am)
7 years, 9 months, 11 daysYou might get more feedback by making a new thread in the engine forum that you're using (T3Dprivate).
#6
03/03/2010 (9:45 am)
unnecessary post there steve
#7
03/03/2010 (2:34 pm)
Any reason why you need to subclass Player? Any particular functionality you're looking for?
Torque Owner Jarrod Roberson
Matter of fact I did EXACTLY that, I called my sub classed Player AttributedPlayer and am in the process of overriding all the methods like updateMove to use dynamic attributes, skills and what not in movement calcualtions. I am doing it as a learning exercise more than anything else, and will probably create my own Player class after this exercise is over. I am trying to make notes for a "how to subclass" tutorial when I get done with it.
If you are just doing some quick hack, trying to figure out a particular operation or don't understand OO concepts, just hack away at Player to your hearts content, but when it comes time to sync it up with the next "offical" player.h and player.cc you will probably spend 5 times more effort and time trying to merge all your changes rather then just doing the work up front.
Your other option is to just ignore Player completely and create your own Player class, sub class it from ShapeBase / GameBase or what ever you think is appropriate and have at it.