BiiBii and “Land” behavior

Land strategies

After very simple testing of my original 3×3 grid of lands, I quickly determined it was substantially too small to be fun. BiiBiis who destroyed any area were then immediately on your base and the game was nearly over. Too fast and too stressful. We need more space to build tension up instead of rushing to a finish state.

So how big? 5×5 (25 plots) or 7×7 (49 plots)? I tried 49 plots and that felt too big, at least for level 1. So how about I build it to handle 7×7 but hide the outer ring for lower levels. But also, to setup the functions to accommodate 9×9 or larger if needed later.

I did some putzing in Excel to map out easier code so that I didn’t have to bother with padding issues (aka “01” vs “1” vs “001”) and to have a simple function to return which land a unit is one so I can quickly do BiiBii behaviors on hordes of them at once. The only real “gotcha” was that my land units, even though I started at 0,0, place themselves via the very center. So in a 36×36 sized land model, 0,0 is the middle, not the left bottom edge (as I would prefer). This meant my functions had to accommodate for a +18,+18 shift every time.

The numbers next to the axis are my identifiers so that, for example, the in-game Model “Land-202-198” means the Playground (cell D4 in this image). Then I can use a formula to determine which Land any npc is on just using math.floor((CurrentNum +18) / 36) +200 for each axis and then make the name “Land-Xnum-Znum” and I have the object name itself.

I used some other simple tricks for the Lands:

  1. When I want to hide them from the level, I move their CFrame “up” (which is the Y axis – that I will never agree with, haha) 40 units and set the land to Transparent. This way, it still exists, and when I drop BiiBiis out of the sky, if they happen to be targeting one of the hidden Lands, they will land up there, then move towards the center and drop another Land. This avoids issues with level design.
  2. When a Land is being damaged, I change it’s texture based on how close to dead it is. The last one looks more scorched (I choose Grass -> Fabric -> Pebble -> Granite) . Then, upon destruction, I move any objects that need to be hidden down (aka underwater) 100 units. At level completion, all of this is easily reset. But it is also important to leave the land in place – that means things don’t get easier as you will now have to push the BiiBiis past dead lands too. It does make coding much easier too, since BiiBii behavior doesn’t have to include swimming or flying over dead lands. I did try “Forcefield” which seemed like a good idea, but it looked too weird.
  3. I made sure to code this in loops and not be limited to what is defined. So adding more Lands will not require recoding.

BiiBii behavior

Since I already had a heartbeat going every second, it turned out really easy to code in some behavior I wanted.

  1. Randomy choose one of several options every second, but then add a random “decay” before the next action. Important that 10 BiiBiis are not “dancing in sync” – we want it to fee more real than that.
  2. One option is to eat the land, which does some damage on the land itself to progress that destruction.
  3. If the land is destroyed, pivot and move towards the Spawn Location.
  4. Or do some random movement a few paces in any direction. I thought about making the BiiBiis smart enough not to fall off to their death then realized – actually makes sense they would! So yes, they can accidentially kill themselves and add to your score. This also adds something nifty – maybe later we can add buffs where players can put down a barricade and, eventually, BiiBiis trapped will kill themselves haha.

This are moving to playable (milestone 1) state fast!

The Playground is destroyed, LOOK OUT HERE THEY COME!