Home Artists Posts Import Register

Content

I hope you tried out the latest Beta. It is downloadable via the viva launcher.  If you did you will notice that the functional reception bell will make Shinobu face you and bow to greet you. This has prompted some code rewrites to make it easier to work with behaviors.

Viva Project's codebase has big changes every version to accommodate new features. Usually the design conforms to what is simplest, and most future proof to write. This, like most growing projects, however does not necessarily equate to best past-proof design (the opposite).

Many of the existing character behaviors have traditionally been allocated and done in their own respective C# files. Like so:

This has compartmentalized each logic module in an easy and manageable way for development. The problem is that many of these behaviors have similar functionality but don't share enough code together. The Follow behavior intersects with Cooking or ChickenChase because all 3 require the character to move to a location. When the project was smaller, this was no biggie and it was very easy and fast to implement more behaviors on top. However the codebase with this v0.8 update (multiple characters being the main culprit) is starting to make this design approach unmanageable and prone to bugs.

As a result, the codebase is being rewritten to deal with behaviors in a more granular scope. Instead of grouping up behaviors that encompass a sequence of various actions (go here, pick up this, eat that), the logic will now be individual actions.

This greatly increases shared code to 100% and allows for a super easy plug and play type of scripting. Many existing behaviors can now be simplified down to a few lines of code, which is amazing. As an example, the onsen clerk job for characters was done in as little as 35 lines of code. Demonstrated below:

This job makes the loli spawn and deliver towels to the player at the front desk (still a work in progress). Another great thing about this approach is that fixing bugs for a single action will apply to all behaviors that use this action in their chain of commands. It allows for more advanced logic tree abstractions like interruptions. This means that at any point in time if the loli falls over or is knocked down by something, the loli will revert back to a previous action to stand up and resume whatever she was doing. All this without me having to handle every case or exception.

So far this approach seems very promising. I will have an update for next devpost with some more completed onsen behaviors.

Stay tuned!

Files

Comments

No comments found for this post.