Creating a "CLASS" (not a programmer)
by Infinitum3D · in Torque Game Engine · 06/20/2008 (9:56 am) · 3 replies
Disclaimer: I am NOT a programmer :)
If I understand it correctly, the previous code uses the PlayerBody function from Player.cs. Right?
So, I could create my own Class like this;
Is that correct, or are Classes hard-coded in the engine (.cc files)?
I guess my question is, can you script Classes or do you have to place them in the engine.
Again, I'm not a programmer :)
Thanks!
~Tony
ps. The reason I ask is because I'd like to have quadripeds with different capabilities than bipeds, and I don't want everything to rely on player.cs. I'm not sure why, but in my mind, these things should be separate.
What is the correct protocol, from a programmers stand-point. Is one way better than another, either affecting performance or readability? Thanks!
datablock PlayerData(aiOrc : PlayerBody)
{
shapeFile = "~/data/shapes/Orc/Orc.dts";
};If I understand it correctly, the previous code uses the PlayerBody function from Player.cs. Right?
datablock PlayerData(PlayerBody)
So, I could create my own Class like this;
datablock PlayerData(aiRat)
{
className = Rat;
shapeFile = "~/data/shapes/Rat/Rat.dts";
};Is that correct, or are Classes hard-coded in the engine (.cc files)?
I guess my question is, can you script Classes or do you have to place them in the engine.
Again, I'm not a programmer :)
Thanks!
~Tony
ps. The reason I ask is because I'd like to have quadripeds with different capabilities than bipeds, and I don't want everything to rely on player.cs. I'm not sure why, but in my mind, these things should be separate.
What is the correct protocol, from a programmers stand-point. Is one way better than another, either affecting performance or readability? Thanks!
#2
Thanks!
So by creating a new class, I have to re-create all the functionality. Is it as simple as copying the player.cs and renaming player as rat? Or is the Player functionality hard-coded in the engine, in player.cc?
Would I have to go into the engine and make copies of player.cc named rat.cc and elf.cc and goblin.cc, etc, and then go into each .cc file and change all the references to player for each of the other things, recompile, etc...?
Tony
06/20/2008 (10:39 am)
Mark,Thanks!
So by creating a new class, I have to re-create all the functionality. Is it as simple as copying the player.cs and renaming player as rat? Or is the Player functionality hard-coded in the engine, in player.cc?
Would I have to go into the engine and make copies of player.cc named rat.cc and elf.cc and goblin.cc, etc, and then go into each .cc file and change all the references to player for each of the other things, recompile, etc...?
Tony
#3
06/20/2008 (10:51 am)
Well, first I would try just defining a new PlayerData datablock for your rat, just like you have. There are a bunch of fields that can be filled out for PlayerData and Player that will give you some different behaviour out of the new character. Only if you need something RADICALLY different in behaviour would I go the route of creating an entirely new class. Plus, there is related code scattered all over the engine that would need to be updated to handle your newly created engine class if you went that route. So, I would hold off on that until you know for sure what you need.
Torque 3D Owner Mark Dynna