The Organization

Good Small Game Project

The Good Small Game Project is still proceeding, in small steps. I have now implemented a step-sequencer in Unity, which uses the AudioClip.PlayScheduled() method, to allow for proper timing of the notes, regardless of the frame timing. The important thing for the game is being able to dynamically change the BPM, and have the sequencer react with as little lag as possible to those changes. And that i could easily swap out the different sequences. So far so good! I have a simple 16 note (4 bars of 4 quarter notes) setup working, with parallel sequences and linear sequences, each containing a number of tracks.

Next step is to experiment with Markov Chains and not L-systems as i had previously considered. I think the Markov Chain approach is better for on-going continuous changes to the output from the previous output. The L-System seemed like you would run it for a couple generations to create a "sequence", and then play that sequence, and then generate a new sequence. Not so much driving what comes next from what has already played. Anyway, we will see, once i get this working.

Also, while looking for something to test the sequencer out on, i found my Funklet book, a kickstarter from 2011. Oi. Amazing, was able to convert the beats into sequences no problem, and was grooving and funking out! Maybe the first practical use of this since i got it! Only took 12 years!

unity3d programming permalink

Cool Unity3d Text Format Trick

When displaying a players stats, you sometimes want to line up all the stat names, and also line up all the values. This has typically required two text fields, so you can align both of them. This is a bit of a pain in the ass. I found this forum post which explains a clever way to left and right align text in a single text field. You can also use the <line-indent=xxx> in place of the <align=right> to get multiple left-aligned columns of text. Thus saving yourself an extra text field. Bonus points if you are using some kind of binding system, so you can have all the string-formatting in a single place.

I am going to also paste the rich-text formatting here, in case the forum post goes away.

<align=left>This is the left aligned text<line-height=0>
<align=right>5,000<line-height=1em>
<align=left>This is the left aligned text<line-height=0>
<align=right>2,500<line-height=1em>
unity3d permalink

Scale

"Planck length is about E-35 m; a human is about E0 m, a ratio of 35 orders of magnitude. The size of the observable universe is E27 m, or 27 orders of magnitude difference. That means the difference between a human and the Planck size is 100 millions times larger than the difference a person and the entire universe!" William Stoertz

Was thinking about this today, and the scope of how much space is "inside" us, versus how much space is "outside" us. I did not realize the scale of difference between the two. Obligatory link to Kurzgesagt's video on this.

science permalink