Board Game
by Ben Woodhead · in Torque Game Engine · 02/13/2004 (6:48 am) · 5 replies
Hello Everybody,
I am developing a board game using torque and I was wondering would it be a good idea to create my board in the mission editor or just load everything in the script.
Thanks, Ben
I am developing a board game using torque and I was wondering would it be a good idea to create my board in the mission editor or just load everything in the script.
Thanks, Ben
About the author
#2
The board is all seperate squares and a seperate boarder. I did it that way so I could tell what square was clicked on.
Thanks, Ben
02/13/2004 (7:53 am)
Hey, thanks dude. The board is all seperate squares and a seperate boarder. I did it that way so I could tell what square was clicked on.
Thanks, Ben
#3
The Strategem 'board' is composed of a single static surround (decoration for the actual board) and a custom object that renders not only the board surface (tesselated multi-texture) but also the cursors/markers that go onto it (with a little polygon offset added for flavour).
The custom object also handles the board content structures, path finding and collaborates with the AI for other stuff. It also decides which squares are selected and in what context so that it can render the appropriate cursors as the mouse moves, quite a complex little beast really. All this is driven by the scripts via interfaces we've setup.
The pieces on the board are rendered by a seperate object that renders all of them in one go. Piece selection is not done by the pieces themselves but by the board and uses a line/cylinder collision test. Be aware that using lots of static shapes to composite the board is going to be costly. Add to this the problem of potentially rendering lots of shapes (possibly with animation) and the problems can become huge but not insurmountable. Plenty of LOD on your pieces is a must!
There is also a custom camera that can focus on a specific board-square and can swing around this point and alter the pitch/zoom as well as smoothly interpolate between squares. You can also snapshot camera positions by using Alt-<0-9> and pressing <0-9> smoothly moves you to that position.
If you're going to do a board game then I'd recommend not using world-space coordinates as you'd normally see in the Torque examples. Use board-space and let the C++ objects convert them. This means that in the scripts you can refer to square(x,y) to pieces, camera, path-finding, AI etc and not have to do world-space conversions all over the place ... trust me.
This is alot more than you asked but it does highlight some of the features that you could possibly need e.g. piece rendering/selection, camera focus, board cursor/markers and board-coordinates.
That's it.
- Melv.
02/13/2004 (8:12 am)
Ben,The Strategem 'board' is composed of a single static surround (decoration for the actual board) and a custom object that renders not only the board surface (tesselated multi-texture) but also the cursors/markers that go onto it (with a little polygon offset added for flavour).
The custom object also handles the board content structures, path finding and collaborates with the AI for other stuff. It also decides which squares are selected and in what context so that it can render the appropriate cursors as the mouse moves, quite a complex little beast really. All this is driven by the scripts via interfaces we've setup.
The pieces on the board are rendered by a seperate object that renders all of them in one go. Piece selection is not done by the pieces themselves but by the board and uses a line/cylinder collision test. Be aware that using lots of static shapes to composite the board is going to be costly. Add to this the problem of potentially rendering lots of shapes (possibly with animation) and the problems can become huge but not insurmountable. Plenty of LOD on your pieces is a must!
There is also a custom camera that can focus on a specific board-square and can swing around this point and alter the pitch/zoom as well as smoothly interpolate between squares. You can also snapshot camera positions by using Alt-<0-9> and pressing <0-9> smoothly moves you to that position.
If you're going to do a board game then I'd recommend not using world-space coordinates as you'd normally see in the Torque examples. Use board-space and let the C++ objects convert them. This means that in the scripts you can refer to square(x,y) to pieces, camera, path-finding, AI etc and not have to do world-space conversions all over the place ... trust me.
This is alot more than you asked but it does highlight some of the features that you could possibly need e.g. piece rendering/selection, camera focus, board cursor/markers and board-coordinates.
That's it.
- Melv.
#4
But whether that works for you or not I can't say ... do you want a 3D view of the game board, or the more traditional 2D view?
In any case, what I did was create a custom GuiCtrl that just draws 2D images at various locations. It also handles mouse events to determine when the user clicks on one of those images.
Basically just looked at GuiBitmapCtrl as a starting point for how to create a control and load/draw images. Then took a look at GuiMouseEventsCtrl for how to handle mouse events.
I also went with a 'board-space' idea as Melv mentioned. So for example, I set my board size to 80x80, and then each tile is 10x10. So all input/output is in board coordinates, and the control converts that to form coordinates for drawing (and vice-versa for handling mouse events).
Anyway, it's working well for me, and isn't that hard to do. But as I said, it depends on whether you're happy with a 2D game board ...
02/13/2004 (8:45 am)
I'm still new here, but I've been working on a Checkers game (as a learning experience). Personally I just skipped the whole TS controls, world editor, 3D etc. Partly to reduce how much I had to learn right away ... but also because I really don't think I need it. Ultimately I plan to do a TBS game set in space (think Master of Orion). So all I need to do is draw a bunch of stars and ships and handle mouse events ... 3D really doesn't come into play at all.But whether that works for you or not I can't say ... do you want a 3D view of the game board, or the more traditional 2D view?
In any case, what I did was create a custom GuiCtrl that just draws 2D images at various locations. It also handles mouse events to determine when the user clicks on one of those images.
Basically just looked at GuiBitmapCtrl as a starting point for how to create a control and load/draw images. Then took a look at GuiMouseEventsCtrl for how to handle mouse events.
I also went with a 'board-space' idea as Melv mentioned. So for example, I set my board size to 80x80, and then each tile is 10x10. So all input/output is in board coordinates, and the control converts that to form coordinates for drawing (and vice-versa for handling mouse events).
Anyway, it's working well for me, and isn't that hard to do. But as I said, it depends on whether you're happy with a 2D game board ...
#5
Thanks for all the answers. Its very helpful. I am doing the board in 3d and I must say I really like the interface to Strategem.
Thanks, Ben
02/13/2004 (11:17 am)
Wow guys, Thanks for all the answers. Its very helpful. I am doing the board in 3d and I must say I really like the interface to Strategem.
Thanks, Ben
Associate Ron Yacketta
I have seen it done both ways, each can use the editor or script to place/create a board. For the novice I would stick with using the editor, this way you can see the board and move it with the gizmos etc.
Melv might have a bit more insight on this topic seeing that Stratgem (spelling could be off) is a board based game.
-Ron