Game Development Community

How to spawn players in Torque 3D ?

by Liew Pak San · in Torque 3D Professional · 07/13/2009 (6:24 pm) · 9 replies

I have setup spawn spheres (3-4 spheres) in my level and want players to spawn from them.
Can I accomplish this using the Torque World Editor or do I have to change codes to do it ?
Please help me out in this regard.

#1
07/13/2009 (7:29 pm)
For multiplayer (human) players, they should just spawn on a random spawnsphere - there's already a function which picks a random spawnsphere if there is more than one. (in core/scripts/server/spawn.cs I think)
So you can do that from the editor, stick in a few spawnspheres, host a multiplayer game, other players can log in and will spawn on random spheres.

Singleplayer AI spawns will require scripting, plus the AI don't really do anything, so their thought process will also require a script.

#2
07/13/2009 (8:17 pm)
Thank you for your reply. I have got the desired number of players in.
I am trying to simulate flocking behavior in Torque using a number of BoomBots.

Any suggestions or references related to this ?
#3
07/13/2009 (10:40 pm)
There are a couple of old AI resources, you could do a search but I don't remember anything about flocking.
#4
07/15/2009 (5:57 am)
I suggest to buy the book: "Programming Game AI by Example" from Mat Buckland.
#5
07/15/2009 (10:28 am)
You can also buy Advanced Game Programming All in One from Ken Finney. He has a chapter devoted to AI, and has a scripted demo of flocking behaviour. Although the book is intended for TGE, the vast majority of things shown there should still work....
#6
07/15/2009 (10:51 am)
Quote:
I am trying to simulate flocking behavior in Torque using a number of BoomBots.
Ken Finney's Advanced 3d Game Programming All-in-One covers a simple three rule based type of flocking.

  • Collision avoidance -- members of swarm avoid bumping into each other
  • Swarm centering -- members maintain position to each other with respect to the center of the swarm
  • Velocity matching -- members try and match their speed to the average of the swarm

  • There are loads and loads of AI specific programming books, I would suggest a bit of reading. Lot's of information can also be found here in the forums, but no actual swarm/flocking behavior resource (unless you count the one for particles).
    #7
    07/18/2009 (7:41 pm)
    Flocking would be a great feature for T3D. Fish, birds, maggets :)
    #8
    08/20/2009 (1:52 am)
    I found a thread mentioning the use of the AIPlayer:

    http://www.garagegames.com/community/resources/view/2215

    I tried the following codes:

    $myBot01 = aiAddPlayer("Bill Gates");
    // working - aiplayer spawn in position (0 0 0)

    $myBot01.setMoveDestination("-224.153 -166.305 214.662");
    // working - destination confirmed with "getLocation" query

    $myBot01.move();

    The AI bot did not move after the last command. I did a dump with:
    $myBot01.dump();

    and both "setMoveDestination" and "move" are valid functions for the AIPlayer class.

    I checked the C++ source for AIPlayer and the "move" did a reset of the flag for allowing the bot to move. Everythings seems ok but the bot simply cannot be moved. Any idea what's wrong?

    Any help would be greatly appreciated.

    Thanks

    P.S. I posted this question the thread mentioned above but that thread is quite dated.
    #9
    08/20/2009 (8:20 am)
    I prefer to use %local than $global. But also I don't think you need all of those quote marks "". Once you've got an AI with a name, try using the name - no spaces in the name.

    Place a marker/waypoint/something at the destination, call it a name like endpoint. Then call the marker's position, no typing lots of numbers.

    billgates.setmovedestination(endpoint.getposition());

    setmovedestination will start the bot moving, no need to use move.