Search This Blog

Saturday, April 21, 2018

Turncoat Tomb: Going Down!

When making Turncoat Tomb I originally wanted to go up and down stairs, but this was way too hard for me to do in a 7drl time limit.    The unfortunate byproduct of this was I made my whole game from that point on with a framework that didn't support persistent dungeon floors. 

You go up the stairs and the last dungeon floor is gone forever.

This is fine for a 7drl but it leaves out a lot of game play possibilities that I really wanted to have in the game, like fleeing upstairs from strong or out of depth monsters then coming back when you're stronger and beating the crap out of them.  Or having things on lower levels you can't get to but on level 5 you find something that lets you get to it.   That sort of thing.


The easiest, laziest way possible.  Just make objects not on your floor invisible and leave them out of game mechanics.  Boom.   Now  you can build 10 floors but it will only show the stuff on your floor.  No need to store anything, or re-build dungeon floors or anything complicated like that.

It has the added advantage of having all the entities on all floors there all the time. Some maybe minor interactions could happen on floors you're not on or more easily be able to chase you from floor to floor.

But whenever you "tack on" a big thing like that, there are issues.  For example I would see monsters on floor 2 that should be on floor 1.  Like ghosts, they just sit there and are intangible because I 'leave them out" of game mechanics, but there they are.    This is because I had a line of sight function that hid and revealed monsters if they were behind walls or not. That function wasn't floor savvy so it would "reveal" monsters I had line of sight to on wrong floors.

There's bound to be stuff like that when you add features late in development without starting over, but I think I got it licked.

I can now go upstairs to higher floors without destroying the lower ones, and it seems to work seamlessly and with no side-effects of having all the lower floor objects still exist.

Another fun side effect of this is now I can have basement levels!   I chose to progress UP instead of down so I could keep those cool stained glass windows.  But now I can have basement and cave levels so more variety is possible.

Wednesday, March 28, 2018

My 7Day RogueLike Dev Blog on the 7drl site

TURNCOAT TOMB 7DayRL Completed...   But still updating...

Play the latest version here:

Here is a copy of my development log from the 7drl blog: which you can either read here (below) or here (with pictures)

It's just basic comments I made after each day or so of development.   Development did not stop there, though.  It went on and is still going on...

Day 1

I’ve coaxed Construct 2 to act in a “turn based” kinda way with mid-turn animation so the player and monsters (whatever moves) kind of “hops” from tile to tile.

Did some of the pixel graphics ahead of time.
Now tackling persistent dungeons and overall framework.
I hope to get a working playable but empty game with title, really basic menu and 6 pcg dungeon levels you can move up and down persistently.
Basic monster graphics is done for all the colors (3 monsters each), Including the undead faction.
For more info on Turncoat Tomb check out my blogspot posts:
Anyhow break is over…

Day 2

So far a little slow going.  I’m not where I wanted to be, but hoping for that night time boost I always get.

My method of dealing with development challenges so far can be summed up with this joke:

Patient:  “Hey Doc, it hurts when I do this…”

Doctor: “OK so don’t do that.”

If thine feature offend thee, pluck it out!

It might be called Turncoat tower because you’re actually going up rather than  down stairs.

–and for now it’s a one way trip–

Don’t have time to make dungeons persist and allow going back to previous levels.

So far I’m pretty happy with the graphics! I very quickly threw together the pixel-art-style sprites.  I’m using Construct 2’s built in sprite editor pretty much exclusively for my tiles and entities, along with lighting effects.

Dungeon generator is done (minus items like my nifty animated torch).

All entity graphics are done.  Opening screen is done.  Animated turn based movement is done for player and monsters.

Now for the inventory, level and health, items, targeting and attack mechanics.

Just to show where my head’s at I have a family called “FnEverything”

Guess which objects are in that object family…

Day 3-4

I have basic meelee combat added and the beginnings of an inventory system.

I’ve added “altars” one for each faction.  These have a certain number of total points and for each monster they put out they use up so many turns.  You can see them counting down to the next monster.

Altars will be where you can bring gold to get weapons of that monster color and buy favor with that faction, But only if your coat is that color. that lets you join that faction.  The grey “human” altar just gives you ep (like Sword of Fargoal) and blesses your grey weapons.

Meelee combat produces blood splatters that I’m very pleased with!  It’s no accident that no matter what color the monster is, they all bleed red (except undead).

Also walls become transparent if creatures get behind them.

Day 5

Stop Hitting Yourself!

I had an interesting bug come up yesterday which I called “Stop hitting yorself… stop hitting yourself… why are you hitting yourself?”
Turns out if you program your player to automatically attack anything you bump into, then make the space bar do the standard “rest” thing where you don’t go in any direction… guess who you bump into!   YOURSELF!

My friend who is a biologist interestingly said, “This is a perfect video game analogy for autoimmune disorders. Just saying. Am not a nerd in multiple dimensions- am not!”

It was easily fixed but I did spend a good 10 minutes or so having fun with it and it may turn into a “feature” like a curse or something.  Actually it’s a perfect curse for this game because the theme is all about manipulating the behavior of your fellow denizens –turning them against each other and themselves or rallying them to help fight the real enemy which is the undead of the tomb.

It’s hard to get momentum… to get going.  I put it off by writing things… I’m doing it right now.

Another thing that hinders progress and puts completion at risk is my tendency to add unnecessary but still awesome effect and then spend a ton of time perfecting them instead of adding essential game mechanics.

The blood effect is beautiful if I do say so myself.

OK Back to it…

Day 6

Targeting based on hate levels works!
When wearing a red coat I no longer target the red monster but the green one.  When my color switches, it picks the appropriate target.   This is for monsters based on how much each color hates each other color.  You will target whoever you want provided they’re not your color.  Monsters will pick a monster of whichever color they hate the most within their line of sight to attack.
Monsters can’t attack their own color and you need to be wearing the appropriate coat to get or use their color weapons and such.  Note: I still haven't added other color weapons...

Day 7

Well here it is all done!

I PULLED IT OFF!  I can’t believe I did it!

I am beat! This was very intense.

Turncoat Tomb

Four coats to turn to and 2 glorious weapons slots.

I did all of the the game graphics every bit in Construct 2’s sprite editor from scratch.

I had to give up a lot of things I wanted to put in, but this is a very fun and complete game.    The thing is, as you go up the tower, the undead get tougher way faster than the rest of the monsters or you.  So the only way to survive is to slowly make frenemies with the color monsters so they will help you or at least not bother you against the living dead of the tomb. To do this you need to turn your coat as the name suggests.

ASDW directions.  Have fun it’s right here:

Here’s the description I put on

Around the levels there are coats.  When you get one you can switch to it and those monsters will leave you alone.  There are different colored altars that push out monsters.  Grey altars give you weapons and health when you put gold in them.

Other colored altars accept donations in exchange for that color hating you less.  When you drop gold in them (10gb at a time) a number form 1-10 floats out indicating their animosity toward you (whatever color coat you’re wearing).

The crypt altars will give you nothing but pain and they will always hate all life. But they’ll take your gold anyhow and who knows?  Maybe they will ask you join them.

It’s played entirely with the A S D W keys for direction.   Mouse click on coats and weapons to equip them.

Once you’re dead, the game reloads.

Sometimes it’s hard as… well it’s a Roguelike that’s for sure!

Monday, February 26, 2018

7DRL: Turncoat Tomb --About those dungeons

2018 7DRL only DAYS AWAY.   I'm so excited I just can't hide it.

Since it is within the rules to use commercial or 3rd party graphics, build on pre-made game engines like the T engine, or even build on previous projects, I'm using some of the tech I developed when experimenting for my book Let's Make a RogueLike with Construct 2.

The dungeon is a grid of tiles that are 32x32.  I made several generic dungeon generators for the book in hopes of explaining different ways to do PCG levels. 

My first example of a "procedural level" was with a "pillar and wall" maze generator similar to how Berzerk mazes are made.  I explained this in my "Roguelike maze" tutorial on Scirra's site:

This is a very easy and super fast kinda maze algorithm.  It can give you labyrinthine hallways and sort of room like areas. If you want a pcg level in a hurry it's a good way to go.

This was meant to be short, easy to understand, and maybe help someone get started with really basic PCG in Construct 2.

At the time I was very naive and not as sophisticated in my approach to making pcg levels.

In the tutorial (and in subsequent ridiculously convoluted attempts) I made levels by placing wall and floor sprites on the layout, then checking for where these sprites are with "feeler" objects checking for collisions, then adjusting things accordingly.

There are a couple of big problems with this approach:

If you put a sprite down, say a wall, then check to see if there's a wall there, Construct will think there is no wall there.

 I didn't know it at the time, but Construct 2 waits until all the events are done and a tick happens and the screen is updated before the sprites you just created are really "there" for collision checks.   You can say "wait 0" and THAT EVENT ONLY will wait a tick so anything in THAT EVENT ONLY will then see your new floor or wall or whatever if its checking for collisions. 

Notice how I keep saying THAT EVENT ONLY in rage caps?  To take advantage of the tick that happens after a wait action, you have to have your checks in events that are in that same event tree further down.

Other events don't give a crap about your wait command and will go on their merry way like nothing happened... so in those events, your collision checks won't work.

This led me to make some ridiculous chains of "make a floor, wait, check for floor, do something if there is one, something else if there's not, make a wall or something, wait, check for walls and floor do something else make another floor wait again..."  It started to get really ugly because all these waits have to be in the same event.  God forbid I call a function or have a loop or something.

 The fact that wait works this way is actually really awesome.  It's a good way to have it set up for most situations, but it's no fun for trying to build a level.

Furthermore if you have a big level with hundreds of sprite tiles and you have to do a bunch of nested collision checks and stuff, things start to get really slow.  Building a  very simple"Rogue" sized level can take almost a minute which is hours in waiting to load time.  And that's without any game objects.

Also it tended to make redundant floors and walls over each other which happens when you're throwing stuff around random -willy-nilly. It required some clean-up which was more collision checks in nested waits or with timed triggers or something.

Digger method:

Intuitively I thought a good way to make levels was with what I later learned was called an "agent based" or "digger" method.  I have a little guy pop up rooms, turn a random cardinal direction, move a random amount (while making a hall) then pop up another room.  When our little room digger gets too close to an edge of the boundary, I have it turn back.

The idea was good, but the execution was a mess.

The solution is just to add an extra step and make your level in a two dimensional array, then once the array is done building, have the game draw the level with sprites.  No sprite collision checks needed.  All the thinkin' is done on the array.

1 build your level in an array
2 have a generic array-to-level draw routine.

This way no matter how you build your array, your "draw dungeon from array" routine should work the same.

Also it's fast as sh@$.

I returned to the tried and true method, similar to the one used in the original Rogue.

It uses a tic-tac-toe grid and in random squares of that grid it makes random rooms... then makes halls between them.  You end up with the same looking dungeons as the digger method, but there's more control.

It's easy to see what's going on here.  The problem is it's kinda boring.  The dungeons are similar and you just have rectangular rooms.  With the digger method you have more unpredictable shapes because the thing digs rooms out on top of other rooms.

So I just added a loop to make a number of random rooms on top of the initial random rooms.

With some tweaks in the parameters, I can easily set my dungeons to "Extra Chunky (tm)"   Extra chunky = extra fun!   All the control of the boring dungeon, but none of the boring.

This is how fast it can generate complex dungeons in real time.  (The top is slowed down a lot).

Mmmmm. Chunky.

The "chunky" ones look  like playable levels in a more modernerish game.  Yes "modernerish" is a word.  It is now.  You're welcome, colloquial English.

Instead of taking 30 seconds to make a level you can make the same level 10 times a second.  At least.  Turns out it's a LOT faster to check numbers in an array than it is to check sprite geometry collisions on a layout.

Also there's less clean up because one value in an array can't be 2 overlapping things (unless you want it to --which I'll explain below).

A bit about my generic level array:

If you want more than just one thing on a given square --for example maybe you want a floor and a door or a wall and  a torch sticking out of it...   you will need to have more than one value in the same "area" in your level.  To do this you might want a 3 dimensional array instead of just x and y so you can stack values in each spot.

This seems like over-kill since most squares in say a 200x200 or 40,000 square dungeon  will just have a wall, a floor or nothing. Every step in the third dimension is another 40,000 values of mostly thin air.   That's a whole lotta nothin' going on.

What I did was keep just a 2 dimensional array, but use bit values. Bit 1 is a floor or not, bit 2 is a wall or not, bit 3 is a door or not...and so on.  This gives me the freedom to have any combination of 8  different things with a single number from 0 to 255.

To be continued:

Sunday, February 11, 2018

7Day Roguelike 2018: Turncoat Tomb


If I'm going to write a book on how to make a roguelike using Construct 2, well then I should be able to make a Roguelike using Construct 2 in 7 days and succeed in the 7DRL challenge or else why would anyone want to read my book?

I have been heavily inspired by the game Golden Krone Hotel. One of the things that makes it fun is the idea of factions --Vampires vs Humans.

You can be attacked by a horde of vampires in the middle of bloody combat, then drink some vampire blood and suddenly they'll stop attacking you. Oh you're one of us! It's all good! No hard feelings! And they even talk to you saying things like:

"I killed a man once... Couldn't kill him twice!"

...but then humans will attack you because you're a vampire. I love that whole really simple factions angle and plan to really lean into it with my 7DRL.

What is glaringly missing in this is the fact that human and vampire npcs never attack each other! It's just you for some reason.

I figure NPC humans and vampires don't attack each other because of some pact... kind of like the Continental Hotel in John Wick movies.

Image result for john wick inside the continental hotel

This is where another one of my big influences comes in. A much older one:

CROSSROADS for the Commodore 64.

Now THESE enemies kill the hell out of each other! In fact the first minute of each round is mainly just staying out of the way until the enemies reach a sort of equilibrium leaving you to clean up what's left. The enemies are different colors and the different colors and types hate each other while others can get along. They all hate you, but sometimes it seems somewhat less.

You're not so much participant let alone instigator in the main battle, but more of a bystander trying to survive the harsh ecosystem among the combatants let loose in the maze.

This was a game released as pages and pages of hex data the would be player had to enter by hand into a commodore 64 from Compute magazine in the 1980s and it was absolutely genius.

Imagine if Robotron were in a maze and the robots all hated each other.

So my game will have factions based on color and the enemies will also fight each other like in Crossroads, but leave you alone if you were in their faction (by donning their color) like in Golden Krone Hotel.

There's something magical that happens when you see NPCs fighting each other. From the first time I saw a Berzerk Robot shoot another Robot in Berzerk, to the first time I played HALO and saw the Covenant in the distance fighting the Flood on the snow levels.

Here I am witnessing this battle in the distance that has nothing directly to do with me and I feel more immersed in the world than ever.

My first real encounter with factions outside a war strategy game was Mercenaries: Playground of Destruction.

This game has 4 factions that are always in varying states of hostility toward the player with one special faction, North Korea being always hostile.

This hostility varies based on what you do in the game and some missions, for example fighting Chinese soldiers on a mission from the Russian Mafia will increase how much China hates you, but also increase the friendliness of the Russian Mafia toward you. So you're always juggling the varying factions and their attitude toward you.

Another special faction is civilians, who don't hate anyone, but cost you money in fines if you accidentally harm them.

What seems to be missing, and I could be wrong about this is that the hostility of the factions toward each other is not variable in the same way.

They hate each other or not pretty much without your intervention.


In my RL I want to have basically 6 factions:

GREY: The human faction

RED: Monsters

BLUE: Monsters

YELLOW: Monsters

GREEN: Monsters

BLACK: (Shadow/Undead)

Each color will have a corresponding dictionary containing floating point numbers indicating how much they hate each other color.

Magic in TT is heavily geared toward manipulating monsters and their factions. From slightly influencing how they feel about some or other monster faction to switching their faction altogether, joining their faction yourself, or utterly dominating them.

Sunday, November 12, 2017

Golden Krone Hotel and my Zombie Ray Casting Construct 3 Template

Golden Krone Hotel and my Zombie Ray Casting Construct 3 Template

Playing Golden Krone Hotel and it's kicking my ass! 

Those FN Snakes!  It had to be snakes...  But because it's a Roguelike in the truest sense, it always feels like I could have just done something a little different --which keeps me coming back.  When playing on normal and not playing very well, it has addictive feel of pulling a slot machine lever.  Just. One. More. Try...

The soundtrack is immersive and the game just *feels good.  Solid.

I was turned on to it by RogueLike Radio episode 138.

They interview the creator Jeremiah Reid.

It's hard to believe this started out as a 7 day Roguelike.  It seems really big in its scope.   The idea of making a Roguelike that fast with any kind of complexity at all.. I find somewhat intimidating.  Ill have to check out what the 7 day RL was like....

I didn't have to wonder long, because the original 7drl release is still available right here:

...And it's not at all comfortingly incomplete.  It's a really complete and playable game with the light and dark vampire mechanics in place.  It's a fantastic for a 7drl. 

Anyhow it inspired me to get to work on SOMETHING, because I've been really non-productive game wise the past few weeks.

I'm still working on my Construct 3 RayCasting game template which I would like to release on the Scirra store.

I'm making a zombie shooter as a template with indoor and outdoor areas.   Just walls.  Very old school ray casting.   Pretty cool for a 2d engine though.  

Tuesday, September 26, 2017

Retro 3d fps in Construct 3

*Update... I'm now using actual ray casting for the walls, but still the 2d sprite frames for the other objects like trees and grave stones. 

I made a simple ra-casting style 3d fps "engine" using Construct 3 with no plugins just Construct 3 events and some clever use of sprite animations.

My son wanted to know if I could add 3d capability to a roguelike game for Construct.  I can easily with Construct 2 using the 3js plugins, however

1. Publishing a game to android is a pain for me in Construct 2 and it's a breeze in C3.  Easy peasy.
2.  It's very satisfying to make all the 3d on my own and it have it even work badly.  It works!  I didn't think it would even work.
3.  Threre's a cool really retro feel to it that you don't get with a modern engine.  Something is magical about tricking a 2d engine into doing 3d ish things.

The way it works is I make a block in Milkshape, export it to a direct x object then use a program called "SpriteMe"  which can be seen in action here:

and I make it spin 90 degrees and capture about 1 frame for every degree.  This makes a roughly 90 frame animation.   Then with a little math inside Construct 3, it picks the frame depending on the angle it is to the pov.

Combine that with scaling based on the distance from the POV and you have some playable, primitive looking pseudo 3d!

That takes care of blocks but what about things like bullet holes or rounded paintings or small windows?  For those I just make them thinner when you get more of an angle to them.  If you're facing straight on they're wide, if you're looking at them at an angle they get thinner.

After lots of trial and error math it works.


Thursday, July 13, 2017

Let's Make A Roguelike with Construct 2 is coming along

Let's Make A Roguelike with Construct 2 is coming along...

I'm on page around 145 now and I'm thinking about taking some things out. I ran into some dead ends, did some things over and some parts just don't fit anywhere. I may have an appendix for these similar to "bonus content" deleted scenes you get on DVDs.

For example I started out using a dictionary data structure to store the player's stuff. This became cumbersome, however since a key/value pair can only easily hold so much information. What if the item was worn out but another identical item wasn't?

Since Construct 2's dictionary object can save itself to a JSON string, I thought hey why not have a dictionary OF dictionaries? The value of a particular Item you have could itself be a dictionary of key value pairs like "name: SwordBlade, worn out ness : 30, cost : 25, damage : 10, etc:etc" for the item "longsword1" or something.

But that got too complicated too fast and in my opinion introduced unneeded clutter and created more problems than it solved. It's not good to give yourself too many options. The data structure might as well be called "can of worms."

Instead I came up with a way where all the needed values are stored in the "items" sprite and those sprite instances can be stored right there on the HUD. So literally the sprite you pick up is the item in your slot. It's not a sprite that represents the item you are carrying, it IS the item you are carrying.
That way items can be used, have charges, or ammo or whatever and those values are stored for that individual instance with no complicated middle man data structures.

Anyhow page 145 and I still haven't got to the procedural parts yet. First I'm making the game play with a manually generated dungeon. The game should not care how the dungeon is made whether you draw it in construct, use a cave algorithm or lego style grammar based methods.

And thus far it doesn't

Moving right along...