28.12.2017, 03:37
(This post was last modified: 10.03.2019, 01:58 by HammelGammel.)
Description:
This is still WIP, so expect bugs
Please report any problems you find, here: Issue Tracker
Wiki (WIP): Wiki Home
Current version: 2.6.3
Adds synchronized bots with AI.
![[Image: ugpFzRJ.png]](https://i.imgur.com/ugpFzRJ.png)
I am aware that there are already multiple threads with similar projects, but I do believe that this is not just another attempt to synchronize bots. What I am trying to achieve is a simple to use, complete package to a simple bot/AI system anybody can use with minimal effort.
Among the current features of the bots are:
Installation:
Usage:
Spawning:
Basics:
AI:
Examples:
Animation:
Bots have an AnimTypeComponent, which holds registered animations for this type of bot. Similar bots share the same AnimTypeComponent.
existing animation types (eg. bot.setAnimTypeComp(ANIMTYPE_HUMAN) -> bot uses human animations):
examples:
Some registered animation sequences for humans are:
Combat:
Bots have a CombatTypeComponent, which holds attributes that define combat behaviour. Similar bots share the same CombatTypeComponent.
existing combat types (eg. bot.setCombatTypeComp(COMBATTYPE_HUM_1H) -> bot behaves like human with onehanded weapon):
Events:
Commands:
By default, a bunch of bots are spawned in the newworld monastery. They have schedules implemented (work by day, sleep by night) and are capable of fighting enemies.
If you want to test combat go to server/placement/NewWorld.nut and remove comments to spawn a bunch of enemy factions in the newworld monastery.
Download
Repository
This is still WIP, so expect bugs
Please report any problems you find, here: Issue Tracker
Wiki (WIP): Wiki Home
Current version: 2.6.3
Adds synchronized bots with AI.
![[Image: ugpFzRJ.png]](https://i.imgur.com/ugpFzRJ.png)
I am aware that there are already multiple threads with similar projects, but I do believe that this is not just another attempt to synchronize bots. What I am trying to achieve is a simple to use, complete package to a simple bot/AI system anybody can use with minimal effort.
Among the current features of the bots are:
- Synchronization
- Warning, chasing and attacking players or other bots
- Faction system
- Pathfinding using waypoints
- Immversive respawn
- Schedules to be executed at set times of day (ingame time) (send your bot to sleep at 20:00h, wake up at 8:30h for example)
- Optional module to add hostile bots to the world by default
- Or better: look into writing a basic Daedalus parser to convert singleplayer NPCs partially to synchronized bots. Possible? (no promises)
- Parrying (wip-system was taken out for now)
- Dialogue system (look GUI system)
Installation:
- Install my utility scripts: download
- Extract G2O_Module_BotCreator.7z
- Move resulting folder in the root folder of your server
- Add the following to your config.xml:
Code:
<!-- Module BotCreator -->
<import src="G2O_Module_BotCreator/scripts.xml" />
Usage:
Spawning:
Code:
local bot = BotHuman(name, x, y, z, angle, world)
local bot = BotMonster(name, x, y, z, angle, world)
local bot = BotOrcWarrior(name, x, y, z, angle, world)
local bot = BotOrcElite(name, x, y, z, angle, world)
local bot = BotOrcShaman(name, x, y, z, angle, world)
local bot = BotSkeleton(name, x, y, z, angle, world) //clients crash when skeleton dies - don't think that can be fixed by me
Basics:
Code:
bot.setWorld(world)
bot.setInstance(instance)
bot.setPosition(x, y, z)
bot.setAngle(angle)
bot.playAni(ani)
bot.stopAni()
bot.setWeaponMode(mode)
bot.setMaxHealth(maxHealth)
bot.setHealth(health)
bot.setStrength(strength)
bot.setDexterity(dexterity)
bot.setOneH(oneH)
bot.setTwoH(twoH)
bot.setBow(bow)
bot.setCBow(cBow)
bot.equipArmor(armor)
bot.equipMeleeWeapon(meleeWeapon)
bot.equipRangedWeapon(rangedWeapon)
bot.equipShield(shield)
bot.equipHelmet(helmet)
bot.setVisuals(bodyModel, bodyTexture, headModel, headTexture)
bot.setFatness(fatness)
AI:
Code:
bot.getFactionComp().addToFaction(factionname)
bot.getScheduleComp().returnToSchedule(time)
bot.getScheduleComp().addGoto(hour, min, x, y, z) // at given time, goto coordinates using waypoints
bot.getScheduleComp().addSetAngle(hour, min, angle) // at given time, immediately set angle
bot.getScheduleComp().addTurn(hour, min, angle) // at given time, smoothly turn to angle
bot.getScheduleComp().addPlayAni(hour, min, ani, aniLength = 1000) // at given time, play animation once
bot.getScheduleComp().addPlayRandomAni(hour, min, ani, aniLength = 1000) // at given time, play random animation of an animation sequence once
bot.getScheduleComp().addRepeatAni(hour, min, ani, aniLength = 1000, repeatCount = 0) // at given time, repeat animation for repeatCount times (0 = infinitely)
bot.getScheduleComp().addRepeatRandomAni(hour, min, ani, aniLength = 1000, repeatCount = 0) // at given time, repeat random animation of animation sequence
bot.getScheduleComp().addSleep(hour, min, wp, angle) // at given time, go to wp, turn to angle and start sleeping
Examples:
Code:
local novice = BotHuman("novice", 47034, 4990, 19750, 99);
//if registered for the same time of day, the schedule that was added first, will be executed first and vice versa
novice.getScheduleComp().addGoto(15, 0, 47019, 5090, 21527); //at 15:0h, go to 47019|5090|21527
novice.getScheduleComp().addTurn(15, 0, 330); //at 15:0h, turn to angle 330
novice.getScheduleComp().addPlayAni(15, 0,"T_STAND_2_PRAY"); //at 15:0h, play animation "T_STAND_2_PRAY"
Code:
local novice = BotHuman("novice", 47034, 4990, 19750, 99);
novice.getScheduleComp().addSleep(20, 0, "NW_MONASTERY_NOVICE01_06", 238);
Animation:
Bots have an AnimTypeComponent, which holds registered animations for this type of bot. Similar bots share the same AnimTypeComponent.
existing animation types (eg. bot.setAnimTypeComp(ANIMTYPE_HUMAN) -> bot uses human animations):
- ANIMTYPE_HUMAN
- ANIMTYPE_MONSTER
- ANIMTYPE_ORC
- ANIMTYPE_SKELETON
Code:
bot.playNextAni(identifier)
bot.playPrevAni(identifier)
bot.playRandomAni(identifier)
bot.playAniAt(identifier, at)
examples:
Code:
bot.playNextAni("attack1h") // plays attackanimations in succession
bot.playPrevAni("attack1h") // plays attackanimations in succession - reversed
bot.playRandomAni("attack1h") // plays attackanimations at random
bot.playAniAt("attack1h", 0) // plays first-registered attackanimation
Some registered animation sequences for humans are:
- "die"
- "run"
- "walk"
- "warn"
- "jumpBack"
- "strafe"
- "sleep"
- "wakeup"
- "draw"
- "sheath"
- "attack1h"
- "attack2h"
- "attackFist"
Combat:
Bots have a CombatTypeComponent, which holds attributes that define combat behaviour. Similar bots share the same CombatTypeComponent.
existing combat types (eg. bot.setCombatTypeComp(COMBATTYPE_HUM_1H) -> bot behaves like human with onehanded weapon):
- COMBATTYPE_HUM_FIST
- COMBATTYPE_HUM_1H
- COMBATTYPE_HUM_2H
- COMBATTYPE_MONSTER
- COMBATTYPE_ORC_2H
- COMBATTYPE_SKELETON_2H
Events:
- onBotDead(botId, killerId)
- onBotRespawn(botId)
- onBotInView(botId)
- onBotOutOfView(botId)
- onBotHit(botId, enemyId)
- onBotTakeDamage(botId, killerId)
- onPlayerHitBot(playerId, botId, dmg)
Commands:
- /botidle <botid>: bot cancels what he is currently doing
- /botschedule <botid>: bot returns to his current schedule
- /botgoto <botid>: sends bot to current position of player
- /botturn <botid>: makes bot turn to current angle of player
- /botstopani <botid>: makes bot stop current animation
- /botrun <botid> <0-1>: toggles bot walking/running mode
- /destroybot: <botid>: destroys bot on server and all clients
- /pos: shows coordinates of player in the chat
- /angle: shows angle of player in degrees in the chat
- /tpbot <fromId> <toId>: teleports player to bot or bot to player
By default, a bunch of bots are spawned in the newworld monastery. They have schedules implemented (work by day, sleep by night) and are capable of fighting enemies.
If you want to test combat go to server/placement/NewWorld.nut and remove comments to spawn a bunch of enemy factions in the newworld monastery.
Download
Repository