Log In  

Cart #markov_demo_22-0 | 2022-06-27 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Demo of Markov Chain Process

Hey everyone, this is my first cart posted to the forums.

I made this tech demo thing to try out Markov Chain modeling, and thought the result was worth sharing.

What is a Markov Model?

A Markov Model or Markov Chain is a process by which an object changes states, and the chance of a change of state is dependent only on the state the object is currently in. At every step (in our case a frame) there is a chance that the object changes states. Each state change can have different chances of occurring. If no state change occurs, the object remains in its current state.

What is this cart?

This cart is just a little demo I made to demonstrate the Markov Chain process. It uses four orbs as objects, each with four different states: move up and down, move left and right, change size, or change color.

Honestly the result came out really nice and is super mesmerizing to me. Wish I could put it as a screensaver.

What you're witnessing is a purely random chance that the orb changes to a different behavior, but the result doesn't quite feel random.

What use is this to me?

The code is pretty generalizable. There are functions that calculate the chance of changing states vs not (dependent on variables you provide) and you can create your own objects and functions that work with the process.

The objects you use need state variables, and a function variable to call, dependent on the state. chkstate, parseorb, and sumtable functions, along with the mark, chnctbl, and states arrays are all you need from this.

Many things in nature can be modeled with a Markov process. So using such a process for your game can add a surprising amount of depth with just a few functions. Enjoy!

P#113706 2022-06-27 02:59


[Please log in to post a comment]