Saturday, May 3, 2014

Love me some procedural generation!

And there's nothing better than seeing this kind of thing in the wild.  Have a look at Mark Johnson's blog for some interesting tidbits on procedural generation.  I really like his graveyards post I saw today.

It's obviously been a while.  I've not done a whole lot coding-wise the past few months related to gaming.  I'd like to change that and get back into it!  So uh, blogging counts.  Sort of, right?  =)

Over the christmas break I was able to take 2 days and play around with SpriteKit some more.  I got a simple tech demo using physics and JSTileMap going.  It's a bit rough, but it may be helpful to someone out there.  You can have a look at the code here.



Happy gaming!

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.

Anyway.

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.

aigamedev.com

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.