Giving senses to AI
So here we go, another Friday and another opportunity to write something up about the game.
I've been knee deep in a sensor feature of the AI this week, basically the way it works is, if I want the AI to know about it's surrounding, I want a circle which is a sensor for this area.
As Items come into the area and leave it, they are added to a list of things on the sensor.
Here's a visualization of what that looks like:
The idea comes from the fact I want some form of stealth in the game, or at least ways to sneak in some form. Here is the original design I put into the game for this, and so I've tried to follow that verbatim, i.e. make a circle, and things in that circle have been "sensed".
So the initial testing for it works, they can sense the objects inside their circle... It does this using the Physics library I'm using called MatterJS... But yknow what, after implementing it - I feel it might not be the most optimal.. Sometimes it slows down if there are too many objects in the scene.
For now i'm going to leave it in, but I've got a sneaky feeling that I will rewrite this at some point. I'll have the same functionality but be built in a different way.
==Update 27/06/2021==
Turns out I've rewritten it! It follows exactly the same rules without using Matter.js physics.
It's simple really, in the thread used for calculating states, I simple loop through rendered life objects (which is a short list) and calculate which ones are within the distances... It instantly relieved the CPU massively.
Dead Desert [Superseded]
Free roam adventuring on a desert planet with a mixture of wild west, sci fi and fantasy
Status | In development |
Author | aJamDonut |
Genre | Simulation, Adventure, Role Playing, Survival |
Tags | City Builder, Creepy, Multiple Endings, Open World, Sci-fi, Singleplayer |
More posts
- Towns & POI'sApr 07, 2023
- Quiet progressApr 06, 2023
- Motorbikes and other cool stuff Pre-alpha 0.4.0Jul 24, 2022
- Little delays and fresh eyes soonApr 07, 2022
- Hauling and CraftingMar 05, 2022
- Why build a baseFeb 23, 2022
- Different game startsFeb 17, 2022
- Nearly ready for alpha!Feb 09, 2022
- Pre-Alpha 0.3 launched - Taking donations!Jan 30, 2022
- Pre Alpha 0.3 Patch NotesJan 30, 2022
Leave a comment
Log in with itch.io to leave a comment.