Phase 2: Refactoring
Outlook
Most of my goals for Phase II haven't changed. I needed to instantiate a prefab to get around some collision issues, I need a better (Read: Any at all) pathfinding system, inventory will need to be added, and the AI system will need to be expanded to adopt new behaviors. What has changed, is the scenario I'm shooting for in which all of this is acting. Before, the core idea was that I would have a single scenario set up where you go from A to B to get a thing. This was an attempt to model some of the gameplay I ultimately have envisioned, where resource retrieval is key to building up your forces. The goal beyond that was that you'd work your way to pacifying the region by bringing in supplies until you could buy enough equipment and troops to overthrow opposing military forces on the island. This was in an effort to model things after more common Age of Empires and Command and Conquer style RTS games. Essentially: you have a force on one side, a force on the other side, two men enter one man leaves, lets go. What I would prefer is more factions that interact via diplomacy and combat in a more complicated fashion. I could have 14 armies on the map at once then, letting them all manage finite resource primarily using a backend game manager akin to what is used in space games like the X series.
So what I need to make this happen is not a scenario where you have to go fetch a thing through a map of placed NPC encounters, but a scenario more akin to a capture the flag map. Have a resource "node" in the middle, have army bases around it in a circle, give the player 1 faction, and let it work itself out. The NPCs will move forward or attack one another as the Player will, and the winner will be whoever secures the node and disables their enemies. Resources or killing NPCs rewards resource that the faction can then use to spawn more entities. This is a scaled down version of the final game I'd like to make here.
Implementation
With that said, when I started out I was attempting to instantiate all my entities using archetypes, using a loop that ran on a monobehavior script attached to a game object. This worked relatively well, to get the AI system functional and make everyone run over the field. The problem is that looking forward, my solution would not scale. So we needed to do some work there.
So the first step of this was to refocus everything on prefab spawners. I want the initial force given to each faction to be equal. It will be a soldier spawner building that creates new troops if you feed enough resources into it, a Starting Force of troops of some variety, and maybe a central faction leader. A default entity that is supposed to represent a Medium sized NPC, was tied to a spawner that creates a fixed number of troops for each one of however many factions. The way it's now set up, I can change the radius from the central point where the factions spawn and set them up at equidistant points along the resulting circle.
Because we're now using a prefab, I have been able to enable rigidbodies and colliders on my prefab to solve the problems I had with units overlapping and phasing through one another I previously had to solve through implementing an avoidance behavior in my AI system. Since I have phased that out for now, I have a whole AI state in my GOAP system that I can now refactor into being something else. This is probably the next direction I'll be headed in. My thought is that, since everything basically works and scales better than before, I should start focusing on implementing more mechanics.
Next Step
So the things I want to look at next are:
- Weapon variety: Having more than one default weapon to use
- Attack variety: Having more than one attack per weapon
- Morale: Troops breaking and losing discipline, and what that does
My want is to have friendly fire melee damage, meaning positioning and formations become that much more important. All of this will mean capturing more information about each respective entities surroundings. If the NPC is hemmed in by friendlies they wont want to swing a wide swipe that decapitates their 3 friends around them; likewise if the NPC is surrounded by enemies, maybe they Do wide swings in an attempt at crowd control. So focusing on Morale first, means I have to dig into what the NPC is seeing in their vicinity and reacting. This info and the subsequent effect it has on the NPC's aggression should inform what attacks they use. This information should also be informed by the type of weapon the NPC is holding at the time.
My hope, is that 3 NPCs enter a fight. One engages at short range, and a second engages at Longer range with different attacks but the same type of weapon, since there is an NPC between him and the enemy. And that, is where the avoidance script will factor back in, I think it will now evolve into positioning on the part of the NPC so that they can set up attacks or deny an enemy positioning. In response to all of this, the enemy takes a few hits and sees things aren't going well, so he runs or starts pushing the attack more aggressively as that is the only way he can get out of this situation alive.
I have 4 days of holiday coming up, so we'll see how much of this I can get to in that time. Thanks for reading!
Untitled Hybrid Strat/RPG
Prototype Strat/RPG
More posts
- Phase 2: Post Holiday UpdateJan 03, 2022
- Phase 2: Starting AnewNov 03, 2021
- Phase 1: Introduction And PostmortemNov 03, 2021
- Phase 2: Slow ProgressMar 24, 2021
- Phase 2: Day 1Mar 18, 2021
Leave a comment
Log in with itch.io to leave a comment.