Help with steering behaviour

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Gunroar:Cannon()
Party member
Posts: 137
Joined: Thu Dec 10, 2020 1:57 am

Help with steering behaviour

Post by Gunroar:Cannon() » Tue Feb 23, 2021 4:42 pm

I'm trying to implement steering behaviour with a push from this and a library I found, but
I'm having trouble with making objects not collide with one another.
The base I started with seems smooth enough though it uses angles to move and I wanted something that uses velocity, but even if I try to make the "boids" flee from each other they still clump together(plus their supposed to "herd", the more red they are the more neighbors they have, and follow the closest neighbor).
Since I don't really know what I'm doing with this steering behavior, and I just used trail and error(kind of) to get this far, I just posted the love file.
Info
Each boid has an agent that handles the steering and they can be controlled by functions.
(Note: Main problem here is when and where to use use which different functions)

I listed those I thought important to the cause here(note, target/hunter can be an agent or vector or table with x and y):

Code: Select all

agent:seek(target)
agent:flee(hunter)
agent:arrive(target)
agent:pursuit(hunter, panicDistance)
agent:evade(hunter)
Attachments
boids3.love
(23.62 KiB) Not downloaded yet
Last edited by Gunroar:Cannon() on Thu Feb 25, 2021 4:38 am, edited 1 time in total.
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow

User avatar
Gunroar:Cannon()
Party member
Posts: 137
Joined: Thu Dec 10, 2020 1:57 am

Re: Help with steering behaviour

Post by Gunroar:Cannon() » Wed Feb 24, 2021 11:46 pm

It seems something is wrong with just the fleeing , I think(to narrow it down :P )
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow

Post Reply

Who is online

Users browsing this forum: No registered users and 49 guests