PlomRogue Development Blog

7DRL 2015, Day 2

Today I set about implementing some actual 7DRL-specific game mechanics on top of my PlomRogue engine. To explain what I did, some more words about my game idea are warranted.

Some ideas for "Please the Island God"

I already quoted my <200 characters game idea description in my last posting. I'll give a more detailed version now:


You're stranded on an island. You want to get off again, but you lack the means to do so. There's no harbor, no civilization, no human inhabitants. No ships seem to be interested in this island, and no airplanes are seen. And you're not a very good ship builder.

Fortunately, there's some supernatural power that could help you get off the island, by some magic (what kind?). The island is ruled by some God-like spirit: the Island God. (I haven't decided yet how you find out about this, or how exactly you communicate with it.)

Unfortunately, that Island God is not sympathetic to you. It sees you as an intruder endangering its precious paradise. The Island God sees itself as parent and steward to all the plants and animals on its piece of land (you excluded, of course). It will not look kindly upon you destroying any of it, even if necessary for your own survival. The worse its mood towards you, the smaller help (and the more unpleasantness) you will receive from it. (What kinds of help? What kinds of unpleasantness?)

It may be possible to survive on the island eating up its plants, and hunting down its creatures. But to gain the Island God's favor, and thereby a chance to escape, you have to treat the wildlife kindly: Try to destroy as few of it as possible to survive. And over-compensate for it by supporting its growth, by helping animals in need, by supporting the spread of vegetation, etc. The Island God may recognize some of your acts of kindness to its children, and begin to trust you. This will go faster when its general moood is positive – something that depends on the general vitality of its playground. So it's in your best interest to support the growth and endurance of life on the island.

Implementing some of this

My engine already provides many basics: an island map to walk on, things to pick up and consume, other actors that stroll around, led by this or that pressure (to attack, to find food, to flee). The details of these mechanisms (how does the AI work? to what form is the island generated?) are somewhat haphazard. In certain ways, they can be edited via configuration files. But not in as many ways as I'd like to. And not in as many ways as I need for my 7DRL idea.

I therefore have to do some edits to my engine code. This day, I mostly added two variables describing the Island God: GOD_MOOD describes the Island God's general mood. For now, it drops when non-player actors lose hitpoints, or (massive drop) die. It grows when non-player actors gain hitpoints, or when new plants (not yet implement: new non-player actors) emerge. The other variable is GOD_FAVOR. This describes the Island God's sympathy to the player actor. It drops when the player actor hurts, or (massive drop) kills any other actor. It grows when non-player actors pick up food dropped by the player (i.e. the player feeds the animals).

I have some more ideas about events that could affect GOD_MOOD and GOD_FAVOR, but they're not as precise yet.

Manipulating GOD_MOOD and GOD_FAVOR

Implementing most of this was straightforwad: I made my engine's existing routines for actors winning or losing hitpoints (and plant-like things proliferating) grow or shrink GOD_MOOD (and, dependant on the player's involvement, GOD_FAVOR). I also added a flag PLAYERDROP to things when dropped by the player. Thus I could track the case of actors picking up edibles dropped by the player (and reward the player with a GOD_FAVOR bonus for it).

The devil's in the details about the amounts that GOD_MOOD and GOD_FAVOR should grow or shrink on each event. That's a balancing question I should not occupy myself too much with at this stage.

For the beginning, I made each hitpoint won or lost equal one GOD_MOOD point won or lost. Each new plant grown meant one GOD_MOOD point win, too. The death of an actor shrinks GOD_MOOD to the amount of hitpoints the actor was spawned with.

GOD_FAVOR is a more complicated affair, as its growth or shrinkage should depend on the size of GOD_MOOD. Player events cause certain base values, that then get multiplied with a factor that depends on GOD_MOOD. One non-player hitpoint loss caused by the player means: GOD_FAVOR decrements by 1 times this multiplier. One non-player death caused by the player means: GOD_FAVOR decrements by the killed actor's start/spawn hitpoints times the multiplier. Edibles "fed" to actors mean: GOD_FAVOR increments by the edible thing's nutrition value divided by 32, times the multiplier.

Highly advanced mathematics!

Now about the multiplier … For positive GOD_FAVOR changes, it's supposed to grow with GOD_MOOD if that is greater zero, or shrink otherwise. For negative GOD_FAVOR changes, it's supposed to grow with GOD_MOOD's absolute value if that is less than zero, or shrink otherwise. I played around a bit with Python's math module to find a nice curve for the multiplier growth. I settled on this formula for now:

def add_gods_favor(i): # # 
    """"Add to GOD_FAVOR, multiplied with factor growing log. with GOD_MOOD.""" 
    def favor_multiplier(i): 
        x = 100 
        threshold = math.e * x 
        mood = world_db["GOD_MOOD"] 
        if i > 0: 
            if mood > threshold: 
                i = i * math.log(mood / x) 
            elif -mood > threshold: 
                i = i / math.log(-mood / x) 
        elif i < 0: 
            if -mood > threshold: 
                i = i * math.log(-mood / x) 
            if mood > threshold: 
                i = i / math.log(mood / x) 
        return int(i) 
    world_db["GOD_FAVOR"] += favor_multiplier(i) 

Other stuff

That's not a whole lot of game mechanics I implemented on day two. I did not get further mostly due to many engine bugs I found on the way, that needed fixing. I also came up with some optimization ideas that I could not resist, for they seemed really simple. All of this greatly improves my PlomRogue engine, so I don't feel all that bad about it slowing down my 7DRL progress.


The game as I left it on day 2:


No comments on this page.

Write your own comment

Commenting currently impossible: Captcha not set.