Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart High/low weapon selection proof of concept #3720

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fe44791
proof of concept complete
SethDGamre Sep 14, 2024
6aa5e67
Merge remote-tracking branch 'upstream/master' into smart-high/low-se…
SethDGamre Oct 23, 2024
76587dd
gauntlet and agitator done
SethDGamre Oct 23, 2024
849b1ed
code cleanup, adjust low weapon delay
SethDGamre Oct 23, 2024
7ce18e0
rewrite using all gameframe timing not signals
SethDGamre Oct 30, 2024
abd4295
rewrite complete, it works better now
SethDGamre Nov 2, 2024
fb15cec
Merge branch 'master' into smart-high/low-select-exhibition
SethDGamre Nov 2, 2024
b4fddbe
reduce delay swithcing to high
SethDGamre Nov 2, 2024
7028154
remove high trajectory toggle
SethDGamre Nov 2, 2024
2b0623b
code cleanup
SethDGamre Nov 2, 2024
472f261
reduce buggy low priority selection
SethDGamre Nov 2, 2024
b3973a5
reloadstate moved inside each individual weapon's if
SethDGamre Nov 3, 2024
717b628
Merge branch 'master' into smart-high/low-select-exhibition
SethDGamre Nov 7, 2024
4c62e43
optimized high/low errorstate
SethDGamre Nov 16, 2024
003960d
further improve consistency for errorstate
SethDGamre Nov 16, 2024
cf42821
create gadget to stop bad targetting
SethDGamre Nov 16, 2024
c2e460c
Update unit_weapon_smart_select_helper.lua
SethDGamre Nov 17, 2024
552fc13
Update unit_weapon_smart_select_helper.lua
SethDGamre Nov 17, 2024
81c3cc7
code cleanup
SethDGamre Nov 17, 2024
b4a49fd
more code cleanup
SethDGamre Nov 17, 2024
7f05ae6
Update unit_weapon_smart_select_helper.lua
SethDGamre Nov 17, 2024
015a8c7
fix gadgets.lua entry so it works with engine change from 12 years ago
SethDGamre Nov 18, 2024
95acb62
Update unit_weapon_smart_select_helper.lua
SethDGamre Nov 18, 2024
4e50961
Merge branch 'master' into smart-high/low-select-exhibition
SethDGamre Nov 18, 2024
6078360
Update unit_weapon_smart_select_helper.lua
SethDGamre Nov 20, 2024
e514d9b
Merge remote-tracking branch 'upstream/master' into smart-high/low-se…
SethDGamre Nov 21, 2024
da2c690
gadget complete?
SethDGamre Nov 21, 2024
e66f87e
everything 100% working, performance not good
SethDGamre Nov 21, 2024
da48f3a
Update armguard.cob
SethDGamre Nov 21, 2024
5d667ce
neww version, now with 1000% better performance
SethDGamre Nov 22, 2024
5e0edb0
fixed ground targetting error, cleanup code
SethDGamre Nov 22, 2024
8adb417
attack/settarget now override once
SethDGamre Nov 22, 2024
da50af0
Merge remote-tracking branch 'upstream/master' into smart-high/low-se…
SethDGamre Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions scripts/Units/armguard.bos
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

piece flare1, flare2, base, turret, barrel1, barrel2, sleeves;

static-var nextBarrel, trajectoryMode, lastHeading;
static-var nextBarrel, trajectoryMode, lastHeading, aimingState, resetHighFrame, delayFrames;

#define SIGNAL_AIM 1
#define LOW_TRAJECTORY 0
#define HIGH_TRAJECTORY 1
#define SIGNAL_RESET_DELAY 2


Create()
Expand All @@ -31,6 +30,9 @@ Create()
dont-shade sleeves;
dont-shade turret;
nextBarrel = 0;
aimingState = 0;
resetHighFrame = 0;
delayFrames = 450;
SethDGamre marked this conversation as resolved.
Show resolved Hide resolved
}

#define SMOKEPIECE base
Expand All @@ -44,13 +46,11 @@ RequestState(requestedState)
Activate()
{
signal SIGNAL_AIM;
start-script RequestState(HIGH_TRAJECTORY);
}

Deactivate()
{
signal SIGNAL_AIM;
start-script RequestState(LOW_TRAJECTORY);
}

restoreAfterDelay()
Expand Down Expand Up @@ -80,6 +80,14 @@ restoreAfterDelay()
turn sleeves to x-axis <0.000000> speed <45.000000>;
}

resetState()
{
signal SIGNAL_RESET_DELAY;
set-signal-mask SIGNAL_RESET_DELAY;
sleep 250;
aimingState = 0;
SethDGamre marked this conversation as resolved.
Show resolved Hide resolved
}

aimCommon(heading, pitch)
{
turn turret to y-axis heading speed <30.000000>;
Expand All @@ -92,11 +100,11 @@ aimCommon(heading, pitch)

AimPrimary(heading, pitch)
{
if( trajectoryMode != LOW_TRAJECTORY )
{
return(0);
if (aimingState == 2){
return (0);
}

aimingState = 1;
start-script resetState();
signal SIGNAL_AIM;
set-signal-mask SIGNAL_AIM;
call-script aimCommon(heading, pitch);
Expand All @@ -108,19 +116,28 @@ AimPrimary(heading, pitch)
{
return(0);
}

return (1);
}

AimSecondary(heading, pitch)
{
if( trajectoryMode != HIGH_TRAJECTORY )
{
return(0);

if (aimingState == 1){
return (0);
}

var frame;
frame = (get GAME_FRAME);
if (aimingState == 2 && frame > resetHighFrame){
aimingState = 0;
return (0);
}
if (aimingState != 2){
resetHighFrame = frame + delayFrames;
}
aimingState = 2;
signal SIGNAL_AIM;
set-signal-mask SIGNAL_AIM;

call-script aimCommon(heading, pitch);
return (1);
}
Expand Down
Binary file modified scripts/Units/armguard.cob
Binary file not shown.
23 changes: 11 additions & 12 deletions units/ArmBuildings/LandDefenceOffence/armguard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,30 @@ return {
},
plasma_high = {
accuracy = 75,
areaofeffect = 192,
areaofeffect = 100,
avoidfeature = false,
cegtag = "arty-large",
craterareaofeffect = 192,
cegtag = "arty-medium",
craterboost = 0,
cratermult = 0,
edgeeffectiveness = 0.65,
explosiongenerator = "custom:genericshellexplosion-medium-bomb",
edgeeffectiveness = 0.4,
explosiongenerator = "custom:genericshellexplosion-medium",
gravityaffected = "true",
hightrajectory = 1,
impulseboost = 0.123,
impulsefactor = 1.4,
name = "High-trajectory g2g long-range AoE plasma cannon",
impulsefactor = 0.5,
mygravity = 0.289,
name = "Heavy g2g long range plasma cannon",
noselfdamage = true,
proximitypriority = -1,
range = 1220,
reloadtime = 7,
reloadtime = 2.85,
soundhit = "xplomed2",
soundhitwet = "splslrg",
soundhitwet = "splsmed",
soundstart = "cannhvy5",
turret = true,
weapontype = "Cannon",
weaponvelocity = 440,
weaponvelocity = 600,
damage = {
default = 600,
default = 300,
subs = 150,
vtol = 90,
},
Expand Down
22 changes: 11 additions & 11 deletions units/CorBuildings/LandDefenceOffence/corpun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,32 +137,32 @@ return {
},
plasma_high = {
accuracy = 75,
areaofeffect = 208,
areaofeffect = 120,
avoidfeature = false,
cegtag = "arty-medium",
craterareaofeffect = 208,
craterboost = 0,
cratermult = 0,
edgeeffectiveness = 0.65,
edgeeffectiveness = 0.4,
explosiongenerator = "custom:genericshellexplosion-medium-bomb",
gravityaffected = "true",
hightrajectory = 1,
impulseboost = 0.123,
impulsefactor = 1.4,
name = "Long-range high-trajectory g2g AoE plasma cannon",
impulsefactor = 0.5,
mygravity = 0.289,
name = "Long-range g2g plasma cannon",
noselfdamage = true,
proximitypriority = -1,
range = 1245,
reloadtime = 7.5,
reloadtime = 3.16667,
soundhit = "xplomed2",
soundhitwet = "splslrg",
soundhitwet = "splsmed",
soundstart = "cannhvy5",
turret = true,
weapontype = "Cannon",
weaponvelocity = 440,
weaponvelocity = 600,
damage = {
default = 650,
subs = 95,
default = 350,
lboats = 350,
subs = 90,
vtol = 95,
},
},
Expand Down