Slime attack!

Dear all,

After a little hiatus due to personal reasons and game playing (finished Skyrim and starting Deus Ex), I got round to do the next big step in the BackToRoots engine: monster scripting. That is something of the past since now monsters can have a Lua script attached to them and we have a few callbacks from the core engine to diversify the behavior.

As shown in the following post, monsters can now have particular behaviors not automatically handled by the core engine.

The first example can be seen here:

[youtube http://www.youtube.com/watch?v=DCOROjGt1eg&w=480&h=360]

Slime Attack!

For the curious programmers out there, the Lua script for a slime to divide itself is really easy:

-- If a slime gets hit and is not dead, it divides
  function gotHit (gameState, us, attacker)
    isDead = LuaInterface_CharacterIsDead (us);

    -- If not dead yet, we will divide
    if (isDead == false) then
        found, x, y = LuaInterface_CombatViewGetFreeSquare (gameState, us, 1);

        if (found == true) then
            LuaInterface_CombatViewSendText (gameState, "Slime divides!");
            LuaInterface_CombatViewAddMonster (gameState, "Slime", x, y);
         end
     end
 end

One important element that is clearly visible is the difficulty balancing. I have to work on that and, once I’m doing that, I probably won’t want slimes to always split if not killed as is done for the moment.

The next step is to handle Daemon summoning but, with the interface I just set up for slimes, it should be a matter of minutes to get it done. The only thing missing is to be able to request a summoning instead of just adding it for the slimes.

Jc

1 Response

  1. Sanctimonia says:

    If you kill one slime and it makes two, you die. If you kill one slime and it makes one, you have the opportunity to run away. If you kill one slime and there’s a < 100% chance it makes a new one you can balance and scale the difficulty to the player's stats. Also if it's 1:1 turn-based you can't rapidly hack something to death or independently scale the frame rates of code execution.

    Even if you're just standing there, the code should always be going crazy trying to make things more interesting. I think the slime generation code looking for the unoccupied tile should be looped an arbitrary number of times to create way more slimes than you destroy. They could be made weaker in attack and HP so they're more like annoyances than enemies (made more transparent?). One enemy per tile, but multiple enemies could join together on a single tile to become thicker (in the case of slimes). It'd be like whack-a-mole but you'd be killing the swarm of slimes the whole time. The less-dense slimes toward the outside would be less opaque.

    What's really weird is that I decided my first non-player entity would be a slime. From Dragon Quest, no less.