Game Development Community

Can TGB have player tiles

by Jeff Beougher · in Torque Game Builder · 11/19/2007 (7:52 am) · 7 replies

I'm looking at creating a online board game that allows player to use tiles and build there own map to play on. My question is would TGB be able to do this? From what I see I could build the maps from an editor but I don't see any information if they could do it while the game is running. What I'm looking for is.

Player one: Places a random tile on the map.
Player one: Rolls a dice
Player one: Moves his token

Player Two: Places a random tile on the map.
Player Two: Rolls a dice
Player Two: Moves his token

So that the players would be creating there own map.

The other question, can TGB do 3d? I would like the tiles to be 2d but the tokens to be 3d or 2.5d

#1
11/19/2007 (7:54 am)
On the topic of 3D objects, you can load DTS objects and render them, but the lighting is very flat. There is a TDN article on 3D objects in TGB.
#2
11/19/2007 (8:08 am)
Well that's a good start, I'm not concerned with collision detection. So TGB can do 3d. Only other question is my first one. Once I know if it can then I will be purchasing TGB. Thank you for that bit of info David.

I do have one other question. How hard will it be to understand TScript? I have a fair grasp with basic and C++.
#3
11/19/2007 (9:59 am)
TorqueScript is c-styled, so you should pick it up quite quickly.

And I didn't know about creating dynamic tilemaps, so I didn't answer that one. :)
#4
11/19/2007 (10:28 am)
You can create tile maps at run-time, yes.
It's actually quite easy.
tdn.garagegames.com/wiki/TGB/Reference:_t2dTileLayer
#5
11/19/2007 (11:54 am)
So if I understand the commands correctly. It would be something like

select map tile

get players mouse posistion.

call this command

setStaticTile(%tileX, %tileY, %imageMap, [%frame])

or this one

setStaticTile(%position, %imageMap, [%frame])

Have the tiles position for x and y become the players mouse x and mouse y

is that about right?
#6
11/19/2007 (11:55 am)
Right now I'm using Dark Basic Pro. Its easy but there is alot that can not be done with DBPro and layers are one of its weakness.
#7
11/19/2007 (1:28 pm)
You have the correct concept of how to do this in TGB.

Tilelayers/maps in TGB work quite well in general.

%tileMap = %scenegraph.getGlobalTileMap(); // only one tilemap exists per scene
%tileLayer = %tileMap.getTileLayer(0);     //  but can have many layers.
%lyr.setStaticTile( ... );

// note: you must actually create and save a tilelayer in your level for this to work.
// creating a new tilelayer from script is a bit more complex.

Check out the TGB reference documentation listing of all tilelayer class member functions. To get the "clicked" on tile for instance, you will most likely use %lyr.pickTile(...).