Posts RSS Comments RSS Digg Technorati Blinklist Furl reddit 79 Posts and Comments till now
This wordpress theme is downloaded from wordpress themes website.

Archive for the 'Unreal Engine' Category

HeroQuest: Gold Spreadsheet

I made a spreadsheet for gold and special treasure.

Because we’re replacing (cross-quest disposable items) with reusable items, the only thing that can vary across quests (in terms of Heroes “leveling up”) is gold.  I’m enthused about creating a challenge mode where you can warp to a particular quest and try to beat it, with an increased difficulty mode, as an isolated challenge/puzzle (aside StarCraft 2’s campaign has this).  So even getting a variable amount of gold per quest, that you carry cross-quest, doesn’t necessarily mesh well with challenge mode.

We could have two modes – a campaign mode (where you save gold across quests) and a challenge mode (where you get a pre-determined amount of gold at the start of a particular quest).  And if we go that route, then I ‘m tempted to reinstate (cross-quest disposable items) for campaign mode.  But I find that idea kind of messy.

I also have concerns about the fact that your theoretical max gold (for each quest) is an absurdly rare occurrence.  The idea of someone playing through each quest ad nauseam (to get the max gold for that quest) makes me cringe.

I prefer to only tweak rules when it’s fixing a design bug (using the term “bug” rather loosely).  And I’d like to make challenge mode a core focus.  But even within those parameters, my latest design tweak is…   Each quest gives you a predetermined amount of gold.  Treasure card gold only lasts until the end of the current quest, and it can be used (when there are no monsters in line of sight) to buy treasure card potions (that last until the end of the quest).

As the heroes progress through each quest, they “level up” by finding new perma-items and by getting gold (which they can use to buy perma-items).  So I created a spreadsheet to analyze gold earned relative to maxing out what you can purchase.  The general idea is to make “leveling up” gradual.

With 70 quests (65 if we count: Dark Company as one instead of four, Mage 9 & 10 as one instead of two, Frozen 9 & 10 as one instead of two), it got a bit tedious, but the spreadsheet is useful to help balance the progression of (Heroes “leveling up”) versus (quests increasing in difficulty).

One thing that stands out is that the cross-expansion balance doesn’t seem well thought out.  For example, Mage in the Mirror has enough gold (8200 special + up to 2325 from treasure cards) + special treasure, that if you started from scratch, you’d still have maxed out armory gear by about Quest 5, and plenty of one time use potions.  As another example, The Frozen Horror Quest 1 gives the Barbarian (crossbow, longsword, shield) which suggests that you’re starting from scratch.  Yet the expansions don’t seem to be designed for you to start from scratch, because some of them give you gold rewards at the end of the last quest.  So I feel very justified in using the term “design bug” in describing my progression balancing concerns.  As much as I am aiming for authentic/nostalgia, I also want to fix these design flaws.

Another design idea this gives me is to have a campaign mode where you start each questbook from scratch (with starting equipment).  In that case, a more vanilla rules interpretations would be okay, such as…  Allow heroes to keep special treasure healing potions across quests.  Allow heroes to have multiple copies of a weapon (including the crossbow) (if they can afford the gold).  Looking at the spreadsheet, I don’t think the difficulty would be too high…  At first glance, Wizards of Morcar Quest 1 looks impossible (13 chaos warriors, a gargoyle, a boss), but not if you use European stats (monsters have 1 body).

Here’s the spreadsheet: gold

VR mode for HeroQuest UE4

My HeroQuest UE4 sabbatical went on longer than I’d like, and I’m hoping to do some more HeroQuest UE4 development – starting with VR support.  Dec 2017 I finally got an Oculus Rift (which required a CPU and GPU upgrade).  Last night, I was inspired to try it with HeroQuest UE4.  It worked without much effort, but clearly there is work to be done even for just basic usability.

I found I’m quite vulnerable to VR sickness issues including: disorientation, sweating, nausea, and headache.  I had to close my eyes when I do “End Turn” and the auto camera fluidly moves to re-center on the next game piece.  Trying to use the WASD camera (panning) also gave me immediate motion sickness.  Teleporting is safer for VR.  Zooming and Tilting seemed harmless.

The UMG Blueprint Widget is stretched, and it draws over both eyes as if they are one screen (it ignores stereo rendering).

Keyboard and XBox controller input works as expected.  I can highlight things with the mouse even though the mouse cursor is invisible (very strange).  Looking at actors (eg the red/yellow highlight actor during Action –> Move) also triggered a mouse-over.

Some basic TODO items include:
* Cameras: default position, disable auto cam moves, VR-specific camera improvements
* UMG menus need VR integration
* VR motion controller simple mode analogous to xbox controller; VR-specific controls (teleport, 3D interactions)

The high level goal is to support each platform.  UE4 gives most of this for free, but I still need to implement UI differences for desktop, tablet, console, and VR.  Actually because this is a board game, I suspect AR/MR may be the coolest platform, but maybe that’s for 2019.

image image image image image

PS: if someone wants to contribute (help with development and implementation), then please contact me 🙂

Contributions from Justin

I’ve had to slow down on HeroQuest UE4 development because I moved from TX to CA and changed jobs (from AMD to Samsung).  Meanwhile, I got contacted by a volunteer (Justin) to join the project.  So far Justin has been working on spells (menus and game logic), control systems, and game menus.  We’ve had emails to coordinate and to brainstorm on design and implementation details.

Here are early screen shots showing some of what Justin has been working on. Spell Menu UI.  Multi-square mouse movement (click on a dst and the game finds a path).  Pass through rock (walk through walls).  Veil of mist (walk through monsters).  Courage (+2 attack eg 5 instead of 3).  Genie (attack with 5 dice).  Swift Wind (roll double move dice).  Thank you Justin for the help, and I hope we can continue working on this long-term.

To anyone reading this, if you’re interested in contributing, then please contact me.

image image image image image image image image

Improved Hero/Monster 3d Models

Back in 2016/04, I used an EinScan-S (~$1000) to take 3d scans of the HeroQuest models.  They were a vast improvement over boxes-with-photos, but they were also pretty blurry looking.

About a year later (2017/04), a student (Thomas Springer) posted higher quality 3d scans using “ScanStudio” software, which I’m guessing means the ~$3000 NextEngine Laser Scanner.  He did this as a college project.  He posted the STL files as “free to download”, so I’ve used these to upgrade my existing figure/monster models.

You can find the STL files here –

For each model, I used MeshLab to convert STL to OBJ.  Then in Maya, I reduced each model to ~25,000 triangles (35k for the gargoyle), then reduced the base by ~85%.  Doing these quick edits for each of 17 models took some time, but it was worth it.  There’s still room for improvement (both in terms of quality and in terms of poly count), but overall it’s getting really close to looking like the actual board game pieces.  It’s definitely an improvement relative to my EinScan-S models.

One of the four orcs is missing (the one with the notched sword).  The USA expansions (Mage of the Mirror) and (The Frozen Horror) are included, but not the European expansions.  The Frozen Horror is missing the mercenaries (swordsman, scout, crossbowman, halberdier).

The following screen shots includes the upgraded hero/monster models.  Notice there’s one orc model that’s still using the blurry EinScan-S version.

Thank you Thomas Springer for these awesome hero/monster scans!  They pair great with the furniture that Jean is creating (in Blender).

image image image

Hobby Project Sabbatical

I haven’t posted updates because I was on “sabbatical”.  Jan 2016 to Mar 2017 I was consistently making progress on the HeroQuest UE4 project, but then I changed jobs and moved to a different state (from AMD to Samsung) (from Texas to California).  So I went on “sabbatical” from HeroQuest UE4 development.  During my “sabbatical”, I played more HeroQuest and continued to think about HeroQuest.  But I had to put development on hold while I focused on leaving my old job, on relocating, and on starting my new job.

As of today, I’m officially back.  With the disclaimer that I just changed from being a ~12-13 year veteran to a new hire, so I expect my day job to continue to require extra attention from my brain for at least a few months.  However, I will most likely be making some progress and posting updates soon.

Image result for heroquest Image result for ue4

Furniture Models (Jean)


One of the reasons I chose HeroQuest is to allow me to work on a unique project with a reasonable size and complexity (for a part-time solo project)…  But with a well-defined scope and a lot of pre-existing work that I can build on in terms of game design and asset creation.  Somewhat paradoxically (only somewhat), the assets (including 3d models) are an important part of what makes this project unique, see ( link ).

There’s still significant work in terms of tweaking assets and integrating assets and using them in the game, but I’ve wanted to avoid getting side tracked too heavily on asset creation.  My focus has been more on getting experience working with Unreal Engine (UE4) by writing code (C++, Blueprints) and by creating a well-polished game from start to finish.  So my focus is more about game programming (and game design details), while my work in terms of game art is focused on tweaking assets, integrating assets, and using assets.

The 2d assets are made from 2d scans, and the 3d assets are made from 3d scans.  Higher quality 3d scanning is becoming more available (less expensive).  As seen in my previous posts, I was excited to 3d scan hero/monsters and furniture.  That’s part of what motivated me to focus on HeroQuest as a multi-year hobby project.  The 3d scans are a million times better than placeholder art boxes.  That said, even if I constrain my goals to replication, they’re obviously not production quality – because the geometry is “blurry”.  Maybe in 2018 I’ll consider getting access to a higher end 3d scanner to see if that can give more detailed 3d scans.  Or maybe I’ll consider custom art (or even morphing this project into an original game instead of a HeroQuest port).  Until then, I’ve been happy to use blurry 3d scans.

The hero/monster figures are all one color, so a blurry 3d scan is pretty good for them.  For the furniture, there’s different colored plastic parts, and there’s textured cardboard.  For hero/monster figures, I still had to do work in (Maya, MeshLab, Unreal) to cleanup the 3d scans and import/integrate them.  For the furniture, the Maya work is more involved, so for my initial goal (described in previous blog posts), I just focused on doing the hero/monster figures.  And I tentatively delayed more work on the furniture.

Jean: The Dungeon’s Key

But then I got lucky.  Jean, a HeroQuest fan and 3d printing enthusiast, volunteered to collaborate on the 3d models.  He’s learning Blender (and 3d printing) for this.  So with Jean’s help, the HeroQuest video game is getting a much needed upgrade in terms of furniture models.  Jean is doing the core of the work in Blender, but it still requires effort for me in terms of collaboration, integration, and tweaks.  For example, I’ve sent Jean 3d scans, high resolution photos, caliper measurements, screen shots, and detailed feedback.  Jean’s blog ( ).

Working with custom digital assets and digital artists is good experience.  A lot of my hobby projects have been solo (or using public assets), but I’ve also done games that involved collaboration with digital artists and level designers (for custom art and custom levels).  Examples include DirectX 8 college games (Super IsoBomb, Xundar, Mega Monkey Mayhem), Torque 3D game prototype (City Hero Defense), and now this project – an Unreal Engine (UE4) game (HeroQuest).

In Progress

To keep things simple, my current plan is to continue using the blurry hero/monster 3d scans, and to integrate the Blender-created furniture from Jean (thanks Jean!).  With both monster/hero models and furniture models, the current plan is to focus on authentic replication (nostalgia).  I’ll probably stick with this plan for 2017.  In 2018, it’s TBD.  In the long-run, it might be cool to have an option to toggle nostalgia 3d models versus more detailed 3d models (which may include animations for hero/monster models such as walk, attack, defend, etc).

But for 2017, I’m excited to focus on replication for the 3d models.  These furniture models are a huge upgrade from the previous furniture models (which were just boxes with low resolution photos).  I’ll close with some screen shots of integrated furniture models.  The furniture models are still a work in progress, but overall it looks very promising!

map1 map2 map3


HeroScribe Pem’s Fork

The latest release of HeroScribe is HeroScribe 1.0pre1 (December 25th 2004) ( ), but luckily it’s open source.  And it was incredibly simple to setup a NetBeans project and start tweaking the code.  Thanks to the HeroScribe authors (and thanks to NetBeans & Java).

I’ve used C++ the most, but I also have experience (comfort, familiarity) using Java, C#, and Python.  So there wasn’t much of a learning curve for me to make some simple edits because I’ve already used NetBeans and Java for previous hobby projects (and I used Java in college classes).

The main thing I’ve added (thus far) is keyboard shortcuts to enable me to edit maps faster.  Added keyboard shortcuts for the main editor.  Added keyboard hotkeys and mnemonics to the File etc menus.  Tweaked the tab stops.  Improved text filtering (JFormattedTextField) for zorder input.

Being able to edit maps faster has multiple uses.  I can verify my code and its corner cases – recent examples include secret doors, monster AI, and traps.  In the long-run, I also plan to have two sets of maps – a nostalgia version and a balanced (play-tested) version.  Finally, improvements to the editor will be useful for others to create custom maps.

image image

Trigger Traps

The basic game has four types of traps – spear trap, pit trap, falling block trap, and treasure trap.  Each trap type has its own set of rules (game logic), details, and corner cases that result from those rules.  I implemented support to trigger (spear trap, pit trap, falling block trap).  I’ll come back to (treasure trap) later because it has quest-specific rules.

Spear trap rolls one combat die; a skull does 1 body damage and ends the hero’s turn; anything else and the spear misses.

A pit trap always does 1 body damage and ends the hero’s turn.  The pit remains, and multiple heroes can fall into it.

A falling block trap rolls 3 combat dice (each skull does one damage), prompts the hero to move one square, then ends the hero’s turn.  The fallen block remains (it’s like a normal block).  When prompted to move, you can’t move on another hero.  If you move onto another trap, it gets triggered, so theoretically you could have a chain of falling block traps.  A chain of falling block traps could result in a hero that is permanently trapped forever (and thus dies).  This never happens in the official quests.  However, it’s theoretically possible, so I implemented this corner case.

image image image image

Search for Traps

I implemented (search for traps).  It’s pretty much the same functionality as (search for secret doors), so I made an effort to share code.  Eg I have a SpawnSpace() function that takes a SpawnType argument that’s SpawnType::See, SpawnType::SecretDoors, or SpawnType::Traps.  If you’re in a room, the game does SpawnSpace() for each square space in the room.  If you’re in a hallway, it uses line of sight (does not see into rooms).

In the physical board game, there are no tiles for unsprung traps.  When you search for traps, Zargon just points to the squares that have traps.  So I created tiles based on the quest book trap icons.  NA quest book uses orange, while EU uses white.  I think orange looks better and clearly communicates “unsprung trap” with a heavy dose of HeroQuest nostalgia.

In-game screen shots and a juxtaposition of pit trap “discovered” versus “sprung”.  This is a nice example of how you can convey information with visuals.

image image image image

_pittrap pittrap

Monster AI mode

I made lots of progress in 2016, but there’s more work to be done for this to become a robust playable experience.  My goal for this project is to make a reasonably complete playable game – and to get experience making it with Unreal (UE4).  To achieve that goal in 2017, the AI doesn’t need to be super advanced.  However, it needs to be functional. and I’d prefer that it makes mostly reasonable moves.

So I’d like the AI to do some of the obvious strategic things.  Pick a good attack target (eg the hero with the lowest body).  If Zargon has a room full of monsters, then surround the door entrance – don’t just blindly charge and attack through the door (a counter to door camping).  In the normal situation, we want the maximum number of monsters to get an attack, so monsters already adjacent to a hero may do (attack then move) so that another monster can take their spot via (move then attack).

Most of this can be done using branching AI rules (conditionals), though I may need to iterate through possible moves (and pick a best move using a heuristic).  Each individual monster has a set of moves.  And Zargon’s entire turn can be referred to as a “move”.  That’s because Zargon can move the monsters in any order (unlike the Heroes who have to pick a turn order at the start of the quest).  So more advanced AI would need to iterate through possible Zargon moves (rather than just individual monster moves).  Beyond that, there may be scenarios where it’s useful to consider not just the current Zargon move, but also multiple moves in advance (and possible hero moves).

My high level plan is to start with something simple.  Simple AI is enough to make the game fully playable.  Anything beyond that is really an additional feature.  I can iterate on it, and gradually decide later how much effort (for 2017) to put into improving the AI.

For now, I implemented a first pass of a simple but functional AI mode.  Previously the monsters were controlled by the player (just like heroes), and I had implemented A* – which did nothing except display a path.  In this next step, I refactored monster control to be done by an AI.

On Zargon’s turn, player control and UMG menus are disabled.  Instead, monster AI creates a list of monster AI actions (strategy design pattern).  For each hero lowest-to-highest hero body, monster AI checks for a path using A*.  If there’s a path, then add move and attack to our monster-actions queue.  Once the monster AI is done with this “planning” stage, it moves to an “execution” stage.  The turn logic state machine takes input from either the player (for Heroes) or from AI (for Monsters).  The monster-action state machine executes one monster-action in the queue at a time – execute A, wait for done A, execute B, wait for done B, etc.

For this first AI pass, the AI just blindly charges at the hero with the lowest body and attacks.  This can lead to some blatantly non-optimal Zargon moves, but it’s still a milestone because it’s arguably sufficient (in terms of AI) to make the game “complete”.  Monsters are now fully controlled by AI, and they use A* to find a path to a hero, then move to the hero and attack him/her.  Here’s a video showing the new AI mode in action:

I haven’t decided what I’ll work on next.  Some ideas are – more AI, wandering monsters, traps, spells, basic systems for win/lose, or start looking at the HeroScribe source code.  The latest release of HeroScribe was December 25th 2004, so that’s pretty old, but I still love it, and it comes with source code, so I may add some enhancements to make map editing faster.  Whatever I go with, updates will be in my next post.

I’ll definitely do some more AI in 2017, but the priority is TBD.  If I decide not to invest too heavily in making the AI more difficult, then difficulty can be increased via simpler mechanisms – more monsters, higher stats, or limiting hero power.  A highly skilled AI would be cool, though it doesn’t necessarily make the game “better”.  It could even be argued that having the monster AI be less than perfect is more enjoyable than having a flawless Zargon AI that always does the most optimal move.  To increase difficulty, it’s arguably more fun to add more monsters (rather than by raising AI skill).  On the other hand, having a really “dumb” Zargon AI as the only AI option does seem a bit lame 😉

The rest of this post is just some quick brain storming notes on ideas for how I can improve the Zargon AI.

Hero(es) in a Room


Monsters can (move then attack) or (attack then move).  The mummies can only move four squares, so they can’t reach the barbarian.  The orcs should attack the barbarian, then move out of the way so that the goblins can attack the barbarian.  The skeletons should attack the wizard, then move out of the way so that the mummies can attack the wizard.  If the AI system does the monsters one-at-a-time and the goblins happened to be first in the monster turn list (because they spawned first), then they would fail to attack a hero.

For Zargon’s turn, he does a number of monster moves (“move” meaning move-then-attack or attack-then-move).  The number of possible Zargon moves is limited by monster movement – mummies move 4 spaces, goblins move 10, etc.  Different paths to the same square can be considered the same monster move, so that also limits the search space.

Let’s refer to the above monsters using “north” and “south” eg orc-north and orc-south.  Orc-north can move 8 (anywhere in the room), so if Orc-north goes first, then Orc-north has 20 possible moves.  It’s actually 40 because the orc-north can attack-then-move or move-then-attack (no available attacks).  The mummy only moves 4 squares max, but to keep it simple, let’s just say 8 monsters and 40 possible moves each.  If monster turn order was pre-determined, that would be 40^8 = 6,553,600,000,000 (or ~6.5 trillion).  The total number of possible Zargon moves is actually a lot more than that because monster order is not pre-determined.

How many turn orders are there?  The number of ways to order N objects is called a permutation.  Eg six permutations of the set {1,2,3}, namely: (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), and (3,2,1).  The number of permutations is n! (aka n factorial).  8! = 40,320.  So the number of possible Zargon moves in this example is something like 6.5 trillion * 40,320 = 262,080,000,000,000,000, which is ~262 quadrillion.  And that’s for our single room with 8 monsters.  I think that’s kind of on the high end (above average), but there definitely exist scenarios in the game with more than 8 monsters and/or more than 20 possible moves per monster.  And that’s assuming we only consider Zargon’s current turn.

I’m not sure how long it would take on my Kindle Fire’s 1.2 GHz dual-core Cortex-A9 (ARMv7), but 1.2 GHz is 1.2 billion Hz.  MIPS depends on various factors such as type of instructions, execution order, presence of branch instructions, etc.  But for what it’s worth, wikipedia lists Cortex-A9 as 1.5 GHz dual-core at 7500 MIPS.  So if we checked 262 quadrillion moves and each move took 20 instructions, then maybe we’d get 375 million moves per second, so 262 quadrillion moves would take 698,666,666.67 seconds or ~22.14 years.

To improve performance and to simplify debugging, we obviously don’t need to iterate all possible Zargon moves.

One way to narrow our search space is to only consider monster moves where the monster gets an attack.  For goblin-north, this means there’s a maximum of four possible moves, or less (depending on which monsters moved out of the way before goblin-north’s turn).  For the mummies, it’s only a maximum of two.  If a monster can’t make any attacks, then we can have it move towards a hero (such as the hero with the lowest body that isn’t blocked).

Another way to narrow down our search space is that for adjacent monsters (orcs, skeletons), they can attack then move out of the way – to the nearest space that’s not adjacent to a hero.  That means the adjacent monsters (orcs, skeletons) only have one move each.  Plus, adjacent monsters can go first.

So each orc has one move, each skeleton has one, each mummy has two, and each goblin has four.  If we assume a pre-determined turn order (that puts adjacent monsters first), then that’s only 1^4 * 2^2 * 4^2 = 64 possible Zargon moves.  64 is a lot less than 6.5 trillion!

Each of these turn orders has less than 64 possible Zargon moves.  But how many trimmed monster turn orders do we have?  Orcs and Skeletons move first – they just attack then move, so we only care about the Goblins and Mummies.  That’s just 4! = 24.  So 64 * 24 = 1536.  1536 is a lot less than 262 quadrillion!

We could then search through each possible Zargon move (that we didn’t trivially skip) and use a heuristic to calculate a guess at which Zargon move is the “best”.  One idea for a simple heuristic is just to make sure we get the maximum number of attacks.  If the goblins attack the wizard first, then the mummies wouldn’t get an attack – because they can’t reach the barbarian with only 4 move.

If the mummies were orcs (with an attack of 3, and enough move to reach the barbarian), then our heuristic might prefer higher attack dice against the wizard since a good Zargon strategy is to focus on killing a hero with the lowest body (especially if the wizard has lower defense and lots of unused spells, but lets ignore that for simplicity).  So orcs would attack the wizard (with 3 attack) and goblins would attack the barbarian (with 2 attack).  If the first orc killed the wizard, then that would trigger the AI to to recalculate (the rest of) Zargon’s move.

One scenario that “breaks” the above AI is if we have an Orc next to the Barbarian and an Orc next to the Wizard.  We’d prefer that both Orcs attack the Wizard.  If the Wizard is blocked, then we may need one Orc to attack the Wizard then move out of the way, so that the other Orc can move then attack the Wizard.

So we may want to consider the possible turns with adjacent monsters going first (and non-adjacent monsters going second).  That’s less than 8! = 40,320.  Instead, it’s 4! * 4! = 576.  So our algorithm could iterate through those 576 possible Zargon moves and pick one that maximizes the number of monster attacks (in our example it’s 4 attacks).  Because some attacks are better than others (eg more higher attacks on our favorite target is better), we could include that as part of our heuristic.  We could have the heuristic calculate the move with the best odds of doing the most Body Points of damage.  However, a better Zargon strategy is to focus on killing the weakest Hero.

This scenario assumes we have monsters in only one room and there’s heroes in the room.

No Heroes in a Room

image image

But things are different if there are no heroes in the room.  Because we don’t want to let the heroes door camp.  Our game even has modified rules to prevent door camping – can’t shoot crossbow or spells through a door.  If there’s no heroes in the room, then our AI should surround the door.  It’s also nice to block corners to make it harder for the wizard to move into the room, cast a spell, then be protected by two other heroes.

If a monster is able to attack the wizard in the hallway, then it might be worth it, because the wizard is the best target (the glass cannon).  An effective hero strategy is for the wizard to move into the room, cast a spell, then the other three heroes move adjacent to the wizard to protect the wizard from Zargon attacks (or kill all the monsters before Zargon’s turn).  So going after an open wizard might be a corner case (an exception) to the standard surround-the-door strategy.

The same idea applies to another big target – a hero with low body.  We could say 3 body is “low body”, so a big target can be defined as a hero with the lowest body (the wizard starts with 4 body).  Or we could say the big target is the hero that’s easiest to kill (account for the hero’s defend dice).  Or maybe the lowest body, and prioritize the wizard as a tie breaker.  Another consideration (for prioritizing Hero targets) besides current Body is number of attack dice, number of defense dice, and number of remaining spells.

Multiple Rooms

For game balance, I already designed rule tweaks that encourage players to do one room at a time.  When attacking (or casting a spell) through a door, you can only target adjacent.  When you enter a room, the doors have a Zargon force field that prevents you from leaving until all monsters in that room are dead.  So the standard situation is one room at a time.

But for AI, we need to realize that’s not always the situation.  If the heroes don’t optimize their strategy, then they might not do one room at a time.  The game also has scenarios where a trigger causes a room to be revealed – so we can end up with monsters in more than one room.  Ideally our AI will handle other scenarios too.

If two rooms have monsters, then…  If both rooms have no heroes, then surround the doors.  If only one monster-room has heroes and the two monster-rooms are adjacent, then consolidate your monsters into one room.  If the room is full (or blocked), then wait by the door to the monster room, or surround the other door(s).

Room Camping AI

Another corner case is…  Usually monsters can wait in the room they were spawned in, because heroes will have to attack.  But in some scenarios, the heroes could open the door, look in the room, then decide to go somewhere else.  Or in some cases, a quest trigger reveals a monster room, but the heroes aren’t obliged to enter that room.  If the AI is programmed not to leave the room to chase them, then that could result in some scenarios that make the AI look bad.  We could “fix” this by not letting the heroes complete a quest until they’ve completed all rooms (eg killed all monsters), in which case we could just say the monster’s preference to stay in their rooms is actually a “feature”.

Or we could have a (should we leave the room) check to the AI.  But be careful because if the (leave the room) check is something like (wait until the nearest hero is 10 squares away), then this would be easy for the player to exploit.  One idea is to have two modes that are specified per room (in each map).  If it’s a room we want to defend, then the AI will room camp.  Else, we chase the heroes based on some trigger such as (the nearest hero is 10 squares away).  In either mode, we will still chase the heroes if they reveal a nearby room with monsters in it.  In either mode, if there’s a good target in the hallway that we can immediately attack (eg Wizard or any Hero with less than 3 Body), then we make an exception.

« Prev - Next »