Skip to content

Commit

Permalink
v0.4.2: Performance and AI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Rehermann (Gustavo6046) committed May 2, 2019
1 parent 0874044 commit ef0a3a7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CVarInfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ server string zb_btypes = "ZetaDoom:DoomPlayer;ZetaStrife:StrifePlayer;ZetaSMush
server string zb_wtypes = "ZetaDoomWeapons;ZetaStrifeWeapons;ZetaSentientMushesWeapons";
server string zb_extraweap = "";
server float zb_autouseinterval = 9;
server bool zb_autouse = false;
server bool zb_autouse = true;
server bool zb_autonodes = true;

server string zb_bnames = "Jack:Persephone:Èmille:Robert:Amanda:Maria:Mary:Josh:Wagner:John:Louis:Gabriel:Renato:Alejandro:Alexander:Heinrich:Caesar:Walter:Amy:Lawrence:Marylenne:Leonhart:Leonard:Jackson:Lee:Bert:Humberto:Mike:Pablo:Michael:Hitchcock:Hilton:Ronald:Robinson:Son:House:Romulus:Peter:Peterson:Zephyrus:Robin:Paul:Paula:Thorson:Robohead:Minchson:James:Jamilton:Greg:Gregor:Gregory:Victoria:Anita:Whindersson:Melody:Xonon:Xihil";
54 changes: 24 additions & 30 deletions ZScript.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ class ZTBotController : Actor
GruntInterval = 20;
Log(GruntInterval);

MoveAwayFrom(currNode);
MoveAwayFrom(currNode);
if (currNode != null) {
MoveAwayFrom(currNode);
MoveAwayFrom(currNode);
}
}

return false;
Expand All @@ -222,6 +224,9 @@ class ZTBotController : Actor

td.HitLine.Activate(possessed, 0, SPAC_Use);

currNode = ZTPathNode.plopNode(pos, ZTPathNode.NT_USE);
currNode.Angle = Angle;

ZTLineUseHistoryEntry entry = new("ZTLineUseHistoryEntry");

entry.Used = td.HitLine;
Expand Down Expand Up @@ -1001,37 +1006,26 @@ class ZTBotController : Actor
data: useData
);

if ( useData.HitType == TRACE_HitWall && useData.HitLine.Special > 0 )
{
Line l = useData.HitLine;
DebugLog(LT_VERBOSE, "["..myName.." USE NODE LOGS] Activating wall! Line special: "..l.Special);

Level.ExecuteSpecial(
l.Special,
possessed,
l, 0,

l.Args[0],
l.Args[1],
l.Args[2],
l.Args[3],
l.Args[4]
);

useData.HitLine.Activate(possessed, 0, SPAC_Use);
}
if ( useData.HitType == TRACE_HitWall ) {
if ( useData.HitLine.Special > 0 ) {
Line l = useData.HitLine;
DebugLog(LT_VERBOSE, "["..myName.." USE NODE LOGS] Activating wall! Line special: "..l.Special);

else if ( useData.hitType == TRACE_HitWall /* td.HitLine.Special == 0 */ ) {
if ( GruntInterval == 0 || GruntInterval-- == 0 ) {
A_PlaySound("ztmisc/grunt", CHAN_VOICE, attenuation: 1.1);
GruntInterval = 20;
Log(GruntInterval);
useData.HitLine.Activate(possessed, 0, SPAC_Use);
}

MoveAwayFrom(currNode);
MoveAwayFrom(currNode);
else {
if ( GruntInterval == 0 || GruntInterval-- == 0 ) {
A_PlaySound("ztmisc/grunt", CHAN_VOICE, attenuation: 1.1);
GruntInterval = 20;
Log(GruntInterval);
}

return false;
MoveAwayFrom(currNode);
MoveAwayFrom(currNode);

return false;
}
}
}

Expand Down Expand Up @@ -1467,7 +1461,7 @@ class ZTBotController : Actor
if ( ( currNode == null || possessed.Distance2D(currNode) > 400 ) && CVar.FindCVar('zb_autonodes').GetBool() )
{
pastNode = currNode;
SetCurrentNode(ZTPathNode.plopNode(possessed.pos, ZTPathNode.NT_USE));
SetCurrentNode(ZTPathNode.plopNode(possessed.pos, ZTPathNode.NT_NORMAL));
}

else if ( currNode != null && possessed.Distance2D(currNode) > 48 ) {
Expand Down
40 changes: 0 additions & 40 deletions ZetaCode/Pathing.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,6 @@ class PlopResult : Thinker
Array<String> nodeMaps;
}

class PathBall : DoomImpBall
{
Actor targetNode;

void A_BallTick()
{
Vector2 offs = Vec2To(targetNode);
offs.x /= Distance2D(targetNode);
offs.y /= Distance2D(targetNode);

Vector2 vel = AngleToVector(angle);

if ( Distance3D(targetNode) < 72 || (offs.x * vel.x) + (offs.y * vel.y) < 0 )
SetStateLabel("Death");
}

Default
{
Damage 0;

+PAINLESS;
}

States
{
Spawn:
BAL1 AB 4 A_BallTick;
Loop;
}
}

class ZTPathNode : Actor
{
enum NavigationType
Expand Down Expand Up @@ -419,15 +388,6 @@ class ZTPathNode : Actor

DebugLog(LT_INFO, "Found a "..res.Length().."-node path between "..self.id.." and "..other.id);

if ( CVar.FindCVar("zb_debug").GetInt() > 0 )
for ( uint i = 0; i < res.Length() - 1; )
{
PathBall pb = PathBall(res.Get(i).SpawnMissile(res.Get(++i), "PathBall"));

if ( pb != null )
pb.targetNode = res.Get(++i);
}

return res;
}

Expand Down
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
NAME=ZetaBot
VERSION=0.4.1
VERSION=0.4.2

ADDFOLDER ZetaCode
ADDFOLDER sprites
Expand Down

0 comments on commit ef0a3a7

Please sign in to comment.