Help with your scripting

A question or three lol

A question or three lol

Postby epsilonion » 30 Apr 2019, 14:13

I have been thinking about field of vision for my AI and came accross this video.

It got me thinking about what hooks would be great for skyline..

  • dirfromangle
  • collision layer on obstacles for navmesh (if implemented layers could also be used for different types of cover like height of obstacle etc, it could also include info such as the edges of the obstacle so that AI could stay behind cover in a firing position)

Calling a function every 0.2s instead of every tick
When calling a function from the update function to put a restraint of how often a function can be called say every 40 ms instead of every tick (how ever long a tick is?).

Code: Select all

function onUpdate
    checkforEnemy(objID, objPos, maxDist, 2f)

The idea would be to call a function that would use a sensor from the npc's position to the view distance of the npc but run the scan every .2f (every 0.2 of a second).

This got me thinking about optimising cpu time and speeding up the game..

AI implementation

I have been looking at websites and videos of general AI and behaviour trees etc.. and can not seem to get my head around it, I dont know if its because I am getting old (lol) now but its getting harder to learn things and make it stick..

This got me thinking about how to optimise the running of this and I came up with a AI manager that is not attached to any NPC but is called when needed say when player is xx distance from a NPC and controls actions such as cover, assault, flee.

the actions within the manager would use a weight based system that would be passed from the npc when calls the AI manager so that actions vary and would not be the same for each NPC that call the manager.
by using it this way each NPC doesnt have to have a lot of code for behaviours and calls the manager when needed, each NPC would have its own attached behaviours such as idle and patrol etc.

I was also thinking about a manager to track the players position and only have NPC active when within a range but I dont know if I am over thinking it now..

Anyways I am very interested on what others would or have done on this subject.
User avatar
Skyline Lead Moderator
Skyline Lead Moderator
Posts: 840
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest