Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Funny emergent behavior in my indie game

Sign in to follow this  


I've had my head down in my code for so long I almost forgot I need to show people all the work I've done!

I'm making an indie game called Lord of Dwarves. It's a dwarf management game in a completely constructible/destructible 3D block world. Gather resources, grow food, & craft hundreds of items. My focus for the game is the ability to build a custom castle and then see how it holds up against hoards of monster invaders.

I started on this game in 2013 and (pause to run my line count program) have created 291,043 lines of code. Thats over 10 million characters (yes I've changed keyboards).

One of the most amusing things about creating a program so large is that the game systems start to interact in surprising ways. When I added beds to the game, I programmed the dwarves to find and sleep on them instead of the ground. I didn't realize at the time that the animals AI still used some of the dwarf AI code.

I ended up with the situation below.


Deer confused with proper use of bed pillow

Suffice to say my dwarves were waking up with stiff backs while the animals were getting well rested bonuses.

Another time I taught the animal AI to find and eat the dwarves' crops. The idea is that the player must task their dwarves to surround their farms with a gated fence to protect them from hungry deer. Little did I realize however that the deer were using the same code as monsters for movement. This included the ability to break down doors and gates for siege play.

So I go to test the fence code and watch as a deer casually walks up to the gate and proceeds to tare it down in one kick! He proceeds to help himself to his fill of crops and then casually walks out over the splintered remains of the destroyed gate.

While not great for the final product, unexpected emergent behavior like this is can be quite funny to experience. I'll leave you with a picture of another deer flexing his (unintended) beer drinking code.


"Ye better be bastin' yerself deer!"

If you'd like to learn more about LordOfDwarves check it out at lordofdwarves.com

Or see my latest screenshots on twitter

Sign in to follow this  


Recommended Comments

Love when funny things like your examples happen. They can allow you to add little niche features and remind you of shortcuts that need to be backfilled.

Share this comment

Link to comment

291,000 !!! wow, that dwarfs my peasley 10,000.  That is intense dude!

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!