'Insurgency' Game balance test + help with lua.

'Insurgency' Game balance test + help with lua.

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

'Insurgency' Game balance test + help with lua.

Post by Zealot »

Hi All

Link to 'Insurgency' gameplay test. https://docs.google.com/file/d/0B4iqyZG ... sp=sharing

I am putting together a game play and balance test for the game I am working on this year. Working title 'Insurgency'. I have been using 'BA' as a placeholder and have messed with unit stats ect as I want to test out my hypothetical unit functions and how they balance off each other. (*This is not a TA mod. I am just using BA as test base as it is what I am most familiar with and I am only using it to quickly test out gameplay ideas) I thought it would be quicker for me to do this and more fun/effective for people testing it than if they were controlling hundreds of identical placeholder untextured cubes. Once I have worked out the function of each unit then I will be designing them visually to suit their gameplay function. I hope the BA crew don't mind me using their work while I do my initial testing...?


The gameplay is aimed to be an exploration of asymmetrical warfare and insurgency. Particularly focusing on the form of combat that took place in the Vietnam War while also the Iraq and Afghanistan wars (also the communist revolution in china in the 1940s). It will be potentially set in a 'future war' themed game universe. I am trying to simulate a balance between a large and powerful conventional army fighting a stealthy and mobile army.

Some of the main gameplay mechanics that I am focusing on (which differ from many current rts games) are: Stealth, scouting, longer ranged combat and battalion level artillery.

I currently have playable Infantry for the Insurgent team. It still needs some key functions to balance as planned but should be quite fun as is. I will be later adding air power, Fast attack vehicles, and Heavy Armour.

Gameplay overview.

All units are cloaked (for the Insurgency Faction). Structures and mobile factories are armoured and cannot really be hurt by non armour piercing units. All infantry have the same low health. There is a scissors, paper rock balance between the 3 light infantry units. Longer ranged units do little damage while short range units do lots. This is balanced by all units being cloaked which hampers kiting as a short range unit can sneek up unseen. So it becomes a game of cat and mouse. Support rocket and mortar units have very long reload but quite extreme range, or armour piercing rockets. (these will come into play more when armoured vehicles are introduced.) Combat engineers can heal, reclaim and capture. As structures have high health so they can be better to capture than to destroy. There are also paralyser infantry to assist this. (I will need to turn off SelfD function for structures to stop people selfDing when they are about to be captured)

There is only one resource. Called metal at this point. It costs metal to build units and to fire weapons. So make sure you save up before going into battle or you will run out of munitions part way through. More powerful weapons are balanced by unit cost and cost per shot. The tool tip displays the unit's Armour Class and Damage class. The damage per shot it does to its Damage class and the cost in metal per shot.

Ie. LR Light Infantry A1 D1-40 2mps.

It has Armour Class 1. Its damage is effective against Armour Class 1, it does 40 damage per shot. It costs 2 Metal per shot.

There are currently Armour classes 1 and 2. 1 is light armour, 2 is medium armour. Firing a weapon against a higher armour class will do around 1% damage. So use armour piercing weapons against armoured targets.

I would love to have some people help me play test and let me know what they think works and does not work.


I hope to have a slightly slower gameplay than games like BA or Startcraft. To allow more time to strategise and make it less of a click fest. Battles will take place quite quickly with the element of surprise playing a large part. This will make scouting and tactical positioning of units before the battle very important.

I know the game play will be very different from most other spring games. I have also heard people on the forums say that longer unit ranges and "epic" scale make a game less fun to play. I am hoping that the element of stealth will stop the longer ranges involved from making the game degenerate into massive amounts of 'kiting' and hopefully keep up the fun element while allowing maneuver warfare an terrain play more of a strategic part.

If some one can help show me how to set up a auto host so that people can play online then that would be amazing.

-----------------------------------

Questions / Requests for help:

Q1 Could some one help show me how to set up a auto host so people can test this?

Q2 Help with Lua and Cloak / Speed states

I would also appreciate some advice on how to implement some Lua to enable some gameplay functions I am after. I dont know how to write Lua but I am trying to learn.

I want to have a unit speed button that is tied to cloak distance by Lua. A Speed/stealth state button with three states.

So units moving slowly can only be seen at short range but units moving fast can be seen at a distance. I am trying to allow behaviour similar to a lion stalking its prey then rushing in for the kill.

I think I will need some thing along the lines of:

if Speedstate = 'slow' then set maxvelocity to 1 and set mincloakdistance to 100,

if Speedstate = 'normal' then set maxvelocity to 2 and set mincloakdistance to 250,

Speedstate = 'fast' then set maxvelocity to 3 and set mincloakdistance to 900,

if unit notmoving set mincloakdistance to 50,

I dont know the correct syntax for this or what is the best way to implement it.

Q3 Bunker unit> Attach point in unit script?

I also have been trying to create a bunker unit. From what I have gathered I need a mobile unit with 'is transporter' and 'is fire platform' and either 'canmove = false' or ' maxvelocity = 0' I also think I need to set a model part to be the attach point.

I have not tried this attach point bit yet but theoretically that should be the last thing I need to make a bunker work right?


Q4 How to make mex into nano towers?

I am trying to make Metal extractors double up as nano towers. I can't get it to work yet. When I make the mex a builder it seems to stop extracting metal. Does anyone know any solutions to this. I was also hoping to link the mex's build speed to the amount of metal it is extracting. I think this should theoretically be possible with Lua. What I am aiming for here is to make mex the only cheap build power, but I want that build power limited to metal spots this will stop people from procing and or it will mean that the person who take the most territory get the most build power and metal. To avoid the 'simcity' Afus and Nano farms, that happen a lot in BA. ( I do like BA i just want to explore different game play with this.

Thanks everyone for your help. I really appreciate it.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: 'Insurgency' Game balance test + help with lua.

Post by FLOZi »

Zealot wrote:Hi All
Hi thar. :-)
Questions / Requests for help:

Q2 Help with Lua and Cloak / Speed states

I would also appreciate some advice on how to implement some Lua to enable some gameplay functions I am after. I dont know how to write Lua but I am trying to learn.

I want to have a unit speed button that is tied to cloak distance by Lua. A Speed/stealth state button with three states.

So units moving slowly can only be seen at short range but units moving fast can be seen at a distance. I am trying to allow behaviour similar to a lion stalking its prey then rushing in for the kill.

I think I will need some thing along the lines of:

if Speedstate = 'slow' then set maxvelocity to 1 and set mincloakdistance to 100,

if Speedstate = 'normal' then set maxvelocity to 2 and set mincloakdistance to 250,

Speedstate = 'fast' then set maxvelocity to 3 and set mincloakdistance to 900,

if unit notmoving set mincloakdistance to 50,

I dont know the correct syntax for this or what is the best way to implement it.
It's doable and you have the right idea. You'll need to make your own custom command (annoyingly the Spring Q&A site is down which iirc had a good explanation of this).

You'll need to use Spring.MoveCtrl.SetGroundMoveTypeData as well as Spring.SetUnitCloak. Here's a link to a gadget which implements a custom command set by a toggle button ( link ). Main parts of interest are the command description (L43) and gadget:AllowCommand callin (L87), also the insertion of the command into the command menu in UnitCreated (~L77). #moddev and #lua on the lobby are the best places to get real-time help.
Q3 Bunker unit> Attach point in unit script?

I also have been trying to create a bunker unit. From what I have gathered I need a mobile unit with 'is transporter' and 'is fire platform' and either 'canmove = false' or ' maxvelocity = 0' I also think I need to set a model part to be the attach point.

I have not tried this attach point bit yet but theoretically that should be the last thing I need to make a bunker work right?
Hard to say without seeing your unitdef and script but you seem to have covered the basics
Q4 How to make mex into nano towers?

I am trying to make Metal extractors double up as nano towers. I can't get it to work yet. When I make the mex a builder it seems to stop extracting metal. Does anyone know any solutions to this. I was also hoping to link the mex's build speed to the amount of metal it is extracting. I think this should theoretically be possible with Lua. What I am aiming for here is to make mex the only cheap build power, but I want that build power limited to metal spots this will stop people from procing and or it will mean that the person who take the most territory get the most build power and metal. To avoid the 'simcity' Afus and Nano farms, that happen a lot in BA. ( I do like BA i just want to explore different game play with this.
Currently not possible for 1 unit to be both. Options are to have 1 unit which measures the ground metal and sets its metal production accordingly as though it were a mex, or have an additional builder unit spawned once the mex is completed which dies when the mex dies. Option 1 is probably cleaner, but won't show the extraction on the F4 metal map view.
Thanks everyone for your help. I really appreciate it.
Welcome to Spring. 8)
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: 'Insurgency' Game balance test + help with lua.

Post by gajop »

can you upload videos to youtube (private links) instead? thanks!
User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

Re: 'Insurgency' Game balance test + help with lua.

Post by Zealot »

Hi Flozi

I have tried to put together a gadget to handle the stealth and speed states. This is my first time trying to do Lua and one of my first times scripting.


Could you point out where I have done things wrong and help point me in the right direction?



function gadget:GetInfo()
return {
name = "Speed / Stealth state",
desc = "Toggles a units speed and decloak range.",
author = "Zealot",
date = "18 March 2013",
license = "GNU LGPL, v2.1 or later",
layer = 100, -------------------------What does this do?
enabled = true -- loaded by default?
}
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

if (not gadgetHandler:IsSyncedCode()) then
return
end


local EditUnitCmdDesc = Spring.EditUnitCmdDesc
local FindUnitCmdDesc = Spring.FindUnitCmdDesc
local InsertUnitCmdDesc = Spring.InsertUnitCmdDesc
local GiveOrderToUnit = Spring.GiveOrderToUnit
local SetUnitNeutral = Spring.SetUnitNeutral
local GetUnitMoveTypeData = Spring.GetUnitMoveTypeData
local SetGroundMoveTypeData = Spring.MoveCtrl.SetGroundMoveTypeData




-----Attempting to find units which can move and cloak and put in list of units to apply the gadget to. This syntax apprears to be worng and is stoping the gadget from loading.

local StealthSpeed = {(Unitdefs[unitDefID].canmove and Unitdefs[unitDefID].cancloak) = true}

local stealthspeedList = {},



-----setup stealth speed command


local CMD_SPEEDSTEALTH = GG.CustomCommands.GetCmdID("CMD_SPEEDSTEALTH") ,


local speedstealthCmd = {
id = CMD_SPEEDSTEALTH,
name = "togglespeedstealth",
action = "togglespeedstealth",
type = CMDTYPE.ICON_MODE,
tooltip = 'Toggle slow and stealthy or fast and non stealthy',
params = {0, 'Slow', 'Normal', 'Fast'},
},

function gadget:UnitCreated(unitID, unitDefID, unitTeam, builderID)
if StealthSpeed[unitDefID] then
InsertUnitCmdDesc(unitID, 500, speedstealthCmd)
local sp = UnitDefs[unitDefID].maxvelocity
local cldist = UnitDefs[unitDefID].minCloakDistance
stealthspeedList[unitID] = {orgspeed=sp, orgcloakdistance=cldist, }
end
end






-------- removed destroyed units from list


function gadget:UnitDestroyed(unitID, unitDefID, unitTeam)
StealthSpeed[unitID] = nil
end




-----------enable the command


function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions)
if StealthSpeed[unitDefID] then
if (cmdID == CMD_SPEEDSTEALTH) then
local cmdDescID = FindUnitCmdDesc(unitID, CMD_SPEEDSTEALTH)
Spring.Echo("cmdparams[1]=" .. tostring(cmdParams[1]))
if cmdParams = 1 then
SetGroundMoveTypeData(unitID, {
maxVelocity = stealthspeedlist[unitID].orgspeed
minCloakDistance = stealthspeedlist[unitID].orgcloakdistance
})
elseif cmdParams = 2 then
SetGroundMoveTypeData(unitID, {
maxVelocity = stealthspeedlist[unitID].orgspeed * 2
minCloakDistance = stealthspeedlist[unitID].orgcloakdistance / 2
})

elseif cmdParams = 3 then
SetGroundMoveTypeData(unitID, {
maxVelocity = stealthspeedlist[unitID].orgspeed * 3
minCloakDistance = stealthspeedlist[unitID].orgcloakdistance / 3
})
end
end
end
User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

Re: 'Insurgency' Game balance test + help with lua.

Post by Zealot »

I also can't work out how to auto host a game.

Do I need to upload the game to a certain site (Spring files or something) from which the auto host can find and install it?

Skirmish Ai's are not really working with it so I want to find a way to test it in multi player.


Thanks again.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: 'Insurgency' Game balance test + help with lua.

Post by Google_Frog »

Q1:
Put your game on rapid and use an online subversion tool. I think det is still the one to talk to rapid about. Then it is easy to have an up to date autohost. Somebody else knows the details of getting one of these. Ask in #moddev.

Q4:
Don't use the metalmap directly. Zero-K and EvoRTS have a system to automatically detect the metal spots on a map and restrict the placement of a certain building to these spots.

If your answer to the question "Do I ever want to use cloud metal?" is "No" then I think this is by far the best option. This is a very flexible solution as you can use any structure as the extractor and modify it's attributes based on the value of the metal spot.

There are also many metalmap override files which fix the metal layout of broken maps. If you want to make maps for your game you can ignore the metalmap entirely and just define the spots in a file.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: 'Insurgency' Game balance test + help with lua.

Post by smoth »

sounds really interesting.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: 'Insurgency' Game balance test + help with lua.

Post by knorke »

use pastebin.com or code tags so that posted stuff keeps formatin.

Code: Select all

-----Attempting to find units which can move and cloak and put in list of units to apply the gadget to. This syntax apprears to be worng and is stoping the gadget from loading.

local StealthSpeed = {(Unitdefs[unitDefID].canmove and Unitdefs[unitDefID].cancloak) = true}
You need to loop over all unit types in the game and see which ones fit the attributes (canmove, cancloak) you want.
like this: (untested, just the idea)

Code: Select all

local StealthSpeed = {}
for id,unitDef in pairs(UnitDefs) do		
	if (UnitDefs[id].canmove and Unitdefs[unitDefID].cancloak) then
		StealthSpeed[id] = true
	end
end
or to fill it by hand:

Code: Select all

local StealthSpeed= {
 [UnitDefNames["unitname_1"].id] = true,
[UnitDefNames["unitname_2"].id] = true,
[UnitDefNames["unitname_3"].id] = true,
 }
If some one can help show me how to set up a auto host so that people can play online then that would be amazing.
Contact Licho in forum or lobby.
If you do not need a 24/7 server but just to play some online test games, you can also host your own game room. (needs springlobby (TASclient works too, but for example 0k lobby does not have such function) While opening a room click [x] use relay host, this way other players can connect even if you do not have ports forwarded etc.
User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

Re: 'Insurgency' Game balance test + help with lua.

Post by Zealot »

Hi Knorke

Thanks for the Lua help.

That part seems to be working now.

There is just the part at the end of the code which is not working. It has to do with having the button toggle through three states and then apply the desired setting to the unit.

I have highlighted it in pastebin.

http://pastebin.com/wbp0Y2kM


I wrote to Licho and am trying to get things organise on the autohost front.

What should I use for a source control system? SVN? Google Code?

Thanks again
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: 'Insurgency' Game balance test + help with lua.

Post by gajop »

Zealot wrote: What should I use for a source control system? SVN? Google Code?
My suggestion is to use git on github.
An alternative would be to use a GoogleCode with SVN(only option?) or setup trac + SVN yourself.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: 'Insurgency' Game balance test + help with lua.

Post by knorke »

apply the desired setting to the unit.
instead of SetGroundMoveTypeData use Spring.SetUnitCloak
http://springrts.com/wiki/Lua_SyncedCtrl#Unit_LOS

google code with tortoiseSVN is good enough easy to use imo.
User avatar
Zealot
Posts: 94
Joined: 03 Dec 2012, 13:53

finished code

Post by Zealot »

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Speed / Stealth state",
    desc      = "Toggles a units speed and decloak range.",
    author    = "Zealot",
    date      = "13th July 2013",
    license   = "GNU LGPL, v2.1 or later",
    layer     = 101,  -------------------------What does this do?
    enabled   = true  --  loaded by default?
  }
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

if (not gadgetHandler:IsSyncedCode()) then
  return
end


local EditUnitCmdDesc = Spring.EditUnitCmdDesc
local FindUnitCmdDesc = Spring.FindUnitCmdDesc
local InsertUnitCmdDesc = Spring.InsertUnitCmdDesc
local GiveOrderToUnit = Spring.GiveOrderToUnit
local SetUnitNeutral = Spring.SetUnitNeutral
local GetUnitMoveTypeData = Spring.GetUnitMoveTypeData
local SetGroundMoveTypeData = Spring.MoveCtrl.SetGroundMoveTypeData
local SetUnitCloak = Spring.SetUnitCloak
local GetUnitCmdDescs = Spring.GetUnitCmdDescs

-----setup speedstealth  command



local STEALTHY = {
	[UnitDefNames["armcv"].id] = true,
	[UnitDefNames["corak"].id] = true,
	[UnitDefNames["armpw"].id] = true,
	[UnitDefNames["armwar"].id] = true,
	[UnitDefNames["armrock"].id] = true,
	[UnitDefNames["corstorm"].id] = true,
	[UnitDefNames["corthud"].id] = true,
	[UnitDefNames["armzeus"].id] = true,
	[UnitDefNames["cornecro"].id] = true,
	[UnitDefNames["corpyro"].id] = true,
	[UnitDefNames["armsnipe"].id] = true,
	[UnitDefNames["cormort"].id] = true,
	
}

local stealthyList = {}

local CMD_SPEEDSTEALTH = 34583

local speedstealthCmdDesc = {
	id 		= CMD_SPEEDSTEALTH,
	name 	= "togglespeedstealth",
	action	= "togglespeedstealth",
	type   	= CMDTYPE.ICON_MODE,
	tooltip = 'Toggle slow and stealthy or fast and non stealthy',
	params 	= {1, 'Slow', 'Normal', 'Fast'}
}





function gadget:UnitCreated(unitID, unitDefID, teamID, builderID)
	if STEALTHY[unitDefID] then
   		InsertUnitCmdDesc(unitID, 501, speedstealthCmdDesc)
    	local ms = UnitDefs[unitDefID].speed
    	stealthyList[unitID] = {orgspeed=ms}
  end
end


function gadget:UnitDestroyed(unitID, unitDefID, unitTeam)
  stealthyList[unitID] = nil
end



-----------enable the command


function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions)
if STEALTHY[unitDefID] then
    if cmdID == CMD_SPEEDSTEALTH then 
     		local cmdDescID = FindUnitCmdDesc(unitID, CMD_SPEEDSTEALTH)
     		--Spring.Echo("cmdparams[1]=" .. tostring(cmdParams[1]))
      		if not cmdDescID then return false end
      	
      		
       		 if  cmdParams[1] == 1 then 
        		
       				SetUnitCloak(unitID, true, 250)  
       				SetGroundMoveTypeData(unitID, {
                	maxSpeed=stealthyList[unitID].orgspeed * 1})
       			
        
     		elseif 
     				 cmdParams[1] == 2 then 
        		
        			SetUnitCloak(unitID, true, 750)   
        			SetGroundMoveTypeData(unitID, {
                	maxSpeed=stealthyList[unitID].orgspeed * 2 })
        			  
              	  
       		elseif
       				 cmdParams[1] == 0 then 
      			
        			SetUnitCloak(unitID, true, 125)  
        			SetGroundMoveTypeData(unitID, {
                	maxSpeed=stealthyList[unitID].orgspeed / 2 })
       		end
      
      --you can't edit a single value in the params table for
        --editUnitCmdDesc, so we generate a new table
        local updatedCmdParams = {
            cmdParams[1],
            speedstealthCmdDesc.params[2],
            speedstealthCmdDesc.params[3],
            speedstealthCmdDesc.params[4]
        }
		Spring.EditUnitCmdDesc(unitID, cmdDescID, { params = updatedCmdParams}) 
		return false 
    	end
    	return true
    end
  end
http://pastebin.com/3Tx9dXqx
Post Reply

Return to “Game Development”