[MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

[MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Mon Sep 26, 2016 17:18

Sofar's Monster/Entity AI

See: https://github.com/sofar/entity_ai

Important Notice: This project is a work in progress and has an unusual license. Before contributing please read https://github.com/sofar/entity_ai/blob/master/readme.md.

This code may not work at all. The API is not stable.

TL:DR: the mod is AGPL-3.0/CC-BY-ND-4.0, but the CLA permits me(sofar) to submit all contributions to minetest_game and relicense it more permissively and compatible with mtg. If you contribute to this project you agree to these terms.

Youtube video about this code: https://www.youtube.com/watch?v=7_nUQRWeD7Y&list=PL0q7atYslWifTuX60rtCaocQiYUSdtZJP&index=4

Image
Last edited by sofar on Mon Sep 26, 2016 17:33, edited 2 times in total.
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Mon Sep 26, 2016 17:19

So what is in this code?

- A pluggable API with support for all base stuff that monsters need to do (like walk, find specific nodes, run away from aggressor or attack).
- Monsters are entirely created by tables, not code. Monsters are defined as tables that specify the behavior and how to react to changes.
- Path code can be improved on benefiting all monsters
- State transitions are inherent part of each monster, monsters can behave entirely different based on a state transition. For instance, you could change textures of the monster, or become aggressive
- Two modeled monsters, with two full state tables.
- Sheep is mostly complete
- Stone Giant needs more states finished and a few bits of AI code written to be complete

Yes, it's Lua code. I've determined that for single player content Lua is perfectly fine and minetest can handle the load well. I don't intend to make this monster API useful or even performant for multiplayer (although I think it'll do just fine). If this doesn't work well in multiplayer, I don't care.
 

User avatar
Ferk
Member
 
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by Ferk » Mon Sep 26, 2016 17:55

Awesome! I like how the AI tables look like declarative programming. Which is quite appropriate for AI.

Though it might make sense to separate the animation/sound definitions from the AI table so it could be possible to reuse the same AI for more than one mob (eg. chickens and sheeps may have similar behavior but different sounds/animations, for people who might find complex to change the AI but still want to make a mob).
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
cHyper
Member
 
Posts: 762
Joined: Fri May 06, 2011 08:49
Location: Austria
GitHub: cHyper-0815OL
IRC: cHyper
In-game: cHyper
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Mon Sep 26, 2016 18:09

Ferk wrote:Though it might make sense to separate the animation/sound definitions from the AI table so it could be possible to reuse the same AI for more than one mob


The AI is entirely outside of the monster definition table, so it's all reusable.

The setup is done in such a way that AI code parts are not part of the monster table, the monster table just specifies the API methods available (think of it as a library of AI code bits).

I've called these code bits "drivers", and they currently live in init.lua. Both monsters in the code currently use many of the same drivers.
 

User avatar
Ferk
Member
 
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by Ferk » Mon Sep 26, 2016 19:18

sofar wrote:The setup is done in such a way that AI code parts are not part of the monster table, the monster table just specifies the API methods available (think of it as a library of AI code bits).


That's nice. But as the driver ecosystem grows maybe the state definition with the parameters for the drivers could become more complex. Maybe the states could be defined in a sub-table?

So we can do something like:

Code: Select all
local rabbit_script = {
    driver = "roam",
    properties = {  ..... rabbit specific properties ... },
    animations = { .... rabbit specific animations ... },
    sounds = {  .... rabbit specific sounds ... },
    states = sheep_script.states
}


Then the parameters for each of the "driver-driven" states can be shared, and perhaps use the properties for slight variations.

This is just brainstorming, though. I find the overall design very interesting.

It could be fun to play with it and see how the entities interact... like having wolfs that hunt sheeps and see how the sheeps flee and react.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Mon Sep 26, 2016 19:28

Ferk wrote:This is just brainstorming, though.


The layout of the tables itself is up for discussion - I think the layout shows you want my intentions are - providing state drivers with the specific state information needed for that driver.

My approach was to come from the `state` angle and then table off of that. Other approaches may be better, but it's entirely arbitrary for the code - it just serves readability.
 

User avatar
Ferk
Member
 
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by Ferk » Mon Sep 26, 2016 20:16

@sofar, could you clarify this part of the license?:

1) you can re-distribute the artwork, but only if you: a) properly attribute b) do not modify the code


"do not modify the code" as in the code of the mod?

Does that mean it's not possible to make pull requests in github? as this would involve editing the code and having the assets in the forked repo. Also this would mean the artwork is actually under a different license than CC-BY-ND-4.0, since I believe this one would not have that limitation (even though it's also sadly restricted in that it doesn't allow modifications of the artwork...).
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Mon Sep 26, 2016 20:31

Ferk wrote:
1) you can re-distribute the artwork, but only if you: a) properly attribute b) do not modify the code


Does that mean it's not possible to make pull requests in github?


You can modify the code, permitted you use it for your own purposes, or make it available to users who play on your server, and make it available to anyone. If you only modify the code, and you have not modified the artwork, the -ND clause does in the artwork does not activate.

If you modify the artwork, you can not redistribute it. Of course, you can submit a PR change at all times back to my github repo, that may be technically "distributing" but in the spirit of the project is exactly what we want - you're not going to get into trouble for that.

So basically, forking for the purpose of contributing the project is expressly permitted. The "personal use" clauses of the licenses allow that.
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Mon Sep 26, 2016 22:24

The readme originally stated:

Code: Select all
1) you can re-distribute the artwork, but only if you: a) properly attribute b) do not modify the code


But that's supposed to read:

Code: Select all
1) you can re-distribute the artwork, but only if you: a) properly attribute b) do not modify the artwork


Hopefully that clarifies everyone's understanding now. I've fixed it up in the repo.
 

zorman2000
Member
 
Posts: 83
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by zorman2000 » Mon Oct 24, 2016 22:18

Is development on this stalled? It would be a pity, since it looks promising!
 

User avatar
azekill_DIABLO
Member
 
Posts: 7461
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Sat Oct 29, 2016 08:33

zorman2000 wrote:Is development on this stalled? It would be a pity, since it looks promising!


I've been spending time on the upcoming minetest release, and getting a bunch of other features in minetest_game that needed help, so yes, this has taken a bit of a pause on my schedule. No worries though, I'll get back to it soon.
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by Wuzzy » Sat Oct 29, 2016 19:12

sofar wrote:CC-BY-ND-4.0

:-(
Last edited by Wuzzy on Sat Oct 29, 2016 19:22, edited 1 time in total.
My creations. I gladly take any bitcoins you have lying around: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Sat Oct 29, 2016 19:17

Wuzzy wrote:
CC-BY-ND-4.0

:-(


Please read the full explanation why. Once this mod takes off, the -ND stuff goes away.
 

twoelk
Member
 
Posts: 1258
Joined: Fri Apr 19, 2013 16:19
Location: northern Germany
GitHub: twoelk
IRC: twoelk
In-game: twoelk

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by twoelk » Tue Dec 13, 2016 14:23

Contributor License Agreement wrote: (1) you expressly guarantee that you are the sole author of all
parts of the contribution.


so I can not adjust a random mob from another mod to work with this?
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Fri Dec 16, 2016 03:48

twoelk wrote:so I can not adjust a random mob from another mod to work with this?


Only if you are the sole author of that mob, or the assets. If someone would accidentally put in a model or code that has an incompatible license, it would make the project unmergable into minetest_game, which is the end goal.
 

User avatar
Stix
Member
 
Posts: 1305
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: nil
In-game: Stix [+alts]

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by Stix » Wed Aug 30, 2017 18:53

Ive noticed the last commit to github was 5 months ago, does this mean this project is dead?
Hey, what can i say? I'm the bad guy.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

sofar
Developer
 
Posts: 1775
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [MOD] entity_ai - monster AI Framework [entity_ai] [WIP]

by sofar » Wed Aug 30, 2017 20:26

Stix wrote:Ive noticed the last commit to github was 5 months ago, does this mean this project is dead?


No. This is still high on my priority list.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7461
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 


Return to WIP Mods



Who is online

Users browsing this forum: wziard and 1 guest