Torque 3D 1.2 RTS Prototype - suggestions please.
by Richard Ranft · in Torque 3D Professional · 05/17/2012 (11:40 am) · 56 replies
I am reviewing and revising this document and I would appreciate any input that any of you have on the topic.
In order to bring it more in line with the FPS Tutorial I am adding some additional clarification to file locations and multi-step processes, but I have been wanting to bring this up to speed with full functionality in multiplayer as well in both hosted and dedicated server modes.
Thanks everyone!
In order to bring it more in line with the FPS Tutorial I am adding some additional clarification to file locations and multi-step processes, but I have been wanting to bring this up to speed with full functionality in multiplayer as well in both hosted and dedicated server modes.
Thanks everyone!
About the author
I was a soldier, then a computer technician, an electrician, a technical writer, game programmer, and now software test/tools developer. I've been a hobbyist programmer since the age of 13.
#42
in Play Gui
function PlayGui::onMouseDown(%this, %pos)
{
%pos = %point1
%point2 = Canvas.getCursorPos();
if(%point1.x > point2.x)
{
int temp = %point2.x;%point2.x = %point1.x; point1.x = temp;
}
if(%point2.y > %point1.y)
{
int temp = %point2.y;%point2.y = %point1.y; point1.y = temp;
}
RectI areaSelect = {%point1.x,%point1.y,%point2.x,%point2.y};
GFX->getDrawUtil()->drawRect(areaSelect, mProfile->mBorderColor);
}
This aint finished hang on cos i need to wait till i get home to find out how i checked for objects inside the selection rectangle
11/26/2013 (9:49 am)
ah yes an area selectionin Play Gui
function PlayGui::onMouseDown(%this, %pos)
{
%pos = %point1
%point2 = Canvas.getCursorPos();
if(%point1.x > point2.x)
{
int temp = %point2.x;%point2.x = %point1.x; point1.x = temp;
}
if(%point2.y > %point1.y)
{
int temp = %point2.y;%point2.y = %point1.y; point1.y = temp;
}
RectI areaSelect = {%point1.x,%point1.y,%point2.x,%point2.y};
GFX->getDrawUtil()->drawRect(areaSelect, mProfile->mBorderColor);
}
This aint finished hang on cos i need to wait till i get home to find out how i checked for objects inside the selection rectangle
#43
11/26/2013 (11:55 am)
o no wait, it was all done in source code aswell actually shoulda knew that, u cant call GFX->getDrawUtil from script. head must be away with it lol
#44
You could expose the drawRectangle function to script however by making it a global function.
11/26/2013 (2:30 pm)
Ya you combined C++ and TS together :PYou could expose the drawRectangle function to script however by making it a global function.
#45
A visual queue like the terrain painters circle would work wonders for you to see where your clicking not just for rift but non rift too and cause it follows along the terrain and not anywhere it's exactly what's needed :)
11/26/2013 (4:09 pm)
Actually the mouse doesn't work with the oculus rift cause of the screen area split into twoA visual queue like the terrain painters circle would work wonders for you to see where your clicking not just for rift but non rift too and cause it follows along the terrain and not anywhere it's exactly what's needed :)
#47
11/26/2013 (8:10 pm)
Yes I would use DefineEngineFunction, unless you want to use the old macro ConsoleFunction :P
#48
http://www.garagegames.com/community/forums/viewthread/131803
A good place to start - thx guys!
11/26/2013 (9:05 pm)
Looks like there's a lot of good info on DefineEngineFunction - came across this thread: http://www.garagegames.com/community/forums/viewthread/131803
A good place to start - thx guys!
#49
Where abouts u think is best to put the draw rectangle function?
GameTSCtrl? GuiTSControl?
11/26/2013 (9:35 pm)
It would be so cool if we had global functions for every gfx draw util Where abouts u think is best to put the draw rectangle function?
GameTSCtrl? GuiTSControl?
#50
{
object->drawRect(a,b,color);
}
I have this so far in GFXDrawUtil.cpp
Throws up an invalid type conversion
11/26/2013 (10:05 pm)
DefineEngineMethod(GFXDrawUtil,drawRect,void,(Point2I a,Point2I b,ColorI color),,"Draw a Rectangle" ){
object->drawRect(a,b,color);
}
I have this so far in GFXDrawUtil.cpp
Throws up an invalid type conversion
#51
{
return GFX->getDrawUtil()->drawRect(a,b,color);
}
Working example ;)
EDIT: this would be put into GameTSCtrl or GuiTSControl.cpp and also at the top of the file
#include "console/engineAPI.h"
EDIT2: also forgot to mention if they arent included already then include GFXDrawUtil.h and GFXDevice.h
11/26/2013 (10:07 pm)
DefineEngineFunction(drawRect,void,(Point2F a,Point2F b,ColorI color),,"Draw a Rectangle" ){
return GFX->getDrawUtil()->drawRect(a,b,color);
}
Working example ;)
EDIT: this would be put into GameTSCtrl or GuiTSControl.cpp and also at the top of the file
#include "console/engineAPI.h"
EDIT2: also forgot to mention if they arent included already then include GFXDrawUtil.h and GFXDevice.h
#52
As far as performance, I'd like to point out that with the method used in the AI Tutorial you can get more units "on screen" because units farther from cameras "think" less often - and it takes all player cameras into account. I was able to get 400 units in the game at one time - though admittedly they weren't fighting....
11/26/2013 (10:58 pm)
Yeah - but not "script only." But from this all you'd really need to do is create a volume in the scene aligned with the screen and deep enough to be sure you're going to actually select your objects and then do a container search for intersecting objects. I know - "all you'd need to do" right?As far as performance, I'd like to point out that with the method used in the AI Tutorial you can get more units "on screen" because units farther from cameras "think" less often - and it takes all player cameras into account. I was able to get 400 units in the game at one time - though admittedly they weren't fighting....
#53
11/26/2013 (11:16 pm)
Yea unfortunately I don't think its going to be possible to make a script only rts prototype that would make everyone out there happy cos as u can see through most of these forums people want a lot o functions pre-made that just aren't possible in script alone, and to be fair this is the way it is in a lot of engines, least torque is fairly simple to do complex operations once u figure out how it works. I know one way of increasing ai performance would be to create tile sets instead of having each ai player scan the entire terrain each update it would only scan the tile set it was in, again only possible by editing source code :-/ least I think its not possible in script, I'm no torque script pro
#54
The whole purpose of the "prototype" is to show that it is possible - not to provide Rome: Total War as a starter kit. I guess my main intent in asking for suggestions was to gain input in general, but really to see where people were having trouble with the existing exercise and then look for ways to be clearer or to streamline the scripts. I generally looked at added features as "stretch goals" and only added them if they were in easy reach of the path.
You'll note that I left AI out of it entirely....
11/28/2013 (8:08 am)
It's not possible to make anything that'll make everyone out there happy.The whole purpose of the "prototype" is to show that it is possible - not to provide Rome: Total War as a starter kit. I guess my main intent in asking for suggestions was to gain input in general, but really to see where people were having trouble with the existing exercise and then look for ways to be clearer or to streamline the scripts. I generally looked at added features as "stretch goals" and only added them if they were in easy reach of the path.
You'll note that I left AI out of it entirely....
#55
Most RTS games do have completely different ways of governing their ai,
Command and Conquer games usually use like a AI network were there would be an AI Manager - basically ai version of the player decides when to collect resources what to build, AI - Group which is an ai that takes messages from ai manager and then sends them to AI Units ur basic soldiers,tanks etc etc
Where as something like Commandos would use only the AI Unit functions, rome total war 2 (when it is fixed) is supposed to have actual navmeshs for pathfinding whereas something like command and conquer uses a grid system.
But there are core functions that all RTS games have in common and i am willing to help develop some of these if i can to help u with the rts prototype
11/28/2013 (8:16 am)
I totally agreeMost RTS games do have completely different ways of governing their ai,
Command and Conquer games usually use like a AI network were there would be an AI Manager - basically ai version of the player decides when to collect resources what to build, AI - Group which is an ai that takes messages from ai manager and then sends them to AI Units ur basic soldiers,tanks etc etc
Where as something like Commandos would use only the AI Unit functions, rome total war 2 (when it is fixed) is supposed to have actual navmeshs for pathfinding whereas something like command and conquer uses a grid system.
But there are core functions that all RTS games have in common and i am willing to help develop some of these if i can to help u with the rts prototype
#56
In fact, since mini-maps are used in many different game types their coverage should be separate from the RTS prototype anyway. Then you get a more modular set of "lessons" that you can assemble to make a whole game.
The AI Tutorial that I never finished uses the manager approach for each "team" but mainly to pass messages between member units at the moment. It is built on top of the RTS prototype, actually....
11/28/2013 (10:26 am)
This is all old news anyway - the docs are all in the git doc repo now. My main point is that it's not supposed to be complete - just a proof of concept and a path that one could take to start. I'd almost go farther and say that any additional features should simply continue from where the current article leaves off. Actually, a set of continuations that each follow a different style would be cool - one that follows for an actual RTS, one that goes into the "adventure" type (that one is there already but could probably use a little dusting off, too), one that is more hack-n-slash, etc. Each of those paths could continue farther and/or share parts as they go.In fact, since mini-maps are used in many different game types their coverage should be separate from the RTS prototype anyway. Then you get a more modular set of "lessons" that you can assemble to make a whole game.
The AI Tutorial that I never finished uses the manager approach for each "team" but mainly to pass messages between member units at the moment. It is built on top of the RTS prototype, actually....
Torque Owner Shay1
Shay1