Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPC AI Sphere vs RunUO
Author Message
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #11
RE: NPC AI Sphere vs RunUO
With NPC_AI_PATH|NPC_AI_ALWAYSINT my NPCs seem to have good enough pathfinding. Setting a very low moverate will reduce the delay in thinking and walking for NPCs in general. I tend only use higher values for undead and golems and such.

Could we get some video of bad sticking? Pathfinding is hard to fix with script but I can't pinpoint any glaring errors to ask the hardcoders to fix.

Current Projects: Necromancy SCP overhaul. Custom Faction AI/System. Imbuing.
10-02-2012 06:19 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,140
Likes Given: 217
Likes Received: 89 in 76 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #12
RE: NPC AI Sphere vs RunUO
My "Pathfinding" fix is a memory that on timer if "CONT" isn't where should be, call GOTO to location...

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
10-02-2012 07:01 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #13
RE: NPC AI Sphere vs RunUO
NPC_AI_ALWAYSINT is not usable, cpu usage gone crazy after long uptime and wont reduce even on server with no players.
10-02-2012 07:09 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #14
RE: NPC AI Sphere vs RunUO
Define long up time... if it's hours, that's a problem, though not one I've had (though my use of NPCs and maps is limited at the moment), if it's days or weeks then that's unpleasant but not an unreasonable interval for maintenance restarts. Either way worth looking in to.

You might try adjusting SECTORSLEEP and see if that helps.

Current Projects: Necromancy SCP overhaul. Custom Faction AI/System. Imbuing.
10-02-2012 07:22 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,140
Likes Given: 217
Likes Received: 89 in 76 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #15
RE: NPC AI Sphere vs RunUO
Shak, did you tried .SERV.SHRINKMEM ?

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
10-02-2012 07:23 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #16
RE: NPC AI Sphere vs RunUO
Lets have a look then... Ill start ....

Anyhow, so we would need a line of sight check ..... something simple like below, this is because NPC trigger See New Player, can see through walls, meaning if there is a wall between, the NPC will most likely run into it before it trys get around it.
( If i remeber correctly )

Code:
[FUNCTION CheckLineOfSight]
IF <ARGV[0]>
    REF1=<SERV.UID.<ARGV[0]>>
ENDIF
IF (<CANSEELOS <REF1.P.X>,<REF1.P.Y>,<REF1.P.Z>,<REF1.P.M>>)
    RETURN 0
ELSE
    RETURN 1
ENDIF

so we could go ahead with the trigger NPCSeeNewPlayer

Code:
ON=@NPCSeeNewPlayer
    TAG.LastLookedAt=<SRC.UID>
    IF <CheckLineOfSight <SRC.UID>>
        SAY I see <SRC.UID> and im gonna kill him
        ATTACK
        RETURN 0
    ELSE
        SAY I sense someone but i cannot see them
        GO <HOME> // Go Home or Pathfind ????
        RETURN 1
    ENDIF

The next trigger we have is ACTFOLLOW
Code:
ON=@NPCActFollow
    IF (<REGION.UID>=<SRC.REGION.UID>)
        RETURN 2
    ELSE
        FINDID.i_memory.REMOVE // This is dirty not being specific
        RETURN 1
    ENDIF

Above basically means if the player you are following leaves the region you are in dont follow anymore (Return 1) , Return 2 means follow.

Now I guess we can improvise on this, pathfinding someone would have to test this act follow to find out how clever it really is.

Because if there is no way around we really dont wanna follow, but if there is a way around we do want to follow.

^^ Its a start lets make something out of it !|

Scrambles through revisions to see whats been done on it -


20-08-2006, Nazghul (Changes only for servers with EF_NewPositionCheck on)
- Fixed #304: NPCs are dumber in pathfinding with EF_DiagonalWalkCheck on
(fixed only with EF_NewPositionCheck and EF_WalkCheck on).

21-01-2008, MrSugarCube
- Fixed #1311: NPC Pathfinding failing when EF_DiagonalWalkCheck is enabled.

28-04-2008, MrSugarCube
- Fixed #1394: Advanced pathfinding (NPC_AI_PATH) allowing NPCs to make invalid movements
(for example walking whilst paralyzed). Some other adjustments have also been made,
allowing NPCs to properly assess characters that may be blocking the way (to walk around
them), negotiate corners with EF_DiagonalWalkCheck enabled, and attempt to compensate
when new obstacles block a previously valid path.

09-09-2008, MrSugarCube
- Fixed #1516: NPCs unable to use pathfinding when trying to follow or walk up to another character.

^^ Quite alot of fixed there,
EF_DiagonalWalkCheck and EF_NewPositionCheck and EF_WalkCheck ,,,, looks like a good start

Im gonna have a little test myself

OK, check this out guys as far as im concerned it works fine, I couldnt shake that vampire bat, it just chased me all over.

I did this in sphere.ini...

NPCAI = 0001|0002|0004|0008|0010|0040|00100|00200

Experimental = 01|08|040|080|0100|0400|02000|010000

then i made the event ....
Code:
[EVENTS e_NPCBrains]
ON=@NPCSeeNewPlayer
    TAG.LastLookedAt=<SRC.UID>
    IF <CheckLineOfSight <SRC.UID>>
        SAY I see <SRC.UID> and im gonna kill him
        ATTACK
        RETURN 0
    ELSE
        SAY I sense someone but i cannot see them
        GO <HOME> // Go Home or Pathfind ????
        RETURN 1
    ENDIF

ON=@NPCActFollow
    IF (<REGION.UID>=<SRC.REGION.UID>)
        RETURN 2
    ELSE
        FINDID.i_memory.REMOVE // This is dirty not being specific
        RETURN 1
    ENDIF

I put it on a bat then ran for my life.... I think the NPCAI in sphere ini is good myself..
(This post was last modified: 10-02-2012 08:15 AM by Barnabus.)
10-02-2012 07:26 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #17
RE: NPC AI Sphere vs RunUO
aha MoveRate !!! the overide tag, i guess some of the mobs dont follow so well because they are slow !!!
Code:
[EVENTS e_NPCBrains]
ON=@NPCSeeNewPlayer
    TAG.LastLookedAt=<SRC.UID>
    IF <CheckLineOfSight <SRC.UID>>
        SAY I see <SRC.UID> and im gonna kill him
        NEWITEM i_RunLikeABastard, 1, <UID>
        ATTACK
        RETURN 0
    ELSE
        SAY I sense someone but i cannot see them
        IF <FINDID.i_runLikeABastard>
            FINDID.i_runLikeABastard.REMOVE
        ENDIF
        GO <HOME> // Go Home or Pathfind ????
        RETURN 1
    ENDIF

[ITEMDEF i_runLikeABastard]
DEFNAME=i_runLikeABastard
ID=i_memory
NAME=Run Like a Bastard
TYPE=t_eq_script

ON=@CREATE
    ATTR=ATTR_NEWBIE|ATTR_DECAY|ATTR_MOVE_NEVER
    TIMER=1
    MORE=1

ON=@TIMER
    LOCAL.CurrentMoveRate=<CONT.MOVERATE>
    LOCAL.CurrentMobUId=<CONT.UID>
    IF <MORE> > 6
        CONT.MANA=<EVAL <CONT.INT>> // Speed times out you can cast now have some mana
        CONT.TAG.OVERRIDE.MOVERATE=<LOCAL.CurrentMoveRate>
        REMOVE
        RETURN 1
    ELSE
        CONT.MANA=0  // Dont cast run
        CONT.TAG.OVERRIDE.MOVERATE=<EVAL <LOCAL.CurrentMoveRate>/3> // Run 3 times faster than usual
        MORE=<MORE>+1
        TIMER=1
        RETURN 1
    ENDIF
    RETURN 1

That helps the monsters stay on your tail. !
(This post was last modified: 10-02-2012 09:55 AM by Barnabus.)
10-02-2012 09:52 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #18
RE: NPC AI Sphere vs RunUO
(10-02-2012 07:23 AM)Extreme Wrote:  Shak, did you tried .SERV.SHRINKMEM ?

yeah im using it periodically on worldsaves.
10-03-2012 01:42 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)