Saturday, March 26, 2016

Dungeon Crawler in Java

I have begun building a dungeon crawler game. The premise of the game that I came up with is a little odd for a dungeon crawler but hopefully it will be interesting and you'll like it.

So the world is going to be made up of dungeons, yeah obviously. The dungeons will have been created from a simulation of AI dwarves starting from just two in a random area. I plan on creating some unique monsters that spawn in order to slow or stop the dwarves quest to build meaningful dungeons. Build in some magical items and of course hopefully some humorous history generated for NPCs, books, spells, and items in the dungeon crawl.

The world currently is all dirt except for a 5x5 area of grass where the dwarves will start out, need to add in minerals and rare metals etc. Also little hazards ;)

Tools I'm using:


Heres a snippet from the Dwarves current behaviortree

    public static AICreature createMaleDwarf(final World world) {
        InOrderSequence root = new InOrderSequence<>();
        SelectorNode isHealthy = new SelectorNode<>();
        SelectorNode isDanger = new SelectorNode<>();
        isDanger.addChild(context -> {
            return world.findHostiles(context, context.getAwarenessDistance()).length > 0;
        }, isHealthy);
        Action attack = context -> {
            return NodeStatus.FAILURE;
        };
        isHealthy.addChild(context -> {
            return context.getHealth() > 80;
        }, new LeafNode(attack));

        LeafNode isBored = new LeafNode<>(context -> {
            if (world.every(context, 0.3)) {
                world.moveToRandomAdjacent(context);
            }
            return NodeStatus.RUNNING;
        });
        root.addChild(isBored);

        root.addChild(isDanger);
        return new Dwarf(root, world.zero());
    }

Teaser

No comments:

Post a Comment