Monday, October 7, 2013

Apparently I update every 6-8 weeks...

...which is probably about right all things considered.  I wish I had more time to devote to hobby game developing.  However, I'm not going to let that stop me from doing it here and there.  Priorities.  =)

I wanted to mention today that JSTileMap can be found on github here.  It's reasonably useful, though it could be better.  (Yes, I am a perfectionist, and the first thing I do is criticize my own work!)  I should be bragging just a little -- it was used in iOS games by tutorials, and is one of my larger projects that I've developed and released out into the wild.  And hey, I guess I can say that now I'm published!  =)  If you're doing anything with SpriteKit and TMX maps give it a look.

I've started this evening going through iOS games by tutorials and plan on looking at it for the next month or two, hopefully firming up my next project's ideas.  I'm still toying with making a platformer in addition to the AI work I'd like to do that I mentioned in my last post.  I'm not going to lie, life will be busy and time will be limited.  We have 4 children's birthdays in the next 4 months (Nov, Dec, 2 in Feb) in addition to a family reunion, halloween, a baptism, thanksgiving (twice), christmas, possibly a trip back east and another trip south with my parents.  Oh, and a cocoa conference I'm going to this weekend, with the possibility of a startup weekend in there somewhere.  And that's just off the top of my head, on top of everyday life.  Going to be busy!

I am hoping for a great Christmas break though, where I can get a day or two of coding time in.  I hope to have a bunch of planning done by then so I can crank out some good code.


If you're interested at all in iOS 2d programming, it would be worth your while to check out SpriteKit.  I've skimmed the first half of iOS games by tutorials and it looks very well put together for both beginners and advanced users.  The former for learning, the latter mostly for reference.

One other thing I should mention is an interesting company called apportable.  Assuming I actually get a game done and polished enough to release, I'm going to seriously consider using apportable to release on android as well.  And I think they are working on an ouya style port which could be darn cool as well.

Lastly, I'd like to link to an article about a guy I've been following on twitter for a couple of years.  He is known as @thegamedesigner and released a whimsical game called Electronic Super Joy.  Even if you're not a big gamer, his story is a very interesting one, and definitely worth a read.  Drop him a few pennies if you like what he's doing!

Good times ahead!

p.s. I've started trying to have more of a real presence on twitter (rather than re-tweets and links mostly, though that's still a lot of what's there).  You can follow me if you're so inclined @slycrel for more about what I'm thinking about on a more regular basis regarding coding and game design.

Sunday, August 4, 2013

AI resources

I came across a great resource for AI programming today.

It's got some pretty good articles.  Particularly one that caught my eye was this one that was posted a couple weeks ago, in a similar vein to an A* algorithm, called theta*.  It's about line of sight pathfinding, and looks very cool!  Worth checking out.

Also, last night I was talking with some friends about my next project that's been tossing around in my head for a couple of years.  I'm reminded of this today because I found that article while looking at behavior trees.  For my next game, I'm considering using state machines instead of behavoir trees.  But state machines laid out likebehavior trees.  I think, if I understand both kinds of things.  Let me see if I can describe what I'm thinking for my next project.

Generally for people how they make decisions is that they have desires.  Desires lead to thoughts, and then thoughts lead to action.  So I'd like to try an AI system that will work this way.  It will be a fun experiment!

With my experiment, an AI NPC will have desires or motivations.  I'm thinking to start physical, emotional, social, profession, and hobby.  These would be prioritized based on their overall values.  i.e. if the NPC is in love they may have emotional at the top of their list, causing them to skip a meal to be with the object of their desire.  (you can love things or actions as well as people!)  Emotional is greater than physical  in this case.  I have this system pictured in my head like a 5 pointed star, each point on the edges of a circle, and the middle representing primary motivation of the NPC.  Depending on the "weight" of the different points, the NPC's behavior would reflect their motivations accordingly.

I am also planning on giving the AI goals to represent actions -- different behavior patterns that can be displayed.  Likely the goals would also have a weight to them.  i.e. sleep would be low on the motivation list, but after 2 days of no sleep it would jump up to the highest priority goal of the NPC.  Having weights for goals, as well as short or long term goals, will help give the AI lifelike abilities.

So motivations help the AI pick goals, and goals help decide action, which leads us to overall behaviors.

The player would totally be in the dark even if this were a perfect system though.  So we will need a feedback system.  Probably some graph bars or maybe a mood ring kind of system (I'm somewhat against hard numbers in cases like this, always have been, not sure why...).  In addition to that, it would be good to have primary and secondary motivations that have a thought bubble (i.e. "I'm sooo hungry!") or possibly an icon/image representing what their current goal is, and possibly a secondary or sub-goal that they might be thinking about.

So sounds great in theory, much harder to code for.  And of course there are always complexities when simulating life.  i.e. I'm kind of grumpy when I am hungry.  Should I take things like comfort/discomfort and overall happiness into account?  Lots of other things could also factor into this like "gut feeling" AI types vs "rational" ones, extrovert vs introverts, pessimistic vs optimistic, etc.  I probably won't do all of that the first go around.  =)  Not to mention scalability of this kind of system.

If I can get this right, then the initial decisions can stay relatively static, while actions (or rather goals) can be added dynamically to the game easily and allow for more and more flexibility, and build a game around it.  I have a slushy goal of getting something going by the end of the year, after JSTileMap is out and being used.  Wish me luck!

Thursday, June 20, 2013

Quiet around here lately...

I've been doing a little underground work lately working with SpriteKit, apple's new iOS 7 clone framework that is basically the same as cocos2d.  If you follow my blog you'll notice that that's a natural fit for me. SpriteKit looks to be very well done and I'm excited to play with it and see what it can do.  But what's a guy to do with a framework that has no TMX map viewer?  Well, apparently write his own.

Yeah, I think I might be nuts too.  That's a bit ambitious for a late night hobby.

Still, I've conscripted the help of a kind soul who wants TMX maps in SpriteKit as well as having been given source access to the developing kobold2d.  I might even use that source as a cheat sheet if I get really stuck.  =)  But for the most part, this is a learning experience.  I've been able to make a TMX generator, so why not a TMX map viewer?

Well, so far so good.  Mostly.

Layers, rotation and tiles are all in and working.  There are some lame lines throughout the entire thing. I'm not sure if it's antialiasing that's causing these or just some bad math.  Meh.  Regardless, It's getting there!  Exciting stuff.  =)

Also of note, an awesome game developer, Noel Berry, that I follow on twitter posted some thoughts of his about procedural generation in his current project.  It's worth a read, and it has source!

Monday, May 20, 2013

RPG TextBox

Life has finally settled down a little and allowed me to take a breath.  Wow, that was fast, I'm now out of time again.  =)

I've mentioned previously that I had some RPG text box code that I wanted to release.  I took a little time tonight to finish updating it to cocos2d 2.x and made it mostly work.  Multiple pages were supported in my original version but they seem to be broken right now.  Probably not a huge deal.  Either way, here is the code and a screenshot of the demo.  Consider it to be under the MIT license if you'd like to use it.

Tuesday, April 16, 2013

Excellent articles

I thought I'd post these two links here.  Very much worth reading!

RPGs and Procedural Content Generation

Care and Feeding of Software Engineers

As of today I am now homeless.  Once I get back into a more permanent home (which is in the works) I will start iterating on some of my content I've posted here.  Until then.

Thursday, April 4, 2013

Quick update (again)

Things have been busy, and life has been near all-consuming.  I have spent a couple of hours on the RPG textbox code, but have run into some snags with cocos2d 2.x and TTF fonts.  So it's getting there but not there yet.  Sorry for the delay.

I did run across this link this morning which looks very good for menuing in a game using cocos2d and thought I would share.

I have also had a few email questions about collision and the TMXGenerator code I have posted on this blog.  I would like to direct those who are looking for examples to check out either the base cocos2d-extensions example, which includes collision detection, or to have a look at Ray Wenderlich's write-up about creating a tile-based game with cocos2d.

Until next time.

Sunday, March 3, 2013

Quick Update

I just wanted to drop a note in here to mention that I've not abandoned you all.  I've recently started a new job and am possibly moving in the near future.  Needless to say I've been pretty busy and haven't done much in regards to my hobbyist coding.

That said, I have been considering releasing some source that I have done last year for a RPG text box in cocos2d.  This thread being bumped reminded me that I wanted to do that at some point.  So if I get some time in the next week or two maybe I'll clean up that code into a sample project and release it here.

I'd still like to get back to the maze stuff soonish as well.  I keep wanting to get house style layouts auto-generating and fixing some of the bugs up that are in there.  As well as maybe making a settings for the random maze generator.  Guess we'll see.  =)

Tuesday, February 5, 2013

We love source!

So I'm pretty stressed today.  To try and alleviate some of that I thought I'd put out there some of my code for the auto-drawing app that I have done.  You can consider this code to be under this creative commons license.  Have a look and be inspired.  Or laugh at my older cocos2d skills.  It's a little dated, but still works pretty ok.  Maybe someday I'll update and take this project to the place that it really ought to go.

You can get the code here.

Saturday, February 2, 2013


I want to apologize to anyone following along or waiting for some code changes.  I've been somewhat busy lately with real life stuff.  While that may not entirely go away, I hope to have that let up some here soon.

I have started kicking around an idea I've had for a while, which is to make a MUD style game in ruby.  Mostly to learn ruby, but also because I've always liked the idea of MUDs (and MUSHes, a good friend of mine had a MUSH on his BBS back in the day.  Yes, I'm dating myself with that one...)

Since this is a game dev blog I'll post the brief outline I started the other night.  It's by no means complete, but it should be a decent starting point and a place to collect my thoughts.  Assuming I get anywhere useful I'll put a github link to the project here.  For the moment I only have a text parser that understands help, quit and parrots your input back to you.  Yeah, it won't be winning any awards anytime soon...

Anyhow.  Enough of that.  On to the outline.

A world exploring/building text adventure style game.  Players can discover pre-made worlds as well as
create their own world.  Should be a good tutorial/intro as well.
Note: this is probably crazy ambitous for a starter ruby project (past a hello world app)

Currently working on:
- database persistence in sqlite3 (

- typing anything with 'quit' in it will quit the app, even if it's in a sentence.
- Lila says it needs moar kitties.

- Update the interpreter
- Add help to the interpreter.  Make this basic, but interactive.  Above all descriptive.
- add basic vocabulary that does stuff.
- look (examine), move, take (carry, hold, get, steal), say, [more]
- Add a basic tutorial
- Add a (less basic) tutorial.
- Add a basic world with a cheez-ball story.  Maybe reminiscent of king's quest 1 / space quest 1?  (but not as elaborate!)
- Add player object specifics and customization
- Add multiplayer via a server model that multiple clients can coonect to.
- bonjour would be cool for connecting here.  looks like dnssd is the gem for this.
- Also whispering and possibly in-game emails?  Too much?

- All objects should have a parent, owner and creator.  Default owner is the room the object
is created in, no parent, and creator is the player.

- objects can have attributes.
- attributes should have passive triggers.  i.e. 'steal bread' should not broadcast
to others in a room that a player is taking the bread.
- should objects have a material type/types?  (this would help with world behavior.  Wood burns, stone does not, etc)
- for multiple types, if one is destroyed the object is destroyed?  i.e. a wooden shield with steel studs falls apart when burned
- players should have a custom range of attributes.
- Intelligent monsters could be an alternate computer controlled player, that have their own agenda and motives.

- Add basic infrastructure (API) which is defined as:
- portals/doors
- to other objects.  (objects can be rooms!)
- doors should have their own description, or the user should pick material type.
- We should at LEAST have a standard door that is the default.
- event triggers
- Design triggers.  How do they work.  What events can trigger them?  What can players add or not add?  Can we actually have players add ruby code to meaningfully interact with the world?
- initial thought - triggers should be proximity based (passive), or directly activated (active)
- passive triggers modify the connected object.
i.e. if you are carrying a magic glowing rock you have light around you as a passive effect.
- active triggers can be one-time or continuous.
i.e. turning on a flashlight is a one-time event that maybe activates a passive effect.
i.e. breaking a vase would be a one-time effect.
- custom object methods
- ideally these would be persisted DB objects that can have custom methods.
- thinking some built in actions (teleport to certain places, lloyd's beacon, opening, closing, destroying, etc) would be ideal as an API that makes objects with custom lego-like constructed methods.
- possibly triggers could have some form of ruby to make them very powerful?  How much would we have to expose in order for this to really be useful?  Is that a good idea?

Saturday, January 12, 2013

More mazes??

I've done a few things here and there, but very little in the past week or two on my hobbyist projects.  Today I sat down for a little while and fixed a couple of bugs as well as added a random menu item to the code.  So you can both re-seed the current settings or have the program generate new settings.  I'll update the code at the github repo.

I created a project to start exploring internal building layouts but haven't done much other than migrate some stock code to it.  I will hopefully get to that soon.

For the curious, I had a few out of bounds coordinate bugs that I found as well as a crash on startup the very first time you ran the code.  I also messed around with door to room generation but didn't really get what I wanted to done there.  I hope that rooms will more often have doors to more walls before doubling up, but it's hard to tell with corridors punching through walls sometimes.  Anyhow.  Too much to do, not enough time to do it.

Happy weekend!