Great update, a lot of things happening on many fronts! I am intrigued by the gif visualizing your camera frame in Unity. Looking at the corresponding in-game gif, I realized that the camera is really cinematic. Nice job!
Much appreciated! I saw your video about marketing for indie games and I've been hard at work on a branding sheet.
Our camera system is tied to the "heightmaps" that I draw in Tiled, our level editor:
It's used in other features like Line of Sight, but we have a "Height Dependent Zoom" that adjusts the camera zoom further out based on a tile's given "height".
It's been really handy!
Back again to report this week's progress.
Map & Room TransitionsI worked on this one, there was a lot more to it then I believed when I first began. Due to the fact that the game is been incubating within mostly one scene (Fort Outdoor), the minute we decided to start doing level to level (or in Unity terms -- Scene to Scene) transitions, this called for a refactoring to our architecture.
After searching for best practices and finding most people just use DontDestroyOnLoad for their singleton/reusable objects and scripts, I found this
Stack Overflow about "Manager Scenes". I really liked that structure -- having one top-level scene where persistent objects and scripts live such as Audio, UI, User Input, Lighting Configurations, and Level Loading logic. Basically, this is a scene that houses all our Singletons that can be ported on between scenes.
I implemented that setup, and while it has it's drawbacks being that you must remember to add a Scene you're working on "Additively" and "Set Active Scene", lest you be bombarded by error related to the Scene's "Entry Point" script never firing and certain scripts never being initialized...
public interface IInitializable
{
void Init();
}
public class EntryPoint : SerializedMonoBehaviour, IInitializable
{
[SerializeField] private bool _InitOnAwake = true;
public bool InitOnAwake { get => _InitOnAwake; }
public IInitializable[] ToInit;
private void Awake()
{
if (_InitOnAwake)
Init();
}
public void Init()
{
for (var i = 0; i < ToInit.Count(); i++)
{
//if (i == ToInit.Length - 1)
var initializable = ToInit[i];
initializable.Init();
}
}
}
That's our EntryPoint, it's really just something to ensure order of initialization and it lives in every scene. The problem is, the Awake only fires on the "Active Scene"... but writing this out just gave me a lightbulb on how to fix this (if the "Manager Scene" is the active scene and there's > 1 EntryPoint component found, stick them at the last indices of the ToInit list!).
Anyway, there was dealing with that migration of code and structure then debugging and testing it stringently.
After that, I got working on Map Transitions, switching between scenes and spawning at a given grid cell on the destination level. Which went smoothly, aside from my foray with ProCamera2D, a plugin we use for our camera system. It's been super handu so far, but I noticed an issue where the camera REFUSES to move instantly to a position upon spawning -- it'll typically always tween to the CameraTarget.
Which created bugs, for my usecase. To avoid modifying the source code, which would just get overwritten after the package updates, I end up having to do a super hacky workaround involved toggling all the camera's fields and disabling/re-enabling the script tactfully.. which I hate doing. I reached out to the plugin developer about it for support -- I hope he offers a fix or advice on where I possibly went wrong.
1: 30 Video:
https://streamable.com/dux3h4For the map-to-map transitions, you'll notice no oddness with the camera upon spawning in the new level, thanks to my hacky workaround. However, when I transition between rooms in the Fort Interior (near the end of the gif), you'll notice the camera tween away from a distance to reach the player's position.
That's the undesired behavior from ProCamera2D at work, since I haven't repeated by hacky workaround there... ahh third party plugins. Anyway, if the developer fails to give support, then I'll just modify the source and remain on that version and use the repurpose the code strictly to my usecase.
EDIT: UPDATE - I found ProCamera2D.UpdateType and UpdateType.ManualUpdate -- worked like a charm. I'm able to switch to ManualUpdate during Map/Room transitions, use Move(insertOutrageouslyLargeSpeedHere), and mimic an instant movement -- then switch back to UpdateType.LateUpdate. Never got support from Luis though, guess I'll pat myself on the back for digging into code that isn't mine.
The good news is since migrating to this new architecture, adding new levels and doin map/room transitions will be a breeze.
AI UpdateFull Video:
https://streamable.com/5gbkjpIn the previous update, I shared our AI approach. Above, you can see our current progress.
To explain what you’re seeing, the green squares are the paths to take to reach the formation. Every Unit in the Group in working towards reaching their assigned place in the formation. The Grey squares show the formation they’re trying to build. At that point, he had it set to “Horizontal Line”.
However, we have a Formation Builder, allowing us to create formations to be built at runtime by AIGroups dynamically:
The Vanguard role is pretty much complete, they’re driving all the action. They set the target points for all the other AIGroups, sort of the driving wheel.
The two AIGroups behind him are Flank Defenders. Originally, I intended that every Vanguard Group only have 2 Flank Defender AIGroups, but he’s made it in a way that we can have as many as we want and they’ll position themselves in the best manner to assist the Vanguard Group they’re assigned to guard.
In the video near the end, you can see he moves our PlayerUnits to the right. Once he does, the Flank Defenders immediately move to cut off their escape, while the Vanguard recovers.
The AI is smart enough to know where to position itself to do so, really awesome.
There’s a few things left to wrap up for Flank Defenders and Group AI.
In the video, you’ll notice that they’re all just moving their max Movement range to reach their assigned destination in the formation. BUT, we’ll want the AIGroups to be able to move in a way that they hold their formation – a way where all the units can reach and yet keep their formation.
The current behavior is cool for situations where the AI wants to move quickly to a target – more time constraints where the enemy needs to quickly reach a position or rout an enemy.
But, for instances where they’re in a mainly defensive position, we’ll want them to hold their formations and do their absolute best NOT to break them – since you’ll have to come to them in the end.
That’s where AI is in a nutshell, exciting stuff.
Next Steps are:
- Adding the other Teams:
Ally, Other Enemy, and Neutral Teams to test the fluidity of our behavior and decision making when there’s many teams in a battle map.
This one should be fun, yet difficult. An AIGroup's role can change pretty quickly. Say, a bunch OtherEnemy units spawn within a Flank Defender’s Line of Sight. They’ll have to decide whether to keep defending the Vanguard or engage the new threat (essentially becoming a new Vanguard themselves).
- Adding Leadership Units and a Morale System
- Fleshing out Individual Behaviors and adding an AIUnit “Personality” features.
How likely is the unit to cooperate in a Group? Is he a bloodthirsty loose cannon? Or is he coward, who’ll flee and disregard goals once he’s hurt a little?
Or a hotshot Unit who simply loves war and doesn’t need to group up.
Situations like that.
AND that’s AI. It’s a long road, but once it’s finished — oh, baby
Adding Walk-Behind / Hiding for Battle ModeUnlike non-combat exploration, we haven't added the ability to walk behind solid objects in battle mode, yet. However, after doing this for non-combat mode, it only made sense to refactor our Grid System to take into account the many tiles at a given cell in a grid, but their respective sorting layers.
Example being: I am walking BEHIND the fort wall, yet walking ON the dirt tile hidden behind it.
We are through most the refactoring that must be done for this, the last step is modifying our level editor to dynamically mark certain cells as impassable for Units on certain sorting/rendering layers.
Once this is done, we'll be able to display both allied and enemy units that are hidden behind tiles using our finished Silhouette shader:
This will be tied to LOS -- so hidden enemies WONT be displayed until they've been sighted by any allied unit. Same applies vice versa, players can hide this way as well. It'll be an interesting mechanic to toy with!
Art DumpBattle SpritesFinishing up our Sword Knight's animation set.
Got a critical attack animation for Sword Knight. The in-game animation will be quite different timing wise, and I’ll add some camera shake juice. But, with all the Map Transitions and carriages – it’s been a lot going on. So, I’ll plug this in soon.
Most likely significantly slow down the wind up, then BLAM release the dragon and shake the screen. I always have fun keyframing these.
Upcoming animations:
The process for these is basically rotoscoping. It's been working out pretty well, thus far.
While I'm at it, I'll pop in a perspective test we ran on the first WIP of our Fort Interior battle background:
Full video:
https://streamable.com/0h5s6fYou'll see me messing with my shader settings, trying to get the moving shader tor remain static, since we're indoors. I believe this one will be another masterpiece, I have faith!
CarriagesIn the process of rigging these spritesheets together and programming a Controller for Carriages.
Full Video:
https://streamable.com/tz0muaFull Video:
https://streamable.com/ws3blhIn the videos, you'll see me testing synchronous animations for all the horses, and asynchronous manually. In the controller, I'll likely add support for both versions of animation and see what sticks.
I also had some interior tiles done:
The game's demo will begin in this carriage, so I'm pumped to have it done.
New TilesI've commissioned all the tiles I'll need to build every level for the Kickstarter demo, so we should be set on that front now. It's just a matter of delivery time now. I may need to commission some props/specific tiles as needed, but I'm happy that we've covered the basis of what we'll need for the demo.
MusicGot a new composer and a new main theme:
https://streamable.com/5eyig8https://soundcloud.com/andrew-livecchi/babylon-main-theme/s-wDDvUEQWzqc