Archive for November, 2012

Now with levels, shadows, and new monster AI

For those of you who don’t know I’m creating a simple-ish RPG causal arcade game for NaGaDeMon – I’ve only got until the end of the month to finish it, and it’s been interesting juggling ambitions with a very strict time constraint. In the last couple days I’ve added simple gamestate + menu options to the project and worked on adding new levels and new monster AI.

Monsters now have a couple different AI modes – they have the original meandering one or they can make a straight beeline to the player. I used Oreilly’s HTML5 Canvas as a reference for the new equation:

if (monster.AImode == 1) {

                //Move in a straight line to the player

                var p1 = { x: monster.x, y: monster.y };

                var p2 = { x: 640, y: 225 }; //player ie center of screen

                var dx = p2.x – p1.x;

                var dy = p2.y – p1.y;

                var distance = Math.sqrt((dx * dx) + (dy * dy)); //distance equation

                var moves = distance / (monster.accel);

                var xunits = (p2.x – p1.x) / moves;

                var yunits = (p2.y – p1.y) / moves;

                if (moves > 0){


                    ship.x += xunits;

                    ship.y += yunits;


I’d still like to build more interesting modes here (circling bats and archers that wander the edge of the screen should be quickly doable) but we’ll see how we’re doing with time towards the end of the month.

Monsters now vary in speed, damage and hitpoints, and there is a level progression where the monsters grow in number and difficulty. Here’s some shaky footage of the latest build:

Not quite where I’d like to be in the 2nd to 3rd week. My todo list for last week isn’t completely scratched off and there’s quite a bit added onto it, and there’s a lot of testing I’m skimping on to get features into the game.

The whole project is still very simple. The lack of progress is really about me getting enough free time to sit down and focus on it (I’ve only had a few hours since mid-week to play). I also took some dead-ends while learning HTML 5. For instance, I spent some time looking at the built in HTML5 canvas shadow for the player shadow, only to then instead create copies of the player images, turn them black, squish them a bit in drawimage() and render them under the regular player image because it was faster to implement (I knew I could get the look I wanted in a graphics program in a few minutes, or I could spend hours tweaking shadowBlur, shadowColor, shadow.OffsetX etc, values – I chose the former).

I also spent way too much time thinking and and prototyping a menu using several different html pages and  brilliant looking metro, only to realize I’m not going to have enough content (leaderboards) to warrant it, so instead I just shoved html5 buttons on the default page and use style.visibility now to hide them during play:

  //Set Up Menu Screen UI Elements

    function showMenu(event) {

        menuEnabled = true;


        txtPlayerName.style.visibility = “hidden”;

        txtScore.style.visibility = “hidden”;

        imgPlayer.style.visibility = “hidden”;

        imgMenu.style.visibility = “visible”;

        btnStart.style.visibility = “visible”;

        btnHelp.style.visibility = “visible”;

        btnCredits.style.visibility = “visible”;

        btnOptions.style.visibility = “visible”;

        btnLevel1.style.visibility = “visible”;

        btnLevel2.style.visibility = “visible”;

        btnLevel3.style.visibility = “visible”;

        btnLevel4.style.visibility = “visible”;

        btnLevel5.style.visibility = “visible”;

In my opinion there are way better ways to do this, but hey this works, and didn’t take very long.

Not pretty but functional menu buttons

Here is the updated TODO list – completed items are crossed off, new items in bold.

“Code” work:

  • Player character Hit points + health bar
  • Unique monster attributes (speed, strength, hit points)
  • Level up screens and travel to new areas
  • Powerups/dropped coins
  • Gamestate screens (intro, instructions/help, credits, etc)


  • New AI modes (Archer and circling monster type)
  • Prettier health bar
  • Player walking on/off screen anim
  • Screen obstructions
  • Player shadow
  • Sounds

Next up – power ups and cleaning up the gamestates.


Read Full Post »

Latest Iteration

Been busy refining my core play mechanic for this NaGaDeMon effort – updated bits include swiping that doesn’t eat up processor constantly:

//Wait till finger comes down first before doing the touchhandler thing
    function startTracking(event) {
        mousePositionX = event.x;
        mousePositionY = event.y;
        var wtf = event.x;
        canvas.addEventListener(“mousemove”, touchHandler, false);
        playPlayerAnimation = true;

    function stopTracking() {
        canvas.removeEventListener(‘mousemove’, touchHandler, false);
        playPlayerAnimation = false;
        mousePositionX = 0;
        mousePositionY = 0;

and a health bar using a single image and built in drawimage() functionality:

ctx.drawImage(healthBar, position.x, position.y, health_percentage, image_height);

Also content:

  • Added player anims
  • Monsters have hit points
  • Animated hit effect when monsters are swiped

Here’s short footage of the latest gameplay:

I did bit of napkin planning over the weekend, here is my current todo list. I’m pushing for code work to be completed this week, content next week.

“Code” work:

  • Player character Hit points + health bar
  • Unique monster attributes (speed, strength, hit points)
  • Level up screens and travel to new areas
  • Powerups/dropped coins
  • Gamestate screens (intro, instructions/help, credits, etc)


  • New AI models (Archer monster type)
  • Prettier health bar
  • Player walking on/off screen anim
  • Screen obstructions

I spent some time scoping out other NagaDemon projects. There’s some exceptional projects out there. I like the way this card/hex/dice game (The Domain Game) is shaping up, and also Heaven’s Shadow, which is ambitiously listing itself on Indiegogo.

More towards the end of the week…

Read Full Post »

Been a little busy with NaGADeMon but was finally able to catch up on Zub’s chronicles –  in this issue Valeros and his companions drag one captured cultist around while tracking the rest, encountering ghouls as they go.

I’ve been an advocate for this comic so far – however, the story momentum seems to be slowing down, and they need to fill it with more than just random encounters. As much I enjoy a good wandering monster, ones that aren’t seemingly tied to the story are a bit of a drag.

That said, there are some nice character moments with Merisiel (although diehard Pathfinder fans probably already know all about her background) and the DM inside of you fills with joy when you see that the book comes with an entire scenario. The Pauper’s Grave cemetery that the characters encounter  has an in depth history write up, boss, detached map and a fully fleshed out scenario.

Quiet Character moments with Merisiel

Summary – story is beginning to drag, but the DM supplements almost make up for it.

Read Full Post »

OK, I’m actually a few days late for the first week of National Game Design Month, but as you’ll see below I’ve been busy. I’ve never participated in any of the various do X in a month challenges, but couldn’t resist this year.  Maybe it’s all the collaboration and effort I’m seeing friends put into Nagademon and Nanowrimo. Maybe it’s the ugly mugs of random old friends with mustaches showing up on FB promoting men’s health pushing me to do something productive in November. Maybe I couldn’t resist the siren call of something that begins with Naga and ends with Demon.

I’ve worked on short indie projects before but frankly have a history of going epic and overboard with my side projects. I hope Nagademon will provide a good design constraint, help me stay grounded and keep out the feature creep. I’m severely time constrained, and have a few big projects lining up in December, so limiting the effort to 1 month and at most a few hours a day is perfect. Let’s see how the first week turned out.

Before Nov 1

I have a game concept going into the gate. Three things:

  • I want to build something for Windows 8 marketplace.
  • I wand gameplay around a simple, swipe mechanic
  • Since this is Wandering Monster Studios there needs to be wandering monsters.

That’s it.

Day 1

Went to the store, got a copy of win8 and started installing it. Signed up to be an App Developer and got an email:

Thanks MS – Email sent me here in between updates.

Looked at other Nagademon  projects spinning up (like this rpg about the Smithsonian’s “Special Antiquities Collections Division” (SACD) and this one: “Monster Tales”

Starting missing lots of stuff that was Win7 but not Win8 – maybe the new OS wasn’t such a good idea. at least if I fail miserably and Nagademon I’ll have my updated OS to show for it.

Going through some of the documentation MS sent my way and got excited about monogame. Figured this was cheating though (porting some of my previous games instead of building a new one) –  I knew I would have to cheat eventually to make the 30 day date but decided not to do it in day 1 or 2. Maybe day 3

So far I’ve put about 1.5-2 hours and all I’ve done is some reading, install stuff and run updates. Perhaps this isn’t my forte. Realized I only had 5 hours until I had to get up again, so I left the computer installing Visual Studio 2012 for Win8, running updates, and downloading a number of javascript samples and framework thingees:

Prayed my 7 + 4 year olds would sleep through the night and called it quits for day 1.

Day 1: 2.5 hours. Nada to show for it

Day 2 – Friday Nov 2nd

Machine ran through night installing stuff without hiccups, yay!


Started going through the tutorials MS had sent me on game development. Skipped day 2 + 3 tutorials. Jumped to day 5 (windows game kit) which had the first decent source code sample. Skipped ahead again after that – downloaded the Atari SDK samples. Went for other downloads in my quest for good sample code and assets.

Took a quick look at the free previews of  Gamemaker, Game Salad, Creator, etc that are advertised as helpers for Win8 development. Still cheating to some degree but picked a date (Nov 10th) where I’d start falling back to frameworks like this if I wasn’t happy with my progress – by progress I mean I want the core mechanic in place –  and it needs to be “fun” already.

Finally get space cadet from win8gamekit.codeplex.com running – whoop.

This sample is actually pretty good for what I’m looking for – but the controls seem iffy on my surface device so that’s what I’ll probably look at first.

Checked out the Space Cadet authors blog to see if he has any tips or a more thorough code explanation – He does, so I start digging in. I Listen to his game loop video tutorial.

Game loop looks like:

  • initialize
  • load resources
  • input
  • react to input + feedback, via draw loop

Also listen to the animation and touch instructions videos. I’m not seeing the Prince of Persia sample from the video on codeplex anywhere – lame, I really want to do animated sprites and hoped for a good sample.

Told myself I would focus on controls – Davedev is using Mspointerup  to catch his touch events. This isn’t what I want for my swipe mechanic, so my first actual code change in Space Cadet is to switch the mouse/touch event to this:

//Handle Touch

canvas.addEventListener(“mousemove”, touchHandler, false);

Now, instead of mouse up we can swipe to hit ships. I think swiping is much more fun than tapping – and feels more Wandering Monster-ish, and almost sword like. And now it’s easier to levelup:

Level 42 – how far did you get in space cadet?

Changing touch was easy – now I need to change the AI. Started experimenting with updateShip() but then needed close it down since the kids were getting up and I needed to get them off to school and hit the day job

Day 2: 2 hours and I have Space Cadet with a swipe.

Saturday 11/3

I was too busy –touched no game

Sunday 11/4

Ditto – today is a total wash

Monday 11/5

Downloaded paper.js because it looks like I’m not going to hit my deadline by the 10th. Remember how much I hated trig as I start to work on vector functions for AI. Skip the trig because I’m starting to feel the burn of time constrain having basically nothing to show after 5 days. Open up my standby AI book AI for Game Developers. Thumbing through it decide to start with a simple move towards the player algorithm and build more complexity later (if there’s time):

if (ship.x > middle_of_the_screen.x) {

ship.x– -ship.accel;


else if (ship.x < middle_of_the_screen.x) {

ship.x ++ -ship.accel;


if (ship.y > middle_of_the_screen.y) {

ship.y — -ship.accel;


else if (ship.y < middle_of_the_screen.y) {

ship.y ++ -ship.accel;


With Swipe and some simple AI, its starting to take shape.

Tuesday 11/6

Changed my ships to sprites that are animation capable using this article:


Discovered that the key to sprite anims are the slicing of the image. That and using a timer. Got it.
//Animation Timing (for my homebrew sprite additions)

function myTimer() {

if (animationTmer < 7) {

animationTmer = animationTmer + 1;


else {

animationTmer = 0;




ctx.drawImage(ship.img, animFrame, 0, SHIP_WIDTH, SHIP_HEIGHT, ship.x, ship.y, SHIP_WIDTH, SHIP_HEIGHT);

Want to build more and follow the tutorials gradients et al  but I’m out of time again.

Wednesday 11/7

Looked at a bunch of other cool Nagademon projects:

Decided on a rough timeline I need to adhere to:

  • End of week 1: core mechanic in place. Game is “fun” at it’s most basic.
  • Week 2: game code/ game play done (i.e. Code complete)

    Art from an earlier, yet as unpublished Wandering Monster Studios effort

  • Week 3: All art/assets done (i.e. Content complete)
  • Week 4: testing, playtesting, and marketing (marketing really should be 2-3 weeks, or as long as development, but I figure it can bleed into December)

Thursday – 11/8

Lots of polish – Replaced most assets and imported animations. Here’s where I cheat a bit and bring in art I have used in earlier, unpublished games I’ve worked on, as well as assets that I’ve either scrounged or purchased (like Wit entertainment’s fantasy character pack and Pow Studios effects).

With the art and all of the fiddling I’ve done with spawning, AI, and sprites I now have something that looks OK, uses a swipe mechanic, and has wandering monsters…. In other words, I hit my Fun goal (and just in time).

Will post more next weekend. Meantime here’s a  screenshot and video.

Screen after week 1.

Read Full Post »