Game Development Community

SetMoveDestination missing on player?

by Richard-HH · in Torque Game Engine · 12/19/2006 (5:58 am) · 13 replies

Hi everyone,

im new to TGE (V 1.5) and need to ask this, i didnt find an answer so far (yes, i did search).

Dump of my player (ive cutted some lines due to the posting length restriction):

==>1681.dump();
Member Fields:
canSaveDynamicFields = "1"
dataBlock = "PlayerBody"
nameTag = ""
position = "103.55 -533.944 20.5656"
rotation = "0 0 1 77.4759"
scale = "1 1 1"
Tagged Fields:
client = "1641"
invCrossbow = "1"
invCrossbowAmmo = "100"
invSword = "1"
mountVehicle = "1"
Methods:
isMemberOfClass() - isMemberOfClass(string classname) -- returns true if this object is a member of the specified class
isMethod() - obj.isMethod(string method name)
isMounted() - Are we mounted?
isPilot() -
kill() -
maxInventory() -
mountImage() - (ShapeBaseImageData image, int slot, bool loaded=true, string skinTag=NULL)
mountObject() - ( ShapeBase object, int slot )Mount ourselves on an object in the specified slot.
mountVehicles() -
onInventory() -
pauseThread() - (int slot)
pickup() -
playAudio() - (int slot, AudioProfile ap)
playCelAnimation() -
playDeathAnimation() -
playDeathCry() -
playPain() -
playThread() - (int slot, string sequenceName)
save() - obj.save(fileName, )
schedule() - object.schedule(time, command, );
scopeToClient() - (NetConnection %client)Cause the NetObject to be forced as scoped on the specified NetConnection.
setActionThread() - (string sequenceName, bool hold, bool fsp)
setArmThread() - (string sequenceName)
setArmThreadPlayOnce() - (string sequenceName)
SetArmThreadTransitionOnce() - (string sequenceName)
setCameraFov() - (float fov)
setCloaked() - (bool isCloaked)
setControlObject() - (ShapeBase obj)
setDamageDt() -
setDamageFlash() - (float lvl)
setDamageLevel() - (float level)
setDamageState() - (string state)
setDamageVector() - (Vector3F origin)
setDataBlock() - (DataBlock db)Assign this GameBase to use the specified datablock.
setEnergyLevel() - (float level)
setFieldValue() - obj.setFieldValue(fieldName,value);
setHidden() - (bool show)
setImageAmmo() - (int slot, bool hasAmmo)
setImageLoaded() - (int slot, bool loaded)
setImageTrigger() - (int slot, bool isTriggered)
setInternalName() - string InternalName
setInventory() -
setInvincibleMode() - (float time, float speed)
setName() - obj.setName(newName)
setRechargeRate() - (float rate)
setRepairRate() - (float amt)
setScale() - (Point3F scale)
setScopeAlways() - Always scope this object on all connections.
setShapeName() - (string tag)
setShapeServerId() - (id)
setSkinName() - (string tag)
setThreadDir() - (int slot, bool isForward)
setTransform() - (Transform T)
setVelocity() - (Vector3F vel)
setWhiteOut() - (float flashLevel)
startFade() - ( int fadeTimeMS, int fadeDelayMS, bool fadeOut )
stopAudio() - (int slot)
stopThread() - (int slot)
throw() -
throwObject() -
unmount() - Unmount from the currently mounted object if any.
unmountImage() - (int slot)
unMountObject() - (ShapeBase obj)Unmount an object from ourselves.
use() -



no "setMoveDestination" method, no "pushTask".

Am i missing something?


Just incase:
Im trying to add a "FollowTarget" functionality to the player.

Tnx !

#1
12/19/2006 (6:08 am)
The Player and the AiPlayer are different classes.


You should be dumping the methods in the AiPlayer class which is a sub class of the Player class.

:)

Aun.
#2
12/19/2006 (6:45 am)
Tnx for your quick answer AUN.

I got aware already the AI derived from player, but since im still a noob, can u explain in quick words (just as a general hint) what you mean by "dumping the methods" ?
#3
12/19/2006 (6:50 am)
He (probably) means exactly what you did with Player.
Doing a .dump of an instance of an AIPlayer.
:)
#4
12/19/2006 (6:52 am)
Ah...lol, ok :)

I did that already, the method is there...sec, brb . dumping now..

There we go:

==>1642.dump();
Member Fields:
canSaveDynamicFields = "1"
dataBlock = "FishBody"
nameTag = ""
position = "166.908 -537.635 8.74804"
rotation = "0 0 1 68.0878"
scale = "1 1 1"
Tagged Fields:
currentNode = "0"
invCrossbow = "1"
invCrossbowAmmo = "50"
invSword = "1"
mountVehicle = "1"
Path = "MissionGroup/Paths/Path1"
targetNode = "-1"
Methods:
aimAt() -
animate() -


CUT


cont....

isPilot() -
kill() -
maxInventory() -
mountImage() - (ShapeBaseImageData image, int slot, bool loaded=true, string skinTag=NULL)
mountObject() - ( ShapeBase object, int slot )Mount ourselves on an object in the specified slot.
mountVehicles() -
moveToNextNode() -
moveToNode() -
nextTask() -
onInventory() -
pauseThread() - (int slot)
pickup() -
playAudio() - (int slot, AudioProfile ap)
playCelAnimation() -
playDeathAnimation() -
playDeathCry() -
playPain() -
playThread() - (int slot, string sequenceName)
pushTask() -
save() - obj.save(fileName, )
schedule() - object.schedule(time, command, );
scopeToClient() - (NetConnection %client)Cause the NetObject to be forced as scoped on the specified NetConnection.
setActionThread() - (string sequenceName, bool hold, bool fsp)
setAimLocation() - ( Point3F target )Tells the AI to aim at the location provided.
setAimObject() - ( GameBase obj, [Point3F offset] )Sets the bot's target object. Optionally set an offset from target location.
setArmThread() - (string sequenceName)
setArmThreadPlayOnce() - (string sequenceName)
SetArmThreadTransitionOnce() - (string sequenceName)
setCameraFov() - (float fov)
setCloaked() - (bool isCloaked)
setControlObject() - (ShapeBase obj)
setDamageDt() -
setDamageFlash() - (float lvl)
setDamageLevel() - (float level)
setDamageState() - (string state)
setDamageVector() - (Vector3F origin)
setDataBlock() - (DataBlock db)Assign this GameBase to use the specified datablock.
setEnergyLevel() - (float level)
setFieldValue() - obj.setFieldValue(fieldName,value);
setHidden() - (bool show)
setImageAmmo() - (int slot, bool hasAmmo)
setImageLoaded() - (int slot, bool loaded)
setImageTrigger() - (int slot, bool isTriggered)
setInternalName() - string InternalName
setInventory() -
setInvincibleMode() - (float time, float speed)
setMoveDestination() - (Point3F goal, bool slowDown=true)Tells the AI to move to the location provided.
setMoveSpeed() - ( float speed )Sets the move speed for an AI object.
setName() - obj.setName(newName)
setRechargeRate() - (float rate)
setRepairRate() - (float amt)
setScale() - (Point3F scale)
setScopeAlways() - Always scope this object on all connections.
setShapeName() - (string tag)
setShapeServerId() - (id)
setSkinName() - (string tag)
setThreadDir() - (int slot, bool isForward)
setTransform() - (Transform T)
setVelocity() - (Vector3F vel)
setWhiteOut() - (float flashLevel)
singleShot() -
Spawn() -
spawnOnPath() -
startFade() - ( int fadeTimeMS, int fadeDelayMS, bool fadeOut )
stop() - ()Stop moving.
stopAudio() - (int slot)
stopThread() - (int slot)
throw() -
throwObject() -
unmount() - Unmount from the currently mounted object if any.
unmountImage() - (int slot)
unMountObject() - (ShapeBase obj)Unmount an object from ourselves.
use() -
wait() -
#5
12/19/2006 (7:19 am)
Uhm, the whole idea with AIPlayer is that it should be commandable. Player has a control object (client) and there is no immediate need for setMoveToDestination () there because, well, it is a player and not AI.

You following?
#6
12/19/2006 (7:28 am)
Hi Stefan,

>>and there is no immediate need

No ? .. :P

Then maybe you can hint me to the most elegant way to do a "FollowTarget" function on a player?

Imagine i press (eg.) F11 and my player should follow the current target from now on.
Im stuck here now since the setMoveDestination isnt avaiblable for the playerobject :( :(
#7
12/19/2006 (9:02 am)
It's not a general purpose function, and thus it's not available in Player. No need to bloat it. (edit: the Player class)
As for your question, I'm not sure how I would do it, but I'm pretty sure that I wouldn't do it serverside like that.
#8
12/19/2006 (9:08 am)
Hi,

i am not in the "urge" to do it serversided, honestly i dont see a need to do that serversided.

I was just moving on the serverside due to the setMoveDestination stuff, but i dont insist of the serverside :P

The problem is, that a simple "get position, move player to there" is not even a classical "follo target" function. Imagine the player moving to the target but the target is moving meantime. The snapshot of the targetposition wont update so the player is running to the "old" position where the target isnt anymore.

The classical "Follow Target" function would constantly CHASE the target (best with "hold distance" and delay parameters".

Im PRETTY surprised, Torque doesnt offer such basic/essential function.

Anyway, thank you.
#9
12/19/2006 (9:23 am)
Richard,

Just to try to clarify a bit. I think the reason the player doesn't have the method you are looking for, and AIPlayer does, is that the player is supposed to be controlled by the user of the program, and if it's always under the users control, it has no need of methods that act like the computer (AI) is controlling it.
#10
12/19/2006 (9:30 am)
Thank you for the reply Steve.

While i do understand (and agree) to playercontrolling, a "followtarget" is something not THAT unusual, depending on the game you are doing.

If you have eg. turn based melee mechanisms in your game, its very important to face the opponent in a certain degree (FOV) and keep a certain distance - the "Follow Target" function comes in very handy here.

There are a LOT of situations, where such function is more then a "nice to have".

Anyway, this topic wasnt about general gamedesign, i just wanted to know if such "helpers" are in the engine.

I'll find a way....sooner or later :P
#11
12/19/2006 (10:39 am)
Two comments:

1) You absolutely would do something like this server side. There isn't any other place to do it (properly).

2) The Player class is a reference implementation to be used as an example. It's in fact about 70% of the actual code written for the Tribes/Tribes 2 game, which is a multiplayer first person shooter, and in those games the developers/designers had no need for a "follow other player" capability, which is why it isn't in the player class.

That being said, if you look carefully at Player::processTick(), you'll notice at the very top the following:

Move aiMove;
   if (!move && isServerObject() && getAIMove(&aiMove))
      move = &aiMove;

The purpose of this code is to allow a "hook" for exactly the type of functionality you are describing.

By default, the class method Player::getAIMove() returns FALSE, which means that the "hook" isn't hooked up, but all you need to do is to write a Player::getAIMove() method that properly populates the aiMove struct, and returns TRUE, and it will do what you need.
#12
12/19/2006 (6:42 pm)
There's a resource to help with player target locking:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4077

Basically, you copy a bunch of methods from AIPlayer into Player, etc...
#13
12/20/2006 (12:00 am)
Thank you both !

Tnx Stephen for pointing me to that getAIMive, tnx Brian for the link - i already read about exactly that way to realize such function.

Im still a bit confuzzeld but i will def. reread it and go with it.

Tnx !