Standard vehicle controls in an RTS?
by Mike Berg · in RTS Starter Kit · 11/19/2004 (11:11 am) · 8 replies
Sorry if the answer to this is obvious... I'm still new at this.
I'm just wondering if it's possible to have a unit that is a standard vehicle, that you can control with the keyboard (accelerate, turn, etc) rather than click-n-move control. Also, to have this vehicle coincide with other rts units that *are* controlled with click-n-move.
I'm just wondering if it's possible to have a unit that is a standard vehicle, that you can control with the keyboard (accelerate, turn, etc) rather than click-n-move control. Also, to have this vehicle coincide with other rts units that *are* controlled with click-n-move.
#2
The physics and controls required for my vehicle *are* quite simple, much more simple even than the basic "racing" sample.
I'm super excited about this RTS pack, and really hoping I can get my game off the ground. Seeing as I'm not really a programmer, I may be relying on these forums quite a bit... so far the responses have been great. I've also got the "3D Game Programming All-in-One", which is helping. So this is a true test of Torque... If *I* can make a game with it, *anyone* can!
11/19/2004 (12:08 pm)
Thanks, that sounds great. Yeah, it looks like I'll need to do custom class for it, which should be ok (not that I've done it before, but here's hoping). The physics and controls required for my vehicle *are* quite simple, much more simple even than the basic "racing" sample.
I'm super excited about this RTS pack, and really hoping I can get my game off the ground. Seeing as I'm not really a programmer, I may be relying on these forums quite a bit... so far the responses have been great. I've also got the "3D Game Programming All-in-One", which is helping. So this is a true test of Torque... If *I* can make a game with it, *anyone* can!
#3
To create a new type of unit that exists in the RTS game, can I just duplicate the "rifleman.cs" file (for example) and somehow add in some of the information from the "car.cs" file from "starter.racing"?
If so, how do I go about doing that?
Where would I put the keybindings for controlling the car in my RTS game? (given the assumption that each player will only have ONE vehicle that they can control with the keyboard)
Are there other elements that I would need to plug into the RTS scripts to make this work out?
01/13/2005 (2:10 pm)
Ok... starting to look through this again and i think I need a few more details...To create a new type of unit that exists in the RTS game, can I just duplicate the "rifleman.cs" file (for example) and somehow add in some of the information from the "car.cs" file from "starter.racing"?
If so, how do I go about doing that?
Where would I put the keybindings for controlling the car in my RTS game? (given the assumption that each player will only have ONE vehicle that they can control with the keyboard)
Are there other elements that I would need to plug into the RTS scripts to make this work out?
#4
If you want just a little tank or something that you control like a normal unit, the only thing you need to change is the art.
If you want to make the tank move or control differently than normal units, then you'll want to go into the C++ source code, derive a new class from RTSUnit, and set-up your control scheme there.
That might be a little over your head... so, for now, while you're learning, you might want to focus on a different area of the project. Maybe get your art in for now and use the standard control scheme for a while?
Also, you mention that each player will have one vehicle they can control at a time... so, is it supposed to be a unit, or is it something else? I guess, in order to do the best job answering your question, we'd need to know more about what kind of design you have and what you're trying to do. :)
01/14/2005 (4:23 am)
Mike, no you can't do it like you describe above. If you want just a little tank or something that you control like a normal unit, the only thing you need to change is the art.
If you want to make the tank move or control differently than normal units, then you'll want to go into the C++ source code, derive a new class from RTSUnit, and set-up your control scheme there.
That might be a little over your head... so, for now, while you're learning, you might want to focus on a different area of the project. Maybe get your art in for now and use the standard control scheme for a while?
Also, you mention that each player will have one vehicle they can control at a time... so, is it supposed to be a unit, or is it something else? I guess, in order to do the best job answering your question, we'd need to know more about what kind of design you have and what you're trying to do. :)
#5
A multiplayer overhead tank game (think old Atari "Tanks") with some extra RTS elements like being able to collect basic resources, build things, get upgrades, etc.
Each tank will also have a mini "remote-controlled" vehicle that can be sent out of the tank itself to gather resources, build things, etc. This RCV will be controlled like an RTSUnit, the tank would be controlled with the keyboard.
Make sense?
01/14/2005 (7:16 am)
Here's the basic idea:A multiplayer overhead tank game (think old Atari "Tanks") with some extra RTS elements like being able to collect basic resources, build things, get upgrades, etc.
Each tank will also have a mini "remote-controlled" vehicle that can be sent out of the tank itself to gather resources, build things, etc. This RCV will be controlled like an RTSUnit, the tank would be controlled with the keyboard.
Make sense?
#6
Can I somehow merge in parts of "engine/game/vehicles/vehicle.cc" into a duplicate of "engine/game/RTS/RTSUnit.cc"? Or can I simply add a copy of vehicle.cc into the RTS folder, and tie it in to create my tank?
A friend of mine is an experienced programmer, so I might be able to get him to help me with this, but I want to be able to point him in the right general direction.
Also, if I create that new class, where do I hook that in so that the new class loads when the game launches? Or am I getting ahead of myself?
01/14/2005 (7:25 am)
Looking at the C++ code for the RTSUnit...Can I somehow merge in parts of "engine/game/vehicles/vehicle.cc" into a duplicate of "engine/game/RTS/RTSUnit.cc"? Or can I simply add a copy of vehicle.cc into the RTS folder, and tie it in to create my tank?
A friend of mine is an experienced programmer, so I might be able to get him to help me with this, but I want to be able to point him in the right general direction.
Also, if I create that new class, where do I hook that in so that the new class loads when the game launches? Or am I getting ahead of myself?
#7
1) Handle the "normal" RTS input style, for your "rc" vehicle, plus being able to move around the map in RTS mode.
2) Handle the direct vehicle user inputs ala stock TGE "vehicles", or some reasonable version thereof.
This will involve:
Porting over some version of the vehicle class from stock TGE, including:
--input controls
--possibly some network updates. Current RTS SK doesn't even have the stock vehicle classes, so if course it isn't going to have the network update stuff either.
--alternate camera modes. the advanced Camera resource might be good place to start with that.
--some form of physics to handle tank movement. You mentioned it will be very basic, but you still need to define, and then implement it (or at least modify the stock 1.3 code)
Having some way for the player to "mode switch" from the RTS style input controls to the tank input controls.
--not horribly difficult, but you'll want a good design instead of "trial and error" to get it worked out.
That's the pessimistic perspective!
I think, with a little design work, you could "fake" a real directly controlled tank using the basic RTSUnit stuff. All you really need to do to meet the minimalistic requirements you've described is the ability to integrate "WASD" style movement into the tank itself. This could even be done in script, you just need to define what one movement input will translate to coordinate wise, calculate the new target position the tank unit should move to based on that input, and then issue a movement command with the calculated coordinates. The rest of the stock RTS SK code should handle things I think.
It would take some tweaking, as well as a bit of research, but I think you could at least get a prototype version working with your skill set, and a lot of effort!
01/14/2005 (7:35 am)
You are going to need to have two input modes basically: 1) Handle the "normal" RTS input style, for your "rc" vehicle, plus being able to move around the map in RTS mode.
2) Handle the direct vehicle user inputs ala stock TGE "vehicles", or some reasonable version thereof.
This will involve:
Porting over some version of the vehicle class from stock TGE, including:
--input controls
--possibly some network updates. Current RTS SK doesn't even have the stock vehicle classes, so if course it isn't going to have the network update stuff either.
--alternate camera modes. the advanced Camera resource might be good place to start with that.
--some form of physics to handle tank movement. You mentioned it will be very basic, but you still need to define, and then implement it (or at least modify the stock 1.3 code)
Having some way for the player to "mode switch" from the RTS style input controls to the tank input controls.
--not horribly difficult, but you'll want a good design instead of "trial and error" to get it worked out.
That's the pessimistic perspective!
I think, with a little design work, you could "fake" a real directly controlled tank using the basic RTSUnit stuff. All you really need to do to meet the minimalistic requirements you've described is the ability to integrate "WASD" style movement into the tank itself. This could even be done in script, you just need to define what one movement input will translate to coordinate wise, calculate the new target position the tank unit should move to based on that input, and then issue a movement command with the calculated coordinates. The rest of the stock RTS SK code should handle things I think.
It would take some tweaking, as well as a bit of research, but I think you could at least get a prototype version working with your skill set, and a lot of effort!
#8
- Input controls: which file do I need to move/change for this? Is it in the C++ or in script?
- Alternate camera modes: I'd like to keep the camera as it is, except for the fact that I want it to track the tank (always be directly over it).
- The physics for the tank will be pretty simple, so I'm hoping to just trim down the existing vehicle code. I still want it to really feel like a vehicle, so I don't think I'd want to tweak the RTS Unit as you mentioned.
- Mode Switch: Actually, it's pretty important to me that the player be able to control the tank (WASD) and control the RCV (mouse) simultaneously... Do you think that will be a problem?
As you can see, I am VERY green at this, so bear with me, and thanks SO MUCH for any help offered.
01/14/2005 (8:52 am)
OK, quick questions:- Input controls: which file do I need to move/change for this? Is it in the C++ or in script?
- Alternate camera modes: I'd like to keep the camera as it is, except for the fact that I want it to track the tank (always be directly over it).
- The physics for the tank will be pretty simple, so I'm hoping to just trim down the existing vehicle code. I still want it to really feel like a vehicle, so I don't think I'd want to tweak the RTS Unit as you mentioned.
- Mode Switch: Actually, it's pretty important to me that the player be able to control the tank (WASD) and control the RCV (mouse) simultaneously... Do you think that will be a problem?
As you can see, I am VERY green at this, so bear with me, and thanks SO MUCH for any help offered.
Torque Owner Josh Williams
Default Studio Name
You would probably want to derive a new class from RTSUnit and implement your control logic in there. You can look at the standard Vehicle class' physics code for some guidance, though I'm sure you'd want to strip it down and simplify in many ways.
This answer is rather short and probably not that helpful as-is, sorry that I'm too busy to go into a lot of depth. But at least you should have a feel for the fact that it's possible. :)