• Register

You're the villain: it's up to you to build your own manor, raise your monsters and set up your traps to lure in and isolate your victims. But remember, a proper villain follows the Horror Movie Rules, so kill them when they're alone, keep the virgin for last, and do not hurt the dog !! Inspired by all the horror movie clichés, Machiavillain is a simulation/strategy game where you will get your fill of Dark comedy, silliness and chainsaws.

  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
Post article RSS Articles

(French version)

Hello Villains!
We are going to talk to you about the fog of war which is a new feature we’ve just added.
Fog of war is used mostly in strategy games. It mimics the visibility zone of your units. It’s a darker/fog layer that hides unit and terrain. It disappears as your units approach the fog zone, depending on their vision range.

In most strategy games, fog of war adds a “poker” feeling into the game.
Each player doesn’t know what the other player is doing because it’s hidden by the fog of war like you don’t see cards of your opponent in a poker table.
You have to guess what he is doing from the little clue you can get by sending scout units like you would do by looking at the face of your opponent in a poker game. Knowing the play style of your adversary is also a lead. Based on this reduced information, you need to guess what you should do to thwart your adversary.
Reducing the information given to the player with the fog of war is actually more fun, as he has to guess things only from clues like a detective!

But as MachiaVillain is a solo game, we added a fog of war in order to benefit from different advantages (not always present in multiplayer game):
– Exploring. Like in an adventure game, the player will have to explore his environment. Of course, this is going to be interesting once we will have monsters/stuff hide in the forest.
– Players will have to make the interesting choice between building/growing and exploring. When do you need to explore to discover new resource?
– It reduces the quantity of information you need to process at the same time at the beginning. You will start with a small portion of the map visible, so you can concentrate your attention learning how to play and not be distracted by the environment. Of course, when you will get better at playing, you will probably start sending your minion exploring your surroundings, at the first to seek resources.
– Hides the type of mineral in rocks. You need to find the best digging strategy to discover precious mineral deposits.

Let’s now talk about how we do it technically in MachiaVillain:
The terrain view is partitioned in grid cells. We need to know which grid cell is visible from your minion.
A cell will have 3 states:
– in total Dark (undiscovered)
– hidden in shadow (discovered but not visible)
– visible (seen by at least one of your minions).

We have to find out which square is visible by your monster.
We can apply two important rules:
– Monster can’t see too far.
– Monster can’t see through a wall.

For the first rule, we can select all grid cell around the monster from a distance.
This will give us a disk of visibility around the monster.


The second rule is more complex. We have to find out what is blocking the view of your monster. Like a real life light ray, we will send a ray from the eyes of the monster. If the ray hit a something like a wall, it will stop. Each grid cell the ray passed on without being stopped by a wall, is a visible cell. This ray will also stop when it’s too far from the monster (monster view range).

To do this we use a field of view algorithms for 2D grid based worlds. You can get a comparison of different algorithms here : Comparative study of field of view algorithms for 2D grid based worlds
We choose a modified version of the BASIC algorithm because we have an outdoor map (not inside a dungeon).

How is it working?
We need to send rays all around the monster (we decide that the monster sees all around him for the Gameplay we want).
To throw a ray we have to know the starting position and the ending position. The starting position is the eyes of the monster.
All around = on a circle. So we are first drawing a circle around our monster. Each cell of this circle will be the target of a ray.
To draw this circle we use an algorithm that draws circles on a 2D grid very fast. We useAndres’ circle algorithm (“Discrete circles, rings and spheres”).
(we used the Bresenham’s circle algorithm at first, but it gave us “hole” in our ray grid, see this illustration )
Of course, the radius of this circle will be equal to the visibility range of your monster.


And then we throw a ray from the monster, targeting each cell of the circle.


For this work we use another 2D algorithm which is “Bresenham’s line algorithm” (I promise, the last one!)
In school you may remember that to get a line equation (y=ax+b), and draw it on paper, you need to do some kind of division or multiplication.
With the Bresenham algorithm you only do subtraction and addition, which is more simple even for a computer. And you draw the line one cell at a time, which is great, because if one of the cells of the line is a wall, we just stop drawing the line ICON_Happy

For one ray:


Everything put together (throw ray on circles cell + stop the ray when it a wall)


And voilà:


What is great with the fog of war algorithm, is that we can use it to also get when enemies are visible or not by your monster.
So we reuse the calculation already done for another purpose. If an enemy is sitting in a visible cell, it’s visible by the monster.
The old algorithm was sending 3D ray, checking polygon and was heavy. Now we have more feature for a lower computation cost!

We can go further with the fog of war (just ideas):
– Add more hidden creatures in the forest. So the exploration must be done by strong monsters. Or you will learn to run away ICON_Happy
– Add thieves. So you will have to think strategically where to store your goods, so you always have a monster near to see him coming, and to protect it.
– Patrol against thieves. You can get some of you monster patrolling to detect thieves.
– A monster with a better visibility (“eyes” monster). You can hire a monster with a better view range. So he will be better at exploring and patrolling.
– Let the player deactivate it.

I could go on and on about the fog of war, but that’s probably enough already ICON_Happy

PS: Pictures are drawn by hand to illustrate the explanation and are not 100% accurate with algorithm underneath.

MachiaVillain takes a bite at Kickstarter!

MachiaVillain takes a bite at Kickstarter!


You're the Villain! MachiaVillain is a horror mansion management game inspired by Dungeon Keeper, Prison Architect, and every horror movie cliche ever!

MachiaVillain: Stuff !

MachiaVillain: Stuff !

News 2 comments

A sneak peek at a horror movie version of Ikea for an evil mansion sim game.

MachiaVillain creatures (2): Vampires !

MachiaVillain creatures (2): Vampires !


MachiaVillain is a horror mansion sim/management game, where you get to order around creatures ! After Zombies, here are your Vampires !

MachiaVillain: Zombies !

MachiaVillain: Zombies !

News 4 comments

A closer look at our favorite brainless workers: zombies !


This comment is currently awaiting admin approval, join now to view.


Just found this.Original,cute and probably very addictive.Track trackity tracking^^

Reply Good karma Bad karma+1 vote

Thank you for tracking us :)

Reply Good karma Bad karma+1 vote

Looks great, I'm tracking :)

Reply Good karma Bad karma+1 vote
zimra Creator

Thank you for following our game, KPL !

Reply Good karma+1 vote

I don't even


Reply Good karma Bad karma+1 vote
zimra Creator

Useless for the killing, but very effective to attract lots of virgins ;D

Reply Good karma+1 vote


Reply Good karma Bad karma+4 votes
zimra Creator

Thank you !

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.


Latest tweets from @wildfactorgames

RT @BP__Systems: This is one of the coolest thing I made in UE5. A level made of functions and nodes, explaining in real time what y… T.co

Jul 7 2023

RT @clemovitch: « Que des dispositifs prévus pour lutter contre le terrorisme soient utilisés pour criminaliser les luttes politiqu… T.co

Jun 26 2023

RT @TavroxGames: ☀️ Creeping Deck’s Prologue is out on Steam! ☀️ If you like strategic roguelite deck-builder, you can now wishlist, play…

Apr 26 2023

RT @zimra_art: Hi #PortfolioDay and amazing artists who participate! ^^). I love drawing cute, colorful characters in different st… T.co

Apr 12 2023

RT @VincentLivings: 1. It's well known that @MonsterEnergy is a notorious trademark troll. Unfortunately, they're at it again. For a co… T.co

Apr 4 2023

RT @studio_goblinz: We are so proud, Legend of Keepers is now a Tabletop Roleplaying Game! Check the Kickstarter page now:… T.co

Feb 21 2023

RT @Maitre_Eolas: Joyeux anniversaire à ce tweet. T.co

Feb 17 2023

RT @spirited_thief: Your treasure? Our treasure! 💰 Prepare your heist, break in, then escape with your newly found property! 🗡️ Wishl… T.co

Feb 1 2023

RT @HorizonJeuVideo: [IDF] Vous cherchez des QA testeur·ses pour assurer la qualité de votre jeu ? Les apprenants d'Avenir en Jeu cherch… T.co

Feb 1 2023

RT @TavroxGames: Join Creeping Deck's Beta! ☀️ We are working on a free demo for the Steam Next Fest starting on February 6th and we are s…

Jan 27 2023