Example Implementations - kgrav/Nite-Basik-Code-Samples GitHub Wiki
This page details two examples featuring characters and design elements from a game which is being constructed with Nite-Basik. The game is titled "On The Beach," and is an action-adventure game.
Scroll down to "Music Fade Rooms Demonstration" or "Gameplay Mechanics Demonstration" for links to and descriptions of gameplay videos.
All models, textures, sound, and animations created by Kevin Gravis.
Cast (The Header Scripts)
Liz

Class: Liz.cs
The playable character shown in the samples, Liz was designed as an expressive and easy-to-animate character. The reasoning behind this is if a character is easier to animate, I can quickly and easily add new moves or make adjustments as desired, and everything will still look probable and intentional. Liz is set up as a hybrid between the action combat gameplay of stylish action games, the exploration and traversal of 3D platformers, and the weighty feel and special abilities of action role-playing games. Liz.cs processes frame data in four stages:
- Read component output
- Read controller input, and decide which signal "wins"
- Process game logic
- Decide animation state
This multi-stage update loop creates a standard template for housing the immensely complex state logic required for a main character of such mechanical breadth. This Header Script controls the activities which are executed in fine detail by the Actor Components, ensuring that any state reached is a correct state.
To check out a couple of Liz's special Abilities, see:
Homunculus

Class: Homunculus.cs
The Homunculus is a fairly simple melee attacker. Every frame, it checks data from the AI Vision component, and decides current state based on the context of the seen object (if any).
- If it sees the World Object context, it will rotate its movement direction in order to avoid the barrier.
- If it sees the player character context, it will switch to its attack state if not already in it
- If it sees another Homunculus, it will rotate its movement direction to avoid the seen friend.
- Otherwise, it is idle, and will wander randomly
The Homunculus uses a finite-state machine inspired design, and uses a major signal, and a minor signal. The major signal is used to determine total state, defaulting to -1 for no state, and 0 for idle state. The minor state is set to '0' when a state has been chosen, and sets to '1' once state logic has been executed. This is useful for avoid states, as we can send a single rotation signal to the mover. The logic will only execute when the minor state is 0, if the major state is an avoid state.
To avoid getting stuck in improper states, the Homunculus uses a Random Signal. This signal executes on a random timed interval, and checks to see whether or not state logic has been executed and can be considered finished. The state will change here if so.
More detailed information on the Homunculus can be found within the comments in the code.
William:

Class: William.cs
William is a highly specialized AI Character which moves around using the Pod Mover, and throws Poisonous Bombs from a Projectile Interface. William uses physics-based motion, which enables him to naturally bounce off of obstacles in his path and receive weapon-sourced forces without adding too much extra logic. Instead of highly complex motion procedures, William uses a multi-stage combat function in order to properly sync the sound effects, weapon spawning, and throwing effects with the animation. William features a sort of experiment in programming a "personality" into rigidly gameplay-oriented AI. If he successfully hits a target with a bomb, he'll pause for a moment to laugh at his target. This leaves him open to an attack.
William also uses a random signal, serving the same function as the Homunculus's, even though William's logic works quite differently. If an instance is stuck in an improper state, the random signal will force the instance back into a proper state.
Plankton:

Classes:
These AI Characters exist for benchmarking. A large amount of these can be easily observed, and tied to a loading zone, but they are also fully updating, physics-enabled, and collision sensitive game objects, giving an easily observable look at how much active detail the engine can handle at any given time.
Music Fade Rooms Demonstration
VIDEO LINK: Music Fade Rooms Demonstration (on Youtube)
Components Showcased By This Demo:
This video shows in detail the power of the Loading Rooms system, and the power of the Audio Masks system. The demo shows a scene partitioned into six zones (plus a start zone), each containing one hundred of the aforementioned Plankton character. Each zone is also tied to an Audio Mask. Upon approaching a Door, the zone behind the door begins loading its mask's audio clips. When the door is opened, the rendering components within the room are displayed. When the room is entered, the room exited will deactivate, and the Audio system will fade in the new mask. Only one (two if a door is open) room actively renders and updates at any given time, meaning a large amount of detail can be contained in each room, and a large amount of rooms can be loaded in one scene.
This demo displays one of the key properties of the Audio Masks system. Each room effects only a subset of the instruments playing the background music. This means that the music heard by the player is not just dependent on the room they are currently in - but also on the way they reached that room. I consider music to be a very important story-telling element, which is why I added an extra dimension while integrating it with the traversal.
Gameplay Mechanics Demonstration
VIDEO LINK: Advanced Gameplay Demonstration (Youtube)*
- I am aware of frame rate issues present in this video. These are a symptom of the capture software I used, and are not representative of the actual in-game frame rate.
Components Showcased By This Demo:
This demo showcases the active camera system, the UI elements, the combat system, the AI, and the variably physical World Objects system. The unorthodox environment shows the power of the Camera system's tracking abilities, as well as the strength of the AI's path-finding and positioning routines. This video displays a dynamic platforming area wherein Liz, the player character, fights a group of Homunculus, and then a group of Williams. Note how the Homunculus are able to perform correctly in a group, and how several of the William instances stay on the platform they start on for the majority of the video.
Also shown here is the world's variable physical objects. As shown, support structures can be placed, and objects supported by them are displaced when released from their support. Once the objects land into place, they become useful as platforms. This was achieved through very loose scripting; dynamic objects aren't explicitly defined in cause-and-effect chains, instead automatically determining behavior based on configuration and current state. Note the sound effects played by World Objects upon collision, sourced from the World Audio component.
The special ability used by Liz in the video is the Leaf Spin, which locks position along the Y-axis in order to make platforming in environments with low ceilings possible. Also shown are two special combos - one that can be used if attacking from a dodge roll, and one that can be used if attacking while falling.