[Mod] Alive AI V26.32 [aliveai]

Post Reply
User avatar
Diamond knight
Member
Posts: 475
Joined: Sun Apr 19, 2015 19:50
GitHub: Diamondknight
In-game: Ferrumprinceps
Location: Chilling in Constantinople
Contact:

Re: [Mod] Alive AI V3 [aliveai]

by Diamond knight » Post

I want a setting to turn that stuff off for bot player functionality if so

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3 [aliveai]

by AiTechEye » Post

a question is, in v3 i added a function, that makes bots give there stuff (not tools) to a bot that have more stuff, to make more chance to someone build a house. (teamwork)

so if you make a bunch of bots by same team will you see that, they works like ants.
Im thinking of, make the folk14 (the robot kind) only have the function (+ add a helpwork group)

and make the other give stuff to someone that asks for it.

what do you think?
could you add EXP/ranks/classes/job system?
we can make special battle bots for that, checkout this
its easy to make bots for aliveai, just to disable stuff you dont want and let it do the stuff by self.
you can also make 99% control over the bots

Code: Select all

aliveai.create_bot({
		attack_players=1,
		name="battle_bot1",
		team="battle1",
		texture="aliveai_skin2.png",
		attacking=1,
		talking=0,
		escape=0,
		hp=20,
		dmg=0,
		building=0,
	on_spawn=function(self)
		self.exp=0
		self.damage=4
		self.battle=true
	end,
	on_punching=function(self,target)

-- killing someone

		if aliveai.gethp(target)<1 then
			self.exp=self.exp+1
			self.damage=self.damage+2
-- get steel sword
			if self.exp==4 then
				aliveai.invadd(self,"default:sword_steel",1)
			end
-- get bronze sword
			if self.exp==8 then
				aliveai.invadd(self,"default:sword_bronze",1)
			end
-- can build
			if self.exp==10 then
				self.building=1
			end
		else
-- punching
			target:punch(self.object,1,{full_punch_interval=1,damage_groups={fleshy=self.damage}},nil)
		end
	end,

-- add bonus exp to the killer, if its a bottle bot

	on_death=function(self,puncher,pos)
		local en=puncher:get_luaentity()
		if en and en.aliveai and en.battle then
			local exp1=math.floor(self.exp4)
			local exp2=puncher:get_luaentity().exp
			puncher:get_luaentity().exp=exp2+exp1
		end
	end,
})

nuxed
New member
Posts: 8
Joined: Wed Feb 15, 2017 16:20

Re: [Mod] Alive AI V3 [aliveai]

by nuxed » Post

can you make a guide on what to do with that code and where to put it and label it?

all my NPCs just dig holes.

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3 [aliveai]

by AiTechEye » Post

There are a lot of description in the readme file.
and just to copy code from the aliveai mod to test and try (i learnt programing in that way)
It doesnt mather what you call the mod folder.
Attachments
aliveai_battle.zip
(829 Bytes) Downloaded 30 times

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

Re: [Mod] Alive AI V3 [aliveai]

by azekill_DIABLO » Post

this mod is purely awesome!

User avatar
jimy
Member
Posts: 25
Joined: Mon Mar 12, 2012 22:15

Re: [Mod] Alive AI V3 [aliveai]

by jimy » Post

This mod seems amazing, and is a revolution for every mobs mods !
I tried it but I encoutered some problems.

It's probably a stupid note, but It seems that this mod doesn't work on the latest minetest: I tried it with minetest 0.4.15-dev.
first I need to replace all "ï" from items.lua by UTF-8 "i", else minetest is not able to load the mod.
Then when I start the game and I see bots starting (beginning to search what to do), there is a crash on one of the "for i, v in pairs(relist)" near line 527 of file items.lua
minetest raises the following kind of backtrace:

Code: Select all

2017-02-22 16:24:07: WARNING[Main]: Couldn't find a locale directory!
2017-02-22 16:24:07: [Main]: Automatically selecting world at [/home/jimy/minetest-master/bin/../worlds/truc]
Loaded texture: /home/jimy/minetest-master/textures/base/pack/menu_header.png
2017-02-22 16:24:25: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
[aliveai] default/character.b3d is used as default model
[aliveai] api Loaded
[aliveai] loaded: aliveai:bot
[aliveai] loaded: aliveai:bot2
[aliveai] loaded: aliveai_trader:trader
[aliveai] loaded: aliveai_threats:nitrogen
[aliveai] loaded: aliveai_threats:gassman
[aliveai] loaded: aliveai_threats:nitrogenblow
[aliveai] loaded: aliveai_threats:terminator
[aliveai] loaded: aliveai_threats:pull_monster
[aliveai] loaded: aliveai_threats:cockroach
[aliveai] loaded: aliveai_threats:ninja
[aliveai] loaded: aliveai_threats:quantum_monster
[aliveai] loaded: aliveai_folk:folk1
[aliveai] loaded: aliveai_folk:folk2
[aliveai] loaded: aliveai_folk:folk3
[aliveai] loaded: aliveai_folk:folk4
[aliveai] loaded: aliveai_folk:folk5
[aliveai] loaded: aliveai_folk:folk6
[aliveai] loaded: aliveai_folk:folk7
[aliveai] loaded: aliveai_folk:folk8
[aliveai] loaded: aliveai_folk:folk9
[aliveai] loaded: aliveai_folk:folk10
[aliveai] loaded: aliveai_folk:folk11
[aliveai] loaded: aliveai_folk:folk12
[aliveai] loaded: aliveai_folk:folk13
[aliveai] loaded: aliveai_folk:folk14
[aliveai] loaded: aliveai_folk:folk15
2017-02-22 16:24:25: ACTION[Main]:         .__               __                   __   
2017-02-22 16:24:25: ACTION[Main]:   _____ |__| ____   _____/  |_  ____   _______/  |_ 
2017-02-22 16:24:25: ACTION[Main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
2017-02-22 16:24:25: ACTION[Main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  |  
2017-02-22 16:24:25: ACTION[Main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__|  
2017-02-22 16:24:25: ACTION[Main]:       \/        \/     \/          \/     \/        
2017-02-22 16:24:25: ACTION[Main]: World at [/home/jimy/minetest-master/bin/../worlds/truc]
2017-02-22 16:24:25: ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:30000.
2017-02-22 16:24:26: ACTION[Server]: machin [127.0.0.1] joins game. 
2017-02-22 16:24:26: ACTION[Server]: machin joins game. List of players: machin
C3I1EFIU4C: loaded
C3I1EFIU4C: bot loaded
2QPGW6Tu76147g: loaded
2QPGW6Tu76147g: bot loaded
2QPGW6Tu76147g: mine
2QPGW6Tu76147g: check neartarget
2QPGW6Tu76147g: tower path
2QPGW6Tu76147g: bridge path
2QPGW6Tu76147g: mine
C3I1EFIU4C: search objects
2QPGW6Tu76147g: search objects
C3I1EFIU4C: drop all items
C3I1EFIU4C: drop dead body
2017-02-22 16:24:44: ACTION[Server]: LuaEntitySAO at (-610,23.8,1614) punched by LuaEntitySAO at (-610,23.8,1614), damage 160 hp, health now 0 hp
2QPGW6Tu76147g: search objects
2QPGW6Tu76147g: searching
2QPGW6Tu76147g: find node
2QPGW6Tu76147g: need: default:chest 1 search default:chest have: 0 time: 5
2QPGW6Tu76147g: need: default:chest 1 search default:chest have: 0 time: 5
2QPGW6Tu76147g: find node
2QPGW6Tu76147g: check neartarget
2QPGW6Tu76147g: check neartarget
2QPGW6Tu76147g: tower path
2QPGW6Tu76147g: check neartarget
2QPGW6Tu76147g: need: default:dirt 156 search group:soil have: 3 time: 5
2QPGW6Tu76147g: need: default:dirt 156 search group:soil have: 3 time: 5
2017-02-22 16:24:48: ACTION[Server]:  digs default:dirt_with_dry_grass at (-622,15,1625)
2QPGW6Tu76147g: dig default:dirt_with_dry_grass
2017-02-22 16:24:48: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'xpanes' in callback luaentity_Step(): invalid key to 'next'
2017-02-22 16:24:48: ERROR[Main]: stack traceback:
2017-02-22 16:24:48: ERROR[Main]:       [C]: in function '(for generator)'
2017-02-22 16:24:48: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:532: in function 'crafting'
2017-02-22 16:24:48: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:285: in function 'haveneed'
2017-02-22 16:24:48: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:203: in function 'invadd'
2017-02-22 16:24:48: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:356: in function 'dig'
2017-02-22 16:24:48: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/event.lua:972: in function 'mine'
2017-02-22 16:24:48: ERROR[Main]:       .../minetest-master/bin/../mods/aliveai/aliveai/bot.lua:28: in function <.../minetest-master/bin/../mods/aliveai/aliveai/bot.lua:2>
2017-02-22 16:24:48: ACTION[Server]: machin leaves game. List of players: 
AL lib: (WW) FreeContext: (0x232c880) Deleting 1 Source(s)
AL lib: (WW) FreeDevice: (0x21818f0) Deleting 84 Buffer(s)
Loaded texture: /home/jimy/minetest-master/textures/base/pack/menu_header.png

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3 [aliveai]

by AiTechEye » Post

which download are you using? github or the forum?

User avatar
jimy
Member
Posts: 25
Joined: Mon Mar 12, 2012 22:15

Re: [Mod] Alive AI V3 [aliveai]

by jimy » Post

AiTechEye wrote:which download are you using? github or the forum?
Well, this backtrace is from the version posted on the forum, But I tried both, and there is also a problem with the github version.

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3.1 [aliveai]

by AiTechEye » Post

try v3.1 if there is any difference

download/file.php?id=9159

User avatar
jimy
Member
Posts: 25
Joined: Mon Mar 12, 2012 22:15

Re: [Mod] Alive AI V3.1 [aliveai]

by jimy » Post

After replaced "self.fínvist" by "self.finvist" into aliveai_threats/init.lua (it was this file and not items.lua)
I get the same kind of error:

Code: Select all

2017-02-22 18:34:34: WARNING[Main]: Couldn't find a locale directory!
2017-02-22 18:34:34: [Main]: Automatically selecting world at [/home/jimy/minetest-master/bin/../worlds/truc]
Loaded texture: /home/jimy/minetest-master/textures/base/pack/menu_header.png
2017-02-22 18:34:49: ERROR[Main]: The following mods could not be found: "aliveai_status"
2017-02-22 18:34:49: WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition
[aliveai] default/character.b3d is used as default model
[aliveai] api Loaded
[aliveai] loaded: aliveai:bot
[aliveai] loaded: aliveai:bot2
[aliveai] loaded: aliveai_trader:trader
[aliveai] loaded: aliveai_threats:nitrogen
[aliveai] loaded: aliveai_threats:gassman
[aliveai] loaded: aliveai_threats:nitrogenblow
[aliveai] loaded: aliveai_threats:terminator
[aliveai] loaded: aliveai_threats:pull_monster
[aliveai] loaded: aliveai_threats:cockroach
[aliveai] loaded: aliveai_threats:ninja
[aliveai] loaded: aliveai_threats:quantum_monster
[aliveai] loaded: aliveai_folk:folk1
[aliveai] loaded: aliveai_folk:folk2
[aliveai] loaded: aliveai_folk:folk3
[aliveai] loaded: aliveai_folk:folk4
[aliveai] loaded: aliveai_folk:folk5
[aliveai] loaded: aliveai_folk:folk6
[aliveai] loaded: aliveai_folk:folk7
[aliveai] loaded: aliveai_folk:folk8
[aliveai] loaded: aliveai_folk:folk9
[aliveai] loaded: aliveai_folk:folk10
[aliveai] loaded: aliveai_folk:folk11
[aliveai] loaded: aliveai_folk:folk12
[aliveai] loaded: aliveai_folk:folk13
[aliveai] loaded: aliveai_folk:folk14
[aliveai] loaded: aliveai_folk:folk15
2017-02-22 18:34:49: ACTION[Main]:         .__               __                   __   
2017-02-22 18:34:49: ACTION[Main]:   _____ |__| ____   _____/  |_  ____   _______/  |_ 
2017-02-22 18:34:49: ACTION[Main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
2017-02-22 18:34:49: ACTION[Main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  |  
2017-02-22 18:34:49: ACTION[Main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__|  
2017-02-22 18:34:49: ACTION[Main]:       \/        \/     \/          \/     \/        
2017-02-22 18:34:49: ACTION[Main]: World at [/home/jimy/minetest-master/bin/../worlds/truc]
2017-02-22 18:34:49: ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:30000.
2017-02-22 18:34:49: ACTION[Server]: jimy [127.0.0.1] joins game. 
2017-02-22 18:34:49: ACTION[Server]: jimy joins game. List of players: jimy
2017-02-22 18:35:00: ACTION[Server]:  digs default:stone at (-29,12,10)
2017-02-22 18:35:00: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'xpanes' in callback luaentity_Step(): invalid key to 'next'
2017-02-22 18:35:00: ERROR[Main]: stack traceback:
2017-02-22 18:35:00: ERROR[Main]:       [C]: in function '(for generator)'
2017-02-22 18:35:00: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:532: in function 'crafting'
2017-02-22 18:35:00: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:285: in function 'haveneed'
2017-02-22 18:35:00: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:203: in function 'invadd'
2017-02-22 18:35:00: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/items.lua:356: in function 'dig'
2017-02-22 18:35:00: ERROR[Main]:       ...inetest-master/bin/../mods/aliveai/aliveai/event.lua:993: in function 'mine'
2017-02-22 18:35:00: ERROR[Main]:       .../minetest-master/bin/../mods/aliveai/aliveai/bot.lua:27: in function <.../minetest-master/bin/../mods/aliveai/aliveai/bot.lua:1>
2017-02-22 18:35:00: ACTION[Server]: jimy leaves game. List of players: 
AL lib: (WW) FreeDevice: (0x305dd20) Deleting 84 Buffer(s)
Quit message received.
Loaded texture: /home/jimy/minetest-master/textures/base/pack/menu_header.png
[/size]

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3.1 [aliveai]

by AiTechEye » Post

this kind of weird errors are hard for solve, because there is nothing to find :-)

self.fínvist will only be true or nil, to check if the variable exist

but try to set enable_build=false in init.lua, it will disable build and crafting for all bots

User avatar
jimy
Member
Posts: 25
Joined: Mon Mar 12, 2012 22:15

Re: [Mod] Alive AI V3.12 [aliveai]

by jimy » Post

What version of lua are you using to compile minetest ? I think it can be due to my old version of the library, math.random from my library doesn't match with your usage of this function. When I change the parts of your code that is using math.random, there is no more problems with it. (I disabled crafting of course, so there is no more call to pairs())

User avatar
jimy
Member
Posts: 25
Joined: Mon Mar 12, 2012 22:15

Re: [Mod] Alive AI V3.12 [aliveai]

by jimy » Post

http://lua-users.org/lists/lua-l/2009-05/msg00389.html
for the error with items.lua:

Code: Select all

invalid key to 'next' ... in function '(for generator)'

Code: Select all

> As stated in the Lua reference manual, this means that during the
> iteration you are assigning to a key that didn't exist prior to the
> iteration.  This was the case in Lua 5.0, however the error is not
> guaranteed to happen each and every time.
[/size]
I compile minetest with liblua5.2 but the problem can still.

(When I replace all pairs() by ipairs() it works fine)

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3.12 [aliveai]

by AiTechEye » Post

Im using sfan5's builds (windows 64 bit)

viewforum.php?f=42

i was by confused by the diference between pairs and ipairs, and got this answere:

pairs is "array-like" and ipairs "map-like"
and when i tested:

pairs can handle: "a","b","c",["a"],["b"],["c"]
ipairs only: "a","b","c"

bell07
Member
Posts: 599
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Alive AI V3.12 [aliveai]

by bell07 » Post

i was by confused by the diference between pairs and ipairs, and got this answere:

pairs is "array-like" and ipairs "map-like"
and when i tested:
ipairs is for indexed arrays

Code: Select all

for index, value in ipairs( {a, b, c,}) do
   print(index, value)
end

1 a
2 b
3 c
pairs is for key/value arrays

Code: Select all

[code]for key, value in pairs( {a=b, c=d, e=f,}) do
   print(key, value)
end

a b
c d
e f

User avatar
jimy
Member
Posts: 25
Joined: Mon Mar 12, 2012 22:15

Re: [Mod] Alive AI V3.12 [aliveai]

by jimy » Post

ipairs is for indexed arrays
pairs is for key/value arrays
So using ipairs would avoid crash while iterating a list that is modified during the loop ?

bell07
Member
Posts: 599
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Alive AI V3.12 [aliveai]

by bell07 » Post

So using ipairs would avoid crash while iterating a list that is modified during the loop ?
There cannot be an answer in general that "ipairs" solves all problems. But what is exactly the problem? I do not know the code in detail..

An other problem. If I try your mod I get the error:

Code: Select all

2017-02-26 13:11:34: ERROR[Main]: ModError: Failed to load and run script from ~/.minetest/mods/staging-aliveai-modpack/aliveai_threats/init.lua:
2017-02-26 13:11:34: ERROR[Main]: ~/.minetest/mods/staging-aliveai-modpack/aliveai_threats/init.lua:761: 'then' expected near '�'
2017-02-26 13:11:34: ERROR[Main]: Siehe debug.txt für Details.
It seems the source is not UTF-8. I tried to convert them but without luck. Can you please use UTF-8 encoding in Lua files? Please do not use "enhanced ASCII characters" like "äöü" in variable names also.

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3.13 [aliveai]

by AiTechEye » Post

all .lua and readme files are now saved in UTF-8, (ANSI is the standard in msnote + had no idea of the difference)
depends.txt are still using ANSI becaouse it wont work with UTF-8 by some reason.

i suspect the special characters "í" came from my webbrowser (weird that it worked at all)

hope you will this one :P
they spawns everywhere, and are shooting
Image
Attachments
screenshot_20170227_000305.png
(239.41 KiB) Not downloaded yet

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3.29 [aliveai]

by AiTechEye » Post

Mind controller, let you remote control aliveai bots + mobs_redo mobs

Controls: (or see in liveai_minecontroller/readme for controlls)
sneak = exit

w/up = walk
s/down = run
s/down + JUMP = JUMPx2
jump = jump

hold use/leftclick = use bot tool (if it have one)
hold use/leftclick with controller on block = bot dig
place/rightclick with controller on block = place block (if the bot have as you have, left side of the controller)

punch with controller = bot punch
punch with controller on item = bot picks up

d/right & s/left = toggle bot self control

Image
Attachments
screenshot_20170228_132450.png
(677.2 KiB) Not downloaded yet
Last edited by AiTechEye on Wed Mar 01, 2017 15:08, edited 1 time in total.

bell07
Member
Posts: 599
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Alive AI V3.3 [aliveai]

by bell07 » Post

Can you pls. update github?

User avatar
AiTechEye
Member
Posts: 860
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: ¯\_(ツ)_/¯

Re: [Mod] Alive AI V3.3 [aliveai]

by AiTechEye » Post

its lordfingle that adding it to github

User avatar
lordfingle
Member
Posts: 65
Joined: Sat Apr 04, 2015 09:21
GitHub: eidy
IRC: lordfingle
In-game: lordfingle
Location: Australia
Contact:

Re: [Mod] Alive AI V3.31 [aliveai]

by lordfingle » Post

It's updated - I've been checking this about once a week. Remember that the latest version will always be here for now.
----------------------------------------------------------------------------------------------
Team Lead on "eidy- Love learning"
I like reading, walks on the beach and building edutech experiences in lua (Find out more in this post)
"Coming together is a beginning; keeping together is progress; working together is success." - Henry Ford

bell07
Member
Posts: 599
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] Alive AI V3.31 [aliveai]

by bell07 » Post

Tried the updated version, still broken for me.
Each lua file begins with a not printable character <U+FEFF> Wtf?
Which editor do you use for development? I use https://www.geany.org but on Linux, no clue how it is on Windows.

User avatar
Diamond knight
Member
Posts: 475
Joined: Sun Apr 19, 2015 19:50
GitHub: Diamondknight
In-game: Ferrumprinceps
Location: Chilling in Constantinople
Contact:

Re: [Mod] Alive AI V3.31 [aliveai]

by Diamond knight » Post

I used to use Lua editor 2010 but for some reason it stopped working one day (even re installing doesn't work) so I use wordpad, don't know what he uses though

User avatar
ErrorNull
Member
Posts: 222
Joined: Thu Mar 03, 2016 00:43

Re: [Mod] Alive AI V3.31 [aliveai]

by ErrorNull » Post

i use "pn" programmer's notepad. it's open source and works great food me. http://www.pnotepad.org
My Villagers Mod: [villagers]

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests