REPEATFEED RᴇᴘᴇᴀᴛFᴇᴇᴅ RepeatFeed

Blast To The Past

Because it pops up now and then and some folks might be interested in how modding “grew” since “the days old”, I’ve decided to release almost all of sheep_rave WIP3. In case you don’t know, or don’t remember, this is what I’m talking about:

Let’s enter the abyss of my mind for a little tour by asking important questions.

Sheep Rave History 101

We’re writing end of March 2014. Stonehearth Alpha 2 has been out for a little more than a week, it’s been less than three months since the game became accessible to people. Some madmen were hacking away at modding already, doing quite weird things like abusing lua calls from JavaScript to make up for the lack of server_init_script and client_init_script.

There was this post that got me thinking, made by the one and only @SteveAdamo on March 21st:

To which there was only one logical answer, or rather, question:

There’s a little bit of other conversation going on too, but the important bit is that I’ve still had my graphic tablet plugged into my computer at the time, it resulted in this post whose highlight was this drawing:

https://sea2.discourse-cdn.com/business6/uploads/stonehearth/_optimized/ee1/8e6/990ec38a89_537x500.jpg

Of course, people made fun of me, as they often do.

Anyway, one thing led to another and on March 24th, a mere three days after Steve’s “idea”, the first commit to sheep_rave was done. There’s been 22 revisions over a week that led to the “mod” I’m providing you with today, the version that (probably) made it into the video.

A few selected commit messages:

  • Added sound. In stereo.
  • Added wiggle animation
  • Awww yiiss
  • Tweaked wroom and added wibbly effect

Sheep Rave History 101 (cont.): Coding Point of View

Getting the sheep rave to work was a challenge. Mixintos were somewhat recently introduced, as were overrides. They’ve added a whole lot of possibilities; while it was possible to override lua services and controllers (I’ve done that with the old RP mod loader to add some more functionality to the world generator/citizen generator), it wasn’t possible to modify data itself in any way. Mixintos and overrides changed that.

Mod Structure

The mod is not too complex but for the sake of modularity and simplicity is split up into three parts:

  • sheep_rave was the main mod and dealt with almost everything.
  • sheep_rave_data was the mod that contained a copy of the horde folder back then. It was possible (and necessary for sheep_rave to work) to set another directory as “horde” folder (instead of the default of mods/stonehearth/data/horde), but it wasn’t possible to “add” things (like it is nowadays, I think). At least, back then, I didn’t find a way. Because this is some sort of “artifact”, I didn’t remove the other files, so it’s less obvious as to what I did. What I’ve added was a bunch of lights, along with a new thought material so the sheep can think “oooh, rave”.
  • sheep_rave_third_party was originally part of sheep_rave, but because I don’t own the rights to either the wroom sound nor the music, I can’t distribute those. So I’ve split it in a mod; I can use the “real” files locally but release empty files to the public.

Musical Choice

The basic idea was “Let’s have a party with sheep”. One thing that is kind of stuck in my head is Spongebob’s Jelly Jam. For those who don’t know the episode, it can be summarised as “Spongebob parties with a Jellyfish, which annoys Squidward and soon gets out of control”.

One of the sources of all this madness.

The soundtrack is called Stadium Rave A, composed by Mark Governor and Glenn Nishida. It’s probably been made to sound similar to Get Ready For This by 2 Unlimited which can often be heard in sport events. Or so the Spongebob wiki tells me.

At this point I’ll probably have to admit that I have absolutely no idea how raves or parties work. But not knowing something never stopped people from doing it anyway. If anything at all, it was an incentive to do it.

The Mashup (and Animations, of course)

Right, so we have this song, we have “rave with sheep” and we need to mash that together somehow. So the first task was to figure out what sheep would do during a rave. With the help of @voxel_pirate and his Blender plugin I’ve managed to put together a few animations. You can look at them in the Kitchen viewer, a little experiment I’ve done around the same time. I’ve decided that sheep should wiggle (which has been dubbed as “laundry machine animation” by some…), backflip (two iterations, I was unhappy with the first one because it looked so odd. The second one was much more sophisticated, with moving feet and all), jump around, wobble (note the ears, tail and leg movement) and headbang (including the tail).

I’ve really OCD’d hard on the animations (… actually, the whole thing in general) though. By counting the beats per minute of the song, I’ve got the frames I had with each animation (based on the fact that the game had 30 FPS in animations and the assumption that there was no desynchronisation between audio and gameplay, i.e. no significant lag). So each animation was a multiple of one beat, which was around 1/120 second I think. That meant that, roughly, the sheep would always perform their actions in the same timespan: If a sheep did three backflips and wobbled then, it should line up as well as possible with a sheep that only wobbled. The overall effect is that it looks like the sheep act like a “crowd” - like in real life. Or so I think. Would make sense, wouldn’t it?

My Triggers: Bread, Salami, Blue Skies

So there should be a sheep party, but what actually triggers it? I’ve gone and created a subwoofer, a dead simple one using Panicle (my Minecraft-to-Qubicle converter). It’s the “totem” of the whole thing, so to say.

But how would the sheep commence to dance? They could be all around the map, so something needs to attract them. So to do that, I’ve opted for an antenna, like some sort of mind control device in a cartoon. In good old movie fashion, the antenna was to ascend, do its evil deed and lure the sheep.

Basically, a command triggered the subwoofer to extend its antenna. Once extended, the sheep would come. To have this acoustically accompanied, I’ve “borrowed” the sound effects from The Final Countdown by Europe.

The (not so) nAIce Part

So when the animations were done (I think I’ve started just with wobble and later on added a random one), they needed to be played somehow. This was way before I knew how the AI worked, it was my first AI experiment and until the recent train/Zulser things also my only. I’ve more or less copied another AI action, but I can’t remember what anymore.

Basically, it was just an action that ran at the top of the sheep priorities and played a random animation of those available (at the beginning, just one, but later more).

Once that worked, I’ve expanded the whole thing. I’ve written a rave service that dealt with it. You could tell it “Hey, let’s start a rave” and it took care of everything else.

So there was an AI action that blocked until the rave began. There was one that made it think something (which was outsourced in Jelly and has since disappeared), there was a simple “go to the subwoofer”, then “wait for the music”, “stop thinking about the subwoofer” and last but not least, “rave”. Then there’s a compound action that tied it nicely together.

Course of Events

So what happened was as following:

  • The player clicks on the button on the subwoofer, triggering a command in the rave controller.
  • The rave controller tells the rave service to start a rave at this subwoofer.
  • The rave service creates an antenna, places it at the subwoofer and sets the status to “calling”. It’s creating a task in the background that moves the antenna slowly upwards.
  • As soon as the movement task has finished, it’s triggering an event and calls for the sheep. This task is executed every two seconds, i.e. it’s woken up every two seconds (until it has finished).
  • Play the wrooom sound.
  • The event will cause the action in the AI to trigger; it will become active (and dominant), forcing the sheep to go to the subwoofer and wait there for further instructions.
  • This task is continuing to call sheepies until at least 2/3 of all available sheep have arrived at our raving location.
  • It’s also wobbling the antenna by changing its position in yet another task.
  • Once a good majority of the sheepies has arrived, the antenna is retracted.
  • If the antenna is hidden again, we’re ready to rave!
  • Send another event. This will cause the sheep to face the subwoofer and wait for the party, which is about to get started.
  • Two seconds later, the rave is prepared.
  • All sheep should be facing the subwoofer by now.
  • I’m speeding up the time in case it isn’t night (between 22:00 and 4:00), until sunset has been achieved. Actually, I’m not really speeding up time, as that wasn’t possible, not in the sense we have. I’m simply telling the calendar that one in-game second is now much, much shorter. Until we hit sunset.
  • Once it’s dark, the rave starts.
  • The time is slowed down; the night shall last forever.
  • I’m adding a play effect to the subwoofer. As with the animations, this one was trimmed to the song. You can see it in the video, each beat makes the subwoofer grow. The effect was written by me and isn’t an effect in the normal sense (it was not really possible to have custom coded effects, still isn’t), it’s just a background task that adjusts the size the whole time using some sinus magic.
  • All sheep start their dancing loop. They’ll pick a random animation and play it, again and again.
  • Create 5x5 lights on the ground. Because of the way that the light system works (each lamp is actually just changing colors to some neon colors… which are actually Crayola colors. I can’t recall which ones though, but you could surely look them up based on what I’ve used in the light JSON), I need to place them at different times to have different colors at the same time. So I’m delaying the placing (you can see that at the start, as the floor slowly “builds up”). The right formula leads to the effect here. I’ve also tried to have different things, such as having shapes… But it would have required too many different scripted lights to be worth it. Maybe one day when we have access to changing light colors via lua.
  • Play the music. Because this was delayed by ~300ms (due to polling and server<->client delay), I’ve had to put everything else in this step 300ms in the future. I’ve basically told it to play the music and approximately waited until it did so in order to sync it up again.

Downloads!

Disclaimer: This mod was developed for Alpha 2, over a year ago. It won’t even remotely work and while it’s somewhat feasible to make it work again (I guess), it’s not really worth the effort for me.

It was never intended for release, but I suppose if you’re interested in the modding history of Stonehearth, this is as good as it gets. As said above, I don’t include the audio (which is sad, because the whole thing was really built around it… and it fits so well), but you can easily download/buy/whatever the snippets yourself and get your own copy of a sheep mod. Or something.

The subwoofer has no recipe or anything, so it effectively needs to be placed by script (or cheated in). Like I’ve said, the whole purpose of the mod was that one video. I think it went well.

So if you’re interested in that kind of thing, enjoy my Blast to the Past.

15 Likes