I have made some progress with the AI system. The AI is now capable of walking up and down complex stairs, and navigation confined spaces, and I can generate graphs in real time.
I am still having issues with transitioning to the graph, however.
I believe the issue has something to do with the floating origin system. When the world shifts, the position of the navigation graph graph becomes incorrect.
The improvements to the AI system have proven very complex to implement.
What I am trying to do is to dynamically load an AI navigation graph when a complex structure is created in the world.
I then want the AI to be able to transition onto and off of that AI navigation graph seamlessly.
I also need the AI to be able to navigate complex staircases, narrow corridors, confined spaces, etc.
I am making progress with this, and I have worked with dynamic navigation mesh generation before, but not transitioning a complex AI between graphs at run time.
I have added a state-machine system for the dynamic story.
It doesn’t yet have support for branching storylines with multiple outcomes, but it does handle dynamic stories.
The next goal is to add complex improvements to the AI system that can hook into the dynamic story.
I have also improved the item and inventory system, and added lockable doors, lockpicks, and various other item interaction abilities, that also tie into the dynamic story system.
I have added the ability to dynamically spawn objects anywhere on the terrain. I am using this ability to spawn buildings close to, but out of view, of the player.
This will be the basis for the dynamic story system.
I have also added the ability to randomly spawn items, such as tools, etc, within each of the random buildings that are spawned.
There were some issues with rotation and height offset for these buildings and items, but these seem to be resolved now. I still haven’t added correct collision detection though.
I have made some minor improvements and bug fixes to the stairs script in this project.
I have also started working on improvements and additions to the dynamic story system. I am working on stories that can be automatically triggered at random points in the game, when certain conditions have been met.
The story will also take into account various conditions as it progresses, and adjust itself depending on the state of the world, the users actions, etc.
I believe I have mostly fixed the stair climbing physics changes.
I actually used a combination of techniques. First, I used a trigger to disable the gravity while the player is on the stairs, this prevents the player from sliding back down the stair ramp, and allows them to easily climb the ramp (since there’s no gravity preventing them).
Then, I used raycasting to keep the player aligned with the stair surface (since, without gravity, the player would float in midair).
This worked reasonably well, but there was a problem: without gravity, there was no friction, so when the player would stop moving their character, the character would glide or float some distance before finally stopping. This was awkward and unrealistic.
So, to solve this, I simply added back in gravity, but this time, I changed the gravity vector to the inverse of the surface normal that the player was walking over.
So, essentially, instead of gravity pulling the player straight down, it was pushing the player into the surface they were walking on.
Both of these solutions together seemed to work well. I also made sure to use local space vectors, so that this system works regardless of the orientation of the staircase, and the player, which was necessary for a game like mine, where the up vector is arbitrary.
I have also mostly finished the modelling for the missile base, I just need to unwrap and texture it.
I have made some minor changes and improvements to the item and inventory management code to allow the player to access (and store) items within other items.
I plan to use this to add storage crates and supply crates within the world, such as within wreckage, etc, that the player can find and open.
The next objective is to figure out how to allow the player to climb tall, steep, sets of stairs. I am working on a model of an underground missile base for the story within the game, and it has a long stair section which the player will need to easily traverse.
The standard way of doing this is to add an invisible ramp that they player can climb more easily, but in my case, the ramp is too steep, so I will need to modify the physics of the players rigidbody controller to fix this.
I have figured out how to use blend animations and avatar masks in unity. This basically allows me to play two animations on a character at the same time.
I plan to use this to allow the AI to, for example, walk while carrying an item, or firing a weapon. I intend to improve the AI code shortly, and having the ability to play multiple animations simulataneously is essential.
I have also started working on a 3D art piece, which I will probably include in the game as an art asset.