Author Topic: FS RTS Mod  (Read 57907 times)

0 Members and 1 Guest are viewing this topic.

Woot, awesome. 

 
An idea that just hit me looking at the pictures: could this be... modified to script battles in-game for mission FREDing? It could make a fantastic starting point for a FRED3... ¬‿¬

 Regardless, fantastic work so far! :nod:
This would make some great tools to work with- it would be a lot easier to set up battles with elaborate sequences by setting up a multitude of orders ships would follow, by simply clicking around the 3D window.
'Teeth of the Tiger' - campaign in the making
Story, Ships, Weapons, Project Leader.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
I don't think that's true. I think that would actually probably make things even harder unless those orders were exposed to events somehow.

 
A recorded set of orders could be activated with a LUA function call in a FRED event and if the FREDer knows what may happen checks like are-waypoints-done-delay or is-destroyed-delay can be used to base events on the ships actions. Also there are some features that might be useful like formations, where waypoints are automatically placed around mouse-selected target points in a way that ships will keep their distance and orientation relative to each other when following the path.
In the end I guess doing it the old fashioned way in FRED is faster and easier to use unless you want a huge amount of different (or rather long) sequences and potentially a script to manage their execution. Currently the script isn't capable to do any recording or whatever else is required to create missions with it.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline iVoid

  • 26
Woah... Amazing. I can totally imagine this mod being the herald for a completely new breed of freespace mods. Not only that but even people who don't like RTS's that much might want to try this out to improve situational awareness and tactics during missions. Hats off to you sir!

 
Since some of you are primarily interested in the capship AI section of the script I would like to know what you think about this in general.
What do you expect such a script to do? Not only "well it should make capships attack properly somehow" but more specific. For example: How do you think a smaller ship should attack a larger one (like cruiser/corvette attacks a destroyer) and what's different if the large ship is moving or not? How do you think the script should be controlled by a FREDer and with which options?

Woah... Amazing. I can totally imagine this mod being the herald for a completely new breed of freespace mods. Not only that but even people who don't like RTS's that much might want to try this out to improve situational awareness and tactics during missions. Hats off to you sir!
Managing a large fleet with the mod is somewhat difficult cause Freespace has many options you could use and a true 3D movement most RTS games lack. The best way to use this are tactical deployments of smaller forces where exact positioning, correct order queues and a good tactical overview of all ships in the area are important.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 
Since some of you are primarily interested in the capship AI section of the script I would like to know what you think about this in general.
What do you expect such a script to do? Not only "well it should make capships attack properly somehow" but more specific. For example: How do you think a smaller ship should attack a larger one (like cruiser/corvette attacks a destroyer) and what's different if the large ship is moving or not? How do you think the script should be controlled by a FREDer and with which options?

A couple of basics would be engagement range/behavior settings, with defaults set based on configs (configs should specify default range/behavior, a and an engagement vector (broadside=1,0,0, forward=0,0,1).  So like, a button to attack from long/medium/short range (with user defined range values for each?), and a button toggling between direct assault, flanking, circlestrafe, etc maneuvers.   A parameter to specify whether ships should strafe, maintaining orientation relative to target, or travel forwards would be good. 
Additionally, setting aggressiveness (whether ships should actively pursue new targets/hold position/hold fire) would be a good control for all craft. 

Another control would be setting PD turret behavior (prioritize strikecraft, prioritize bombs, augment main turrets (potentially targetting enemy subsystems?). 

Finally, a control to select between missile loadouts (like in that one WiH Tenbara mission) would be good. 

As far as FRED control, I think a main function with various parameters (AttackShip(ControlShip, TargetShip, Range, Behavior)) would be nice, as well as functions to change individual parameters (ChangeRange(ControlShip, Range)). 

Ship grouping could be taken into account as well (whether ships should cluster together, spread apart, not care). 

A general attack order could also have a ship focusing on taking down a specific chain of subsystems? (Main guns, then weapons engines, then engines?)

For carriers, a series of "strikecraft attack" buttons would be cool (ie, capital ship selected, use the fighter attack command on an enemy convoy, capital ship deploys fighters with attack orders on convoy.  Of course, this would require carriers to keep track of the fighters it holds. 

These are all rather high level functions, but I think they'd greatly enhance the RTS experience, and would probably make fredding easier as well. 

 
A couple of basics would be engagement range/behavior settings, with defaults set based on configs (configs should specify default range/behavior, a and an engagement vector (broadside=1,0,0, forward=0,0,1).  So like, a button to attack from long/medium/short range (with user defined range values for each?), and a button toggling between direct assault, flanking, circlestrafe, etc maneuvers.   A parameter to specify whether ships should strafe, maintaining orientation relative to target, or travel forwards would be good.
I'm aiming to get all of these automated and that's why I'm asking what ships should do. There are some people who want the capship ai section as standalone so they are down to FRED options and automatic behaviour. Basically knowing and seeing at which range and what angle a ship with nonstandard weaponry and some turrets destroyed can bring most firepower to bear (as in damage per second) is impossible in most cases. The script has to do the math and set up the attack accordingly. On the other hand moving around when below max attack range is not necessary because movement reduces accuracy of weapon fire. Also attacking only one side of the enemy gives you the chance to knock out all turrets on that side. You don't want to fly on the other side where loaded beam turrets await your ships. The exception would be BP style torpedo frigates that can run away from a target to keep it out of range while still firing at it - that's something the script can't handle yet.


Quote
Additionally, setting aggressiveness (whether ships should actively pursue new targets/hold position/hold fire) would be a good control for all craft. 
This is complicated and not yet implemented but I plan to add some simple setting that allows ships to pursue hostiles within a certain range without specific orders.

Quote
Another control would be setting PD turret behavior (prioritize strikecraft, prioritize bombs, augment main turrets (potentially targetting enemy subsystems?). 
Currently only the primary anti cap weapons that can hit the target are set to attack it while the others are firing free with the usual priority list (bombs > strikecraft > capships).

Quote
Finally, a control to select between missile loadouts (like in that one WiH Tenbara mission) would be good. 
I have no idea how to add that to the interface. I can't just add dozens of pop-up windows :D.

Quote
As far as FRED control, I think a main function with various parameters (AttackShip(ControlShip, TargetShip, Range, Behavior)) would be nice, as well as functions to change individual parameters (ChangeRange(ControlShip, Range)). 

Ship grouping could be taken into account as well (whether ships should cluster together, spread apart, not care). 

A general attack order could also have a ship focusing on taking down a specific chain of subsystems? (Main guns, then weapons engines, then engines?)

For carriers, a series of "strikecraft attack" buttons would be cool (ie, capital ship selected, use the fighter attack command on an enemy convoy, capital ship deploys fighters with attack orders on convoy.  Of course, this would require carriers to keep track of the fighters it holds. 

These are all rather high level functions, but I think they'd greatly enhance the RTS experience, and would probably make fredding easier as well. 
noted  :)
Attacking specific subsystems is a problem because subsystems can't be specified as turret targets. A script needs to do everything itself down to turret rotation unless we get a nice fireTurret sexp or scripting function...
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 
I'm aiming to get all of these automated and that's why I'm asking what ships should do. There are some people who want the capship ai section as standalone so they are down to FRED options and automatic behaviour. Basically knowing and seeing at which range and what angle a ship with nonstandard weaponry and some turrets destroyed can bring most firepower to bear (as in damage per second) is impossible in most cases. The script has to do the math and set up the attack accordingly. On the other hand moving around when below max attack range is not necessary because movement reduces accuracy of weapon fire. Also attacking only one side of the enemy gives you the chance to knock out all turrets on that side. You don't want to fly on the other side where loaded beam turrets await your ships. The exception would be BP style torpedo frigates that can run away from a target to keep it out of range while still firing at it - that's something the script can't handle yet.

I think some behavior to maneuver a ship will be good (small cruiser omgstrafes to get out of way of giant destroyer fixed forward facing wave motion gun, for example), dependent on ship type/size. 

I think 3 basic maneuver styles would work -

static (broadside/forward facing),

skirmisher (aims to stay at max usable weapon range (which would have to be modder defined, because a missile's max theoretical range isn't necessarily its max effective range, and flank/stay out of way of opponent's main gun vector),

and knife fighter (afterburn to weakly defended point of enemy ship and try to stay in blind spot.  A nice special maneuvering style could be "escort", where the ship maneuvers to keep itself between its target and its escort. 

As far as automatically determining optimal attack vector, I guess this could be done by picking a vector with optimal fof overlap of main guns and forward speed, which would be recalculated every time a main gun were destroyed.  I'm not sure how you'd do this in a non bruteforce way though..

Quote
I have no idea how to add that to the interface. I can't just add dozens of pop-up windows :D.
If we're talking the RTS interface, a simple toggle button in the bottom palette when the ship is selected could work.  I don't think this would be necessary in first person mode. 

Quote
noted  :)
Attacking specific subsystems is a problem because subsystems can't be specified as turret targets. A script needs to do everything itself down to turret rotation unless we get a nice fireTurret sexp or scripting function...
Iirc there is a turret.fireWeapon function, but that would probably be a pain to code/performance hit, and it'd probably be better in the long run if subsystems as turret targets were a codeside feature. 
« Last Edit: May 07, 2013, 09:45:09 pm by BlasterNT »

 
I don't know if these questions are dumb or not, but i have to know...
Will it be possible to jump into first-person-mode of fighters/capital ships from the RTS-interface? (Like in the game Machines™)
And...
Can other players (joining over Multiplayer) get control of ships while someone is directing the mission?
That would be my icing on the cake, if that would be possible. :D

P.S. I cannot wait for the release  :)

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
The latter is possible and already done by BP multi.

  
I think some behavior to maneuver a ship will be good (small cruiser omgstrafes to get out of way of giant destroyer fixed forward facing wave motion gun, for example), dependent on ship type/size. 

I think 3 basic maneuver styles would work -

static (broadside/forward facing),

skirmisher (aims to stay at max usable weapon range (which would have to be modder defined, because a missile's max theoretical range isn't necessarily its max effective range, and flank/stay out of way of opponent's main gun vector),

and knife fighter (afterburn to weakly defended point of enemy ship and try to stay in blind spot.  A nice special maneuvering style could be "escort", where the ship maneuvers to keep itself between its target and its escort. 
Here we are getting to another problem: Blind spot, main attack direction. This is easy said but really complicated to implement. How do I know that the engine section of my rather long cruiser isn't still sitting in the firing angle of the big guns while the main body is near the blind spot? What do you do when the enemy capship can rotate faster than you can fly around it (assuming both use the AI)? How do you even determine the sizes and velocities required for a certain maneuver to succeed? A blind spot depends heavily on both ships involved and their current state (like which turrets are still working) and using tabled values and forced settings for ship behaviour is likely to make this even more complicated as it may exclude the best (or only) option. What do we do when all primary anti cap guns are down but the smaller ones are still working?
Last but most important you have to break it all down to mathematical formulations. I'm not that good at vector math and you already figured where the next problem is when you know what to do:
Quote
As far as automatically determining optimal attack vector, I guess this could be done by picking a vector with optimal fof overlap of main guns and forward speed, which would be recalculated every time a main gun were destroyed.  I'm not sure how you'd do this in a non bruteforce way though..
I don't know how to determine an optimal vector only based on turret FOVs, positions and directions. Even if I did it would still be a bruteforce calculation. The current way is based on fixed directions and FOV/range checks for each of them which is also a bruteforce approach. Using it more often than once every few seconds would drop FPS to unplayable values.

Quote
If we're talking the RTS interface, a simple toggle button in the bottom palette when the ship is selected could work.  I don't think this would be necessary in first person mode. 
Now let's imagine a ship with like 10 missile turrets where some use different missiles or can not switch to all avilable missiles and there is still a hostile cap sitting in front of you so you don't want to switch all of them at the same time to anti fighter missiles. I would rather not add this at all than add a half assed feature.

Quote
Iirc there is a turret.fireWeapon function, but that would probably be a pain to code/performance hit, and it'd probably be better in the long run if subsystems as turret targets were a codeside feature. 
I'll probably code this at some point...


I don't know if these questions are dumb or not, but i have to know...
Will it be possible to jump into first-person-mode of fighters/capital ships from the RTS-interface? (Like in the game Machines™)
And...
Can other players (joining over Multiplayer) get control of ships while someone is directing the mission?
That would be my icing on the cake, if that would be possible. :D

P.S. I cannot wait for the release  :)
You can only jump into your own ship and back to the RTS-interface. The game doesn't support control of other ships besides your own.
Multiplayer: Probably, unless the script brakes something that was still working in the old version BP multi used.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 
Very interesting, and extremely impressive - making an RTS out of a flight sim...

Love how creative this community gets with an old but still incredibly awesome game

 
Small status update:
After coding the relevant scripting functions (that hopefully will become part of post 3.7 builds) the RTS script is now able to read and process (nearly) any type of ship goal or order.
It doesn't matter if the ai goal/order is given in RTS mode with the mouse, as part of a FRED event or by the player using the comm menu. Generally all orders but the currently active one will be removed from the internal queue of FSO and handled by the script. With this any active or queued orders can be displayed and it allows the capship ai section to replace an ai-chase order and do it's own attack logic instead.
My extented ai afterburner use patch will also be supported so fighters can fly waypoints with afterburners if enabled by the player.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 

Offline mralexs

  • 26
  • I'm White and Nerdy
Just a question, will each individual ship type have its own unit lines? kinda like "Orion Reporting" for an Orion

 
I think that this is a good chance to revive the multiplayer. We could play battles in which some people fly fighters and fight in 1st  person and some others act as task force commander, admiral etc, while plying the game like in eve-online or something like that. Would be the best of both worlds!

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
We've tried that out. Unfortunately the netcode and host issues are still going to be there.

 

Offline iVoid

  • 26
I don't know if these questions are dumb or not, but i have to know...
Will it be possible to jump into first-person-mode of fighters/capital ships from the RTS-interface? (Like in the game Machines™)
And...
Can other players (joining over Multiplayer) get control of ships while someone is directing the mission?
That would be my icing on the cake, if that would be possible. :D

P.S. I cannot wait for the release  :)
I second this! That would be unbelievably cool... Reminds me of Urban Assault (an old and little known game that I enjoyed quite a lot when I was a kid).
You can only jump into your own ship and back to the RTS-interface. The game doesn't support control of other ships besides your own.
Multiplayer: Probably, unless the script brakes something that was still working in the old version BP multi used.
That's a perfectly good design decision, but I still hope later on you will allow others to create new mods with those features based on some of your work...

 

Offline T-Man

  • 210
  • I came... I saw... I had a cuppa!
While trying to add another feature some months ago I figured that things are getting too complicated and that I have to rewrite most of the script. It took some time but it's done and I went back to adding things.
The main new feature is a scripted capship AI. It makes sure a capship attacking another one will fly into weapons range and rotate in a way to get as much firepower as possible onto the enemy (instead of stupid circling around them :banghead:).
Today I also got the target menu working that enables selecting subsystems or turrets as attack targets. Having extra buttons for disable/disarm/ignore was a mess and I moved them into the target menu as well.
An order queue (in this case movement -> destroy two turrets -> guard)
and support for creating waypoint paths. Additional points can be added while a ship is already flying the path.
All of these are bloody impressive I gotta say Admiral (especially the new cap ship behaviour); your clearly a darn good coder! I could never had imagined these would ever make it into Freespace, let alone a full blown RTS system. Be proud man; far as I'm concerned you've earned bragging rights! :lol:

So what kind of controls or ship orders would you like to see in the mod? What other functions do you think might be good in there?
A couple of thoughts;

Would it be feasible for your menu you made for targeting enemy turrets to be adapted to allow you to select and order turrets on friendly ships when you use the menu on them? So you could potentially split a ship's turrets between different targets simultaneously? For larger ships (especially beam-heavy ones like the Orion or Colossus) I feel this would be an amazingly useful feature for getting the most out of them.

An ability for scripters to easily add custom commands on certain ships to menus might come in handy if groups like BP wanted to code in the special abilities their ships demonstrate in capship missions, or modders wanted some of a ship's weapons to fire only on command.

Finally an interesting ability might be a "move-while-engaging" movement like in HW where the ship will keep itself facing the target (or in it's 'most firepower' angle to the target) as you order it to move around, which might benefit ships like the Narayana that rely on specific guns facing the target.

Regardless, stunning work mate. :D
Also goes by 'Murasaki-Tatsu' outside of Hard-Light

UEF fanboy. Rabid Imagination.

 
Will it be possible to jump into first-person-mode of fighters/capital ships from the RTS-interface? (Like in the game Machines™)
You can only jump into your own ship and back to the RTS-interface. The game doesn't support control of other ships besides your own.
Contrary to my statement I'm now trying to implement a way for the player to switch into any fighter/bomber he wants. Current state is that the game is crashing when I try to use it (even if it's only my own ship) :lol:
Switching is now working. There are still a few bugs but nothing I shouldn't be able to fix.

A couple of thoughts;

Would it be feasible for your menu you made for targeting enemy turrets to be adapted to allow you to select and order turrets on friendly ships when you use the menu on them? So you could potentially split a ship's turrets between different targets simultaneously? For larger ships (especially beam-heavy ones like the Orion or Colossus) I feel this would be an amazingly useful feature for getting the most out of them.
Possibly as an attack menu for hostile large ships (when only one friendly large ship has been selected) where you can choose the turrets locked at this target. This would require another menu and new buttons.
Quote
An ability for scripters to easily add custom commands on certain ships to menus might come in handy if groups like BP wanted to code in the special abilities their ships demonstrate in capship missions, or modders wanted some of a ship's weapons to fire only on command.
Buttons/menus are one of two things that are class based in the script. So a scripter can use the base class or any dervied one and modify it. Things get complicated when figuring out how to interact with the rest of the script.
Two examples of how button code can look like:
Code: [Select]
-- lock-weapons
RTS.io.AB.lockweapons = class(RTS.io.abutton)
RTS.io.AB.lockweapons.text = "lock-weapons"
RTS.io.AB.lockweapons.image = "lockwep"
function RTS.io.AB.lockweapons:action()
local slist = self.slist
local num = #slist
if self.state == "active" then
for i=1,num do
local ship = slist[i]
local shipname = ship.Name
mn.runSEXP("beam-free-all !"..shipname.."!")
mn.runSEXP("turrets-free-all !"..shipname.."!")
local meta = RTS.meta:get_meta(slist[i])
meta.lockedweapons = false
end
self.state = "over"
else
for i=1,num do
local ship = slist[i]
local shipname = ship.Name
mn.runSEXP("beam-lock-all !"..shipname.."!")
mn.runSEXP("turrets-lock-all !"..shipname.."!")
local meta = RTS.meta:get_meta(slist[i])
meta.lockedweapons = true
end
self.state = "active"
end
end
function RTS.io.AB.lockweapons:update()
local slist = self.list.slists.all
local num = #slist
self.slist = {}
self.state = "default"
self.usable = false
if num > 0 then
for i=1,num do
local meta = RTS.meta:get_meta(slist[i])
if meta.class.large and not meta.weaponslock then
self.slist[#self.slist + 1] = slist[i]
if meta.lockedweapons then
self.state = "active"
end
end
end
if #self.slist > 0 then
self.usable = true
end
end
end

Code: [Select]
-- attack, disarm, disable, ignore, attack-wing
RTS.io.AB.standard = class(RTS.io.rcmbutton)
function RTS.io.AB.standard:init(btype,order)
self:setname(order)
self.order = order
self.colors = {}
if order == "ignore" then
self.colors.active = {30,144,255,250}
self.colors.pressed = {30,144,255,250}
self.colors.over = {30,134,235,240}
self.colors.default = {25,115,205,220}
else
self.colors.active = {255, 120, 120,250}
self.colors.pressed = {255, 120, 120,250}
self.colors.over = {240, 110, 110,240}
self.colors.default = {210, 80, 80,220}
end
self.images = {}
self.images.mode = 2
self.images.default = MiscImg.Field_Default
end
function RTS.io.AB.standard:action()
local slist = self.list.slists.a
local num = #slist
for i=1,num do
local meta = RTS.meta:get_meta(slist[i])
local orderpos = 0
if RTS.io.keys.state.X then
orderpos = meta:find_next_free_order()
end
meta:add_order(orderpos,self.order,self.list.ship)
end
self.list:close()
end
Quote
Finally an interesting ability might be a "move-while-engaging" movement like in HW where the ship will keep itself facing the target (or in it's 'most firepower' angle to the target) as you order it to move around, which might benefit ships like the Narayana that rely on specific guns facing the target.
Sounds easy but is really hard when you need to get the math right. I want to add this since half a year...
« Last Edit: June 27, 2013, 07:19:49 am by Admiral MS »
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script