Friday, September 7, 2018

Omni Systems



Hello everyone,


I'm back from the dead it seems, having caught up on a little sleep, and have been quietly working away in the AW code mines. Over the last couple hours, I was trying to figure out the deal with my laptop's keyboard. The T, 8, and 9 key stop working intermittently, but only under while the system is under load... with just a browser and discord open, for example, it works perfectly fine. It's what I'm using right now to type this. So... not sure what's going on, but it doesn't seem good.

The issue seems to have been getting worse, whatever is causing it, but again, only under load. Of course, because using Visual Studio Code with the TypeScript, TSlint, and other basic features like intellisense eats up a lot of resources, it's been a royal pain in the ass while trying to code... So I'm going to start lugging a USB keyboard around with me until I get it sorted out. Maybe I'll bring a mechanical keyboard and sit out in the common operations area and see if I can drive some coworkers insane... hehe

So aside from the bellyaching about my keyboard, things have been pretty neat today and yesterday. After that nightmare of a clusterfuck with TS and SugarCube, I decided to take a couple days away from bug hunting and write some new code. Frankly, my brain needed a break from that shit. So I thought "What needs to be done that is: A) fairly important, B) not going to take forever, and C) has absolutely nothing to do with any SugarCube tomfuckery?" The answer was the Omni System. I finished it today, though I need to add in some OmniEvents before it will actually do anything.

Introducing The Omni System

A revolution is coming.
Business is changing. Changing at the speed of information.

Whoever adapts first wins.
In order to compete, we innovate. In order to innovate, we redefine.

How do we redefine?
With a new definition.

Imagine A New Way To Experiment.
Faster than a cheetah.
Stronger than another cheetah.
More magnificent than a whale, or a fish.

So what is it? what is it exactly that will revolutionize the way we do business? Simple. It's...
OMNI

Okay, that was fun.

On a more serious note, the Omni system is actually a pretty important part of how the game will work. Twine is an engine that is largely passage, or location based if used in it's default configuration, which is similar to most games setups out there. But that leaves the question: how do you track what things are supposed to happen when, particularly when they are location independent. You could just run a series of checks as part of your basic time system. AW already has a fully functional time tracking system, and that system is what drives a lot of the basic status mechanics. 

But if you start adding in a all the checks that need to take place, every time the game clock moves forward... it's not terribly efficient. You end up checking for things that you have no reason to check for anymore, and every little bit of processing adds up to slow down performance... but more importantly, it becomes messy and difficult to modify.

Of course, you could use a simple timer system, adding that on top of the time system to execute tasks. That's what AW does with it's base status mechanics, just a small cycle time chunking system. Of course, if you want to handle more complicated matters, then you need to look at adding an array of timer items, or another method to signal things that need to be processed. This greatly reduces the inefficiency, but also tends to become complicated when dealing with a lot of different types of tasks and timers, because the system is rarely suited to handle a great deal of situational flexibility.

So now that I've spent three paragraphs on jargon... The Omni System is essentially the second time system in AW, one that works very differently and exists specifically to accomplish time-based tasks. It's object-based, and thus quite efficient and flexible. Of course, because this is Accidental Woman, it's completely modular and supports modding in multiple ways, something that can't be said of a typical timing system. It's also set up to be asynchronous, so that the system doesn't affect the performance of page transition. Basically, it uses the time that you're reading or "at" one spot (a tiny portion of it at least), to do it's work, separate from your own actions. 

What does the Omni System DO? by itself, it does nothing. it's a system of managing what are called OmniEvents. OmniEvents are objects that get pushed into the system as needed, and have the ability to do a lot of shit. And while I'd never actually use one that way, you could actually use an OmniEvent to completely recreate one of the prologues without the typical Twine passage navigation. Or you could package the entire job system into an omni event, if you felt crazy enough. It's also part of the way that game modding will be seriously viable beyond simple add-ons.

You can even use an OmniEvent to start/make a new OmniEvent, so that you can OmniEvent while you OmniEvent. ;)

Some basic things that we'll be using OmniEvents for:
  • Continuing multi-part storylines, scenarios, and quests - including limited availability windows and and branching. (It's basically the backbone behind those planned systems)
  • Portions of the dating and hangout systems, particularly managing in-world PC actions/location/movement.
  • Status effects, like drugs, illness, alcohol, and the like. They allow continued effects without needing to code a million other game areas to support it.
  • Long-term event chains like pregnancy events
  • Transformative medications to grow more boobs, or whatever else it is you feel like growing/shrinking. Something neat is that an entire transformative can be coded simply by adding a store/purchase point and it's own OmniEvent. You could mod one in using the consumables system (to be able to purchase/trigger it) and an OmniEvent.
  • Stalking the player.
  • Consequences that are temporally separate from their causes "Saw something she wasn't supposed to in that lab... better send out the team tonight..."
  • NPC initiated actions.
  • And 72 more!
I'll wrap this post up with some of my initial code comments as a peek at the system:

/*  ~~ OMNI EVENTS ~~
There are five types of omni events that offer differing functionality
Combined, they allow handling of EVERY type of time-based effect or event.
Events are added once execution is expected, unlike other object groups
where objects are added as part of a centralized repository.
.  Event Types:
.  "single"    : a simple event that executes exactly once after the
.                set time, and is deleted. [e.g. story chain trigger]
.  "recurring" : a simple event that executes on a set interval for a
.                certain number of times. [e.g. status effect - drug]
.  "condition" : a irregular event that occurs based on a cycle count
.                of set intervals. It also implements its effect based
.                on this count, and can change over time. [e.g. withdrawl]
.  "chain"     : most complex event, has a set of unique events that
.                occur at set times in the 'chain', including variable
.                execution time ranges, and self-adding events to the
.                event chain. [e.g. pregnancy]
.  "perpetual" : an event that occurs at a set frequency without a set
.                ending point for a long-term effect. must be cancelled
.                externally. [e.g. roleplay mode special threshold]
*/
// chainEvent TIME variable: [type, time (, 1-100prob | time2)?]
// "simple" : occurs if time is passed.
// "chance" : probability of occuring checked ONCE after time is passed.
// "random" : chance but probability checked each time until it happens.
// "range" : will occur sometime within the given range of time - time2


No comments:

Post a Comment

The Expecting Release - v1.27

  Here we are again. Odd how we keep running into each other like this... it must be fate... how about getting a drink? No, I'm joking! ...