Using spring for a-life/multiagent simulation?

Using spring for a-life/multiagent simulation?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Using spring for a-life/multiagent simulation?

Post by Dragon45 »

I'm sure the idea has been kicked around; did anyone ever mess with this? Seems like Spring + LUA (for basic agent scripting) could be useful here. Haven't done any real spring dev though, so I dunno.
User avatar
danuker
Posts: 53
Joined: 04 Feb 2008, 22:37

Re: Using spring for a-life/multiagent simulation?

Post by danuker »

I have no experience of such, but it definetly sounds awesome.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Using spring for a-life/multiagent simulation?

Post by AF »

Sounds like something that would benefit world builder immenseley if not as an open library for mapmakers and game devs
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Using spring for a-life/multiagent simulation?

Post by imbaczek »

lack of multithreading support would be a disadvantage; could be worked around via custom skirmish AI, though.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Using spring for a-life/multiagent simulation?

Post by AF »

depends on the level of complexity required, for a prototype I dont think multithreading is required
User avatar
danuker
Posts: 53
Joined: 04 Feb 2008, 22:37

Re: Using spring for a-life/multiagent simulation?

Post by danuker »

I imagine con vehs automatically making mexes and flashes that are guarding them stand in FRONT of them, not behind.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Using spring for a-life/multiagent simulation?

Post by AF »

danuker wrote:I imagine con vehs automatically making mexes and flashes that are guarding them stand in FRONT of them, not behind.
All fine and dandy until you come to the pitfall of how do you define the front and back programmatically?
User avatar
danuker
Posts: 53
Joined: 04 Feb 2008, 22:37

Re: Using spring for a-life/multiagent simulation?

Post by danuker »

I would define front as the location nearest to the enemy base.
The enemy base is an average of all buildings (if there are any) or of units, or manually overridden.
Or maybe the furthest from the ally base.
But that's the point of a-life, to figure that out, right?
I might be thinking about too complicated algorithms.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Using spring for a-life/multiagent simulation?

Post by AF »

Too many flaws, such as what if your surrounded in a ffa? Or what if your mex is on the front and theres enemies tot eh north and south and a big base tot he west? Obv youd defend north n south not west because thats the biggest threat.

What once seemed like a simple solution quickly spirals out of control and complexity =p

Instead of averaging the buildings and units, weight the units on a threatmap, where threat is adjusted for proximity. Then average out the map to find the position based on the weights. Much better algorithm. Still not perfect though.
User avatar
danuker
Posts: 53
Joined: 04 Feb 2008, 22:37

Re: Using spring for a-life/multiagent simulation?

Post by danuker »

Cool! If the unit has been seen, also take its firepower/health into account.
Would be awesome to have the units auto-intercept incoming radar blips.
On more features, I guess that would turn out into an entire AI, letting the player just watch.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Using spring for a-life/multiagent simulation?

Post by zwzsg »

Dragon45 wrote:I'm sure the idea has been kicked around; did anyone ever mess with this? Seems like Spring + LUA (for basic agent scripting) could be useful here. Haven't done any real spring dev though, so I dunno.
What defines a-life/multiagent simulation? Is it some sort of AI that works on unit level and not team level? Considering the level of control over units that was had by AI's dll for years, and by Lua AI more recently, I don't see what would make Dragon45's idea impossible.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Using spring for a-life/multiagent simulation?

Post by Kloot »

  • 1. write a skirmish AI and name it "Agent"
    2. make it able to send/receive messages to/from other instances of itself
    3. define a performance measure that it should optimize
    4. have it coordinate its actions with other Agents via message exchange
    5. ???
    6. profit from your MAS!
(PS. from having done actual research into multi-agent systems design, all except step 6 are non-trivial)
Last edited by Kloot on 04 Mar 2009, 22:18, edited 1 time in total.
souledge
Posts: 23
Joined: 15 Jun 2008, 07:31

Re: Using spring for a-life/multiagent simulation?

Post by souledge »

It's possible, it could be hard to develop - Depends how far you want to go with it, on the plus side you have a lot done for you, but at the same time you have to get to know springs insides quite well.

An Alife simulation is very trial an error getting behaviours correct, so you'd prob have to produce your own custom UIs to manipulate variables for both development and the final product, else it would take ages to develop what with having to restart spring all the time, visualising the data could be hard, maybe make something with lua, logging data you want is probably quite easy. A very good feature of spring would be the replay feature.

Performance could be an issue though, anything modelling >2-300 agents could have some issues
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Re: Using spring for a-life/multiagent simulation?

Post by Dragon45 »

Spring is already a multi-agent simulation. Intermingle 100 flashes, 100 brawlers, 100 slashers, randomly put half of them on opposing teams. Move the brawlers away slowly to one side, set them all to Fire At Will. Watch the fun.

Spring is one of the best/most robust OSS multi-agent engine in existence. It beats some *2D* a-life engines for speed and scale for equal number of entities given the complexity of each agent.

It also has very thorough logging and scripting capabilities.

Few thoughts - Pathfinding is extremely intensive. For sim purposes, how hard to rip out current pathfinder and replace with some stupid algorithm if i can say "all units move in a 50x50 grid only"

Well known is that graphics is intensive; toning down or replacing current graphics engine with some sprite based shit is not easy because of lack of modularity in engine.

Finally, distributed computing - suppose funky thing i did with setup "magic zones" - galactic gate; an agent is moved into a completely different independent simulation (or gene bank)? via such a "zone"; scatter multiple zones in the maps. Script zones in LUA, add message passing between persistent servers running this sim so that they can transfer agents amongst each other in vastly different environments (or same?).


Suddenly distributed computing capabilities which again few other sims have.
Last edited by Dragon45 on 05 Mar 2009, 03:40, edited 1 time in total.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Re: Using spring for a-life/multiagent simulation?

Post by Dragon45 »

i am too damn tired for funk branstaorm

want time to do this, want clone self one half do this shit
souledge
Posts: 23
Joined: 15 Jun 2008, 07:31

Re: Using spring for a-life/multiagent simulation?

Post by souledge »

Dragon45 wrote:Spring is already a multi-agent simulation. Intermingle 100 flashes, 100 brawlers, 100 slashers, randomly put half of them on opposing teams. Move the brawlers away slowly to one side, set them all to Fire At Will. Watch the fun.
That scenario isn't a multi-agent sim, there's barely any autonomy and you're controlling their movements lol. Multiple AIs each with a single unit would work as an example of a spring multi-agent system.
Dragon45 wrote: Spring is one of the best/most robust OSS multi-agent engine in existence. It beats some *2D* a-life engines for speed and scale for equal number of entities given the complexity of each agent.
You can't say this without having an actual multi-agent/Alife sim implemented. Most units in spring have a very limited view and spend the majority of the time with few units within their view to actually interact with, only collision detection with friendlies and turret position + maybe basic movement with an enemy on the screen. Even then, not much is done with the turret - with many enemies on the screen surrounding a unit the turret usually gets confused and spends most of its time moving rather than shooting.

Start making units more aware of their surroundings and give them some complex behaviours and suddenly your CPU is dead.
Dragon45 wrote: Few thoughts - Pathfinding is extremely intensive. For sim purposes, how hard to rip out current pathfinder and replace with some stupid algorithm if i can say "all units move in a 50x50 grid only"


Pathfinding is useful, don't know why you'd rip it out, I think planes use a more simplified pathfinding, maybe use plane movement.
Dragon45 wrote: Well known is that graphics is intensive; toning down or replacing current graphics engine with some sprite based shit is not easy because of lack of modularity in engine.


Custom maps and models, quickly eliminate this problem. The limits are going to be CPU based though, changing the graphics won't do anything as most graphics cards are pretty powerful anyway. Just don't have water/shadows.
Dragon45 wrote: Finally, distributed computing - suppose funky thing i did with setup "magic zones" - galactic gate; an agent is moved into a completely different independent simulation (or gene bank)? via such a "zone"; scatter multiple zones in the maps. Script zones in LUA, add message passing between persistent servers running this sim so that they can transfer agents amongst each other in vastly different environments (or same?).

Suddenly distributed computing capabilities which again few other sims have.
I vaguely see what you're saying, would be interesting to see something like this but it would likely be easier to add this to your own custom sim than it would be for spring. Issues would be how do you make unit A on the edge of zone A on server A be aware of units B, C and D on the edge of zone B on server B and vice versa. FOV would be overlapping between zones of different servers which is a difficult problem.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Using spring for a-life/multiagent simulation?

Post by Argh »

I think planes use a more simplified pathfinding, maybe use plane movement.
They're far more expensive than anything else, when you factor in the rest of their sim code.
Multiple AIs each with a single unit would work as an example of a spring multi-agent system.
They have "AIs", but they're extremely simplistic and specialized. The good news is that you could just do it in Lua, and I suspect that if you don't make them make decisions very often, it'll work just fine.
Most units in spring have a very limited view and spend the majority of the time with few units within their view to actually interact with, only collision detection with friendlies and turret position + maybe basic movement with an enemy on the screen.
Only in *As. In P.U.R.E., units see a lot further, and often have to deal with crowds. And yes, that's CPU-intensive.
Well known is that graphics is intensive; toning down or replacing current graphics engine with some sprite based shit is not easy because of lack of modularity in engine.
It's not like you have to build some custom blitting engine, when OpenGL is already hardware-accelerated and is going to be faster than whatever you'd hack together anyhow.

I mean... use point sprites against a black quad, don't draw the map at all. It's about as cheap as any other method, and it's already there in the engine, or could be added as a special case, if you don't even want the minimal Lua overhead for doing that part via Lua (which is probably smart, since that's a non-frame-bound activity). You could probably gut the part that sends the geometry to the fragment program and just draw a colored quad right there. Since the other extant sections would be dealing with tricounts of zero, it's not like they eat up a lot of CPU anyhow. Not hard.



Overall, I'm less skeptical about this idea than I was about the proposal to make a Spore clone, but I think that Spring's mainly un-suitable for serious purposes in that genre, and you vastly overestimate its efficiency.

If you just want to work on self-directing agents, do it in Lua- that's something I'm actually interested in, but have no time to develop atm. It's not terribly hard, to build simple behaviors- the challenge is coming up with the relationships between items- "this is food", "this is a scary predator", etc., and make it all come together- not a minor task. I'd be more than happy if somebody ever implemented basic flocking algorithms and other basics of sim, though, to better-regulate "herds" of animals in a context like World Builder, and built group-signaling code that told "herds" to initiate common behaviors ("now it's time for all of us to spread out and munch some grass", etc.) where I'd like to see organic stuff moving around in a way that at least looked purposeful.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Re: Using spring for a-life/multiagent simulation?

Post by Dragon45 »

souledge wrote:I vaguely see what you're saying, would be interesting to see something like this but it would likely be easier to add this to your own custom sim than it would be for spring. Issues would be how do you make unit A on the edge of zone A on server A be aware of units B, C and D on the edge of zone B on server B and vice versa. FOV would be overlapping between zones of different servers which is a difficult problem.
No FOV; no awareness. Just straight transportation/mp
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Re: Using spring for a-life/multiagent simulation?

Post by Dragon45 »

argh - what's missing in the LUA for this to happen? i thought most of these primitives were already in place.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Using spring for a-life/multiagent simulation?

Post by Beherith »

Port JADE into the java ai module for spring.
Post Reply

Return to “Engine”