Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[0.1.3] [client/server] BotCreator
#1
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]

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)
Among the planned features are:
  • 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:

  1. Install my utility scripts: download
  2. Extract G2O_Module_BotCreator.7z
  3. Move resulting folder in the root folder of your server
  4. 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
Animations are stored in the form of animation sequences. They can either be played at random, at a certain index or in succession. Animation sequences can be played through these methods:

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
Reply


Messages In This Thread
[0.1.3] [client/server] BotCreator - by HammelGammel - 28.12.2017, 03:37

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Server] ORM Quarchodron 3 3,445 08.07.2020, 10:19
Last Post: Quarchodron
  [0.1.3] [server] ItemGroundSpawner HammelGammel 1 4,043 05.02.2020, 18:40
Last Post: demor140202
  [Client] Version check Quarchodron 2 4,015 25.08.2019, 14:06
Last Post: Quarchodron
  [Client] GUI Creator Quarchodron 6 7,525 12.08.2019, 23:05
Last Post: Arkhan
  [New G2O][Client-Side] bindKey Patrix 6 8,971 14.11.2018, 02:32
Last Post: Patrix
  [0.1.4.*] [client/server] Simple anty-cheat Profesores 8 10,253 20.03.2018, 19:16
Last Post: Patrix
  [0.1.3] [client/server] Utility Scripts HammelGammel 1 5,255 27.01.2018, 14:03
Last Post: HammelGammel
  [G2O v.0.1.2][Server-Side] NPC Manager Quarchodron 16 17,493 21.01.2018, 19:59
Last Post: Quarchodron
  [New G2O][Client-Side] Key Combination Patrix 1 3,785 23.12.2017, 13:16
Last Post: Patrix
  [CLIENT]Draw(Line/Color) Tommy 0 3,118 19.12.2017, 04:23
Last Post: Tommy

Forum Jump:


Users browsing this thread: 1 Guest(s)