Saturday, December 07, 2013

Implementing BattleExecute and IAction questions

Recently I had a twitter question from  @TwitchGamez about the JRPG primer I wrote for GameDevTuts+. Here's the message:

Hi, I was wondering if I could ask you a question regarding your JRPG Primer? Namely, the BattleExecute state. Here's my implementation of it (along with BattleTick) in C#:

    public class BattleTick : FSMState {
            private StateMachine battleFSM;
            private List actions;
     
            public BattleTick(StateMachine battleFSM, List actions) {
                    this.battleFSM = battleFSM;
                    this.actions = actions;
            }
     
            public override void Enter(params object[] info) {
                    foreach (object o in info) {
                            BattleAction action = (BattleAction)o;
                            actions.Add(action);
                    }
            }
     
            public override void Update() {
                    BattleAction topAction = actions[0];
     
                    topAction.Update();
                    if (topAction.IsReady) {
                            actions.RemoveAt(0);
                            battleFSM.ChangeState(StateID.BattleExecute, topAction);
                    }
            }
    }
     
    public class BattleExecute : FSMState {
            private StateMachine battleFSM;
            private List actions;
     
            private BattleAction action;
     
            public BattleExecute(StateMachine battleFSM, List actions) {
                    this.battleFSM = battleFSM;
                    this.actions = actions;
            }
     
            public override void Enter(params object[] info) {
                    action = (BattleAction)info[0];
            }
     
            public override void Update() {
                    action.Update();
     
                    if (action.IsReady) battleFSM.ChangeState(StateID.BattleTick);
            }
     
            public override void Exit() {
                    if (action.unit.playerControlled) actions.Add(new PlayerDecide(action.unit));
                    else actions.Add(new AIDecide(action.unit));
            }
    }

My question is: how do you add new actions to the action queue from the PlayerDecide and AIDecide classes? In your code examples, you don't pass a reference to the queue to those classes. So, if, for example, AIDecide decided it wanted to attack, how would it tell BattleTick it wanted to add an AttackAction to the queue?

Hopefully this question isn't too confusing. Thanks.

Ok, it's been a while, so I've just looked at the code. I'll just reason through it, just like I'm reading it for the first time and we'll see where we get.

There's a state machine with two states; tick and execute. As the battle progresses the context flicks back and forth between these states controlling what happens.

To begin with, all the entities involved in the battle have a decide-action added to the queue.

The statemache is populated with a decide-action for every entity in the battle, with the player controlled characters requiring the player to decide. The game starts in the tick state, looking at the code, it calls Update on all the actions and then checks if the top action is ready. If it is, it changes state and passes the top action through to the execute state.

The code isn't provided for the execute state! But we can get some hints about it from the constructor in the parent battle state:

mBattleStates.Add("execute", new BattleExecute(mBattleStates, mActions));

Execute takes in all the BattleStates which is the statemachine running the combat and the list of actions. So if the action is an AIDecide it will have access to the mActions list via the execute state. If it's a PlayerDecide state, it will have access to the mActions list like the enemy and it can switch to a menu for the player to input choices by using mBattleStates.

The code isn't provided for IAction interface but I imagine it would be need a Run or Execute function that would take in the mActions list and probably the mBattleStates list too. Then any action is free to interact with either of those lists.

Hopefully this answers your question! Actions never directly tell BattleTick anything but along with BattleExecute, it will manipulate the action queue.

I remember the idea of having these two states is to accomodate something like Summon from Final Fantasy; an action that's going to take a long time to run. It uses the Execute state to block combat while all the animations and effects play out.

Saturday, September 14, 2013

Wednesday, August 07, 2013

JRPG Minigame - Dungeon Video


If you've checked out this blog before, you'll know I'm writing a book called "How To Make An RPG". About creating your very own FF6-like RPG from scratch, the book is divided up into 3 main parts

  1. Exploration - maps, characters, dialog, cutscenes
  2. Combat - stats, levels, monsters, the party
  3. Questing - saving, loading, plot and quests
Each part ends by taking you through a small mini-rpg example game. The video above shows the game at the end of the Exploration part of the book. It's still a little rough in places but should give a good idea of what you'll be able to do by the end of the first part of the book!

I'm currently working my way through the combat section now.

If this post has caught your interest and you'd like to be notified when the book is out, then sign up at the promo site here:

http://www.howtomakeanrpg.com/

Saturday, August 03, 2013

A pause

I went to the Develop conference in Brighton


The book hasn't been progressing as rapidly as usual, I suffered from some computer issues and my time is being taken up by contract work :(

To solve my computer problems I've bought a new laptop and I'm now ready to get back to writing the "How To Make An RPG" book. Time issues are going to persist but it's the weekend now, so I'm ready to get things moving!


Develop

Bigyama, the company I cofounded, took a trip down to Brighton to attend the Develop conference (there's only two of us, so the logistics are pretty easy!). This is a game developer conference where there's a lot of drinking and some talks. We attended the "Indie days" because they are significantly cheaper to attend.

If you're an Indie dev, or thinking about becoming one and you've never attended Develop, it's worth going down. If nothing else, you'll probably leave inspired and hungry to start on your next game.

My favourite talk was from Mike Bithell (creator of Thomas was Alone), which basically argued,
  1. All mid-sized game developers are moving away from PC and chasing mobile as it's the new hot.
  2. The PC market is massive and underserved
  3. With the rise of the internet the PC market is so massive and global there's almost certainly a group that will respond well to the game your truly want to make
  4. Go and do it
We also met Tom Francis (creator of Gunpoint) later at the Four Door Lemon party and had a drink which was cool. It's nice to meet the developers behind Indie games, if only to confirm they are actually humans and that therefore there's some outside chance that you can, at least in theory, successfully release your own game.

What I'll be working on next

Today I'll be finishing off all the example programs for the first part of the book about Exploration. Exploration deals with loading maps, exploring and interacting with them. It also deals with cutscenes at the moment but that may change in the editing phase!

Here's a sneak peek at the sewer ... I'm pretty sure RPG's are legally obligated to feature a sewer.


Sunday, July 07, 2013

Maps!

I'm writing a book about creating your own JRPG check out the promosite here: http://www.howtomakeanrpg.com/

I've finished the first draft of the first part of the book. The first part is about Exploration and ends with a small minigame that intends to deliver a sense of intrigue. I'm currently adding in the new art. I thought this would be a 1 day job max but I totally underestimated how involved changing the layout of the map is! There are 15 example programs in this section and they all need updating. Worse still I've just got the 13th example and realised I need to make a change to the map :( (the doorways aren't lined up to the 16x16 grid so my guard can't walk through the door!).

I'm also having some graphic's card issues, so no animated gifs or movies this time around but instead here are some screen shots:
This is the player's house, where he sleeps, unaware of what's about to happen!

This is the player a little later, trapped in jail, is there a way out?

NPC sprites here are still placeholder.

I'll be in Brighton the end of this week for the Develop conference. (just the Indie bits! ) but hopefully not too long after that I'll sort out my computer issues and start making faster progress on the book.

Edit: Computer troubles are still plaguing me but I've ordered a new laptop which should arrive the end of this month start of next. Things should start to pick up again then!


Wednesday, June 19, 2013

How to Make an RPG: Cutscenes and Gameplay

Hello!

A quick update on the book I'm writing about how make a FF6-like JPRG. It's going well, if not as fast as I'd initially hoped. I'm still working on the demo game at the end of the first part of the book "Exploration".

The demo, following the grand tradition of JRPGs, starts with a small cutscene which is now totally finished (but will be polished in the editing stages). I've had some initial art back and it looks great, hopefully I'll be getting more this week. I'm holding off sharing any images until the art's in there.

I'm now working on the actual game-play of the demo, setting up some triggers and scripts. (and noting down various changes I want to make to the codebase and writing I have so far). I'll probably hold off posting again until the demo is complete and I can share some images / video.

Edit: Nothing scuppers a good project like moving to a new city and taking on some new work! I finished the cutscene before I left. I've got pretty much all the art now and I've just finishing making up the tilesets. But I don't think I'm going to get any free time until this weekend, to actually put it all together. I've also spent some time musing over the combat chapter.

Friday, June 07, 2013

RPG Cutscenes

I'm at the end of the first part of my book "How to Make an RPG". Each part ends with a small game. This first game makes use of a little cutscene and it introduces a nice framework to make authoring cutscenes, a little easier than hard coding them. There's not that much to the game but I've got it storyboarded out, it's just a matter to implementing it / writing it up.

Because this is a "real" game now, I've using some nice fonts. As the text fades in the sound of rain also fades in and after these captions it's going to show a map. Hopefully by this time next week I'll have the art for the first map too, so that will be cool.

Wednesday, June 05, 2013

Back to the book

After some traveling around last week, I've now got sometime to get to the book. I'm not going to waste it!

I've also started looking around more intensely for 2d pixel artists. The first part of the book ends with a small game and I want nice art for it. Currently I'm using http://www.pixeljoint.com to compile a list of people who might be able to do it. If there are any other similar websites then I'd love to hear about them! I've also written a first art brief, so I'll start contacting people later today I think and hopefully get the ball rolling soon.

Tuesday, May 21, 2013

Brief Update

I'm back on to writing the book now after integrating some changes I made when developing the menu system. I'd like to be able to concentrate on writing the book full-time but I'm going to have some downtime both the end of this week and the whole of next week, frustrating but unavoidable!

Sunday, May 19, 2013

RPG Status Menu

The end of last week I was traveling but today I've progressed a little with the "How to Make an RPG book". I've finished all the menu modes, so tomorrow I'll return to writing text again which will be good!



Here's the status menu. The textbox for the commands isn't written in a nice way at the moment but it will be a long while before I actually reach this menu in the book and I'll rewrite it then.

(As well as the status menu, I also finished off the equip menu and rewrote a lot of the menu code to make it shorter and consistent.)

Tuesday, May 14, 2013

RPG Equipment Menu


I'm continuing writing my book "How to make an RPG" and I've been creating the equipment ingame menu.

I forgot how involved this menu is, I had to create player stats, weapon stats and write the comparison code. This screen still isn't finished, a little more layout needs to be done but functionally it's as far as I want to take it. The player can change 3 different item slots - weapon, armour and accessory and each item can alter the players stats. The other thing of note is the menus here are filtered by item type to.

The weapons only alter basic stats by integer amounts at the moment. It wouldn't be too hard to add "increases attack by 50%" but I'm not going to get into that. I'm already quite off track!



Monday, May 13, 2013

RPG Magic Menu

Menu systems in JRPG games have to convey an awful lot of information in quite a limited space, so I definitely have respect for what the designers of classic JRPGs were able to do. (Though I also think there's plenty of room for improvement! And that they have gradually improved with more modern games)

Anyway today I did not get a lot done. I'm writing the code for the menu screens and making them almost fully functional. I finished off the item menu and did the magic menu too.

Creating these menu's forces you to make decisions about the game, so in some cases I've made things up to fill out the menus. Will examples in the book have a fire spell? Probably, but it may not be called "Fire" and will there be a branch of magic called "Sword Magic" ... probably not :)

The magic menu is just going to allow browsing the spells and branches of magic available to each character. Tomorrow, if all goes well, I'll finish off the equipment screen and the item screen.


Thursday, May 09, 2013

JRPG Inventory

JRPG style inventory and menus
Recently for the "How to Make an RPG" book I've been coding up the inventory menu. In order to do this I've added a scrollbar widget, it's pretty functional, in the above screen you can see the size of the caret represents the amount of inventory being displayed at once. I've also created a new selection menu which can handle columns, display a subset of items and simple scrolling. It's easy to configure it's appearance from the number of columns to the spacing between elements.

I'm going to make the menu near to 100% functional, then get back to the writing.

All the art is placeholder - but the inventory icons are especially placeholder as I drew them, which is why the bag icon looks more like a spade or stingray.

If this post has caught your interest and you'd like to know more about the book I'm writing please check out the promo site here.

Wednesday, May 08, 2013

How to make an RPG: Making Menu Layout code suck a little less

As I'm writing more and more of the ingame menu code for my book "How To Make An RPG" I'm reminded of the Carl Sagan quote.
If you want to make an apple pie from scratch, you must first create the universe.

The menus for an RPG are absolutely integral to the game and they make use of a lot of game data. Want to display the party? Well you need a list of party members, each member needs an avatar and they need stats and levels and experience. Every part of the menu relies on a big chunk of the game already existing! But that's not a problem, I only need a small subsection of the menu for this part of the book and I can lock off the rest until we're ready for it.

RPG menus are commonly made of backing panels. These panels are a pain to position. I had some helper code but it wasn't clear and easy enough. Therefore I decided to create a special piece of code, just for handling these panel layouts which makes it far easier to build up the menu screens.

Here's my current menu:


This is somewhat hardcoded. I create the top title panel first offset from the top of the screen. Then I created the menu panel the length of the screen, then reduced it by the height of the time/gold panel. Finally I work out the position of the party panel offseting it from the menu panel. It's kind of a pain in the ass and even with my offset helper functions, there's a lot of manual calculation.

After I finished the above screen, I started on the item screen and quickly realised I needed an easier way to construct these menu and so I created a class called PanelLayout which starts with a panel that fills the entire screen.



I don't want the menu to take up the full screen, I want some nice padding around it. Therefore I contract the screen panel by calling PanelLayout:Contract("screen", 80, 40) , 80 pixels of padding on the horizontal and 40 on the vertical.

Next I want to make the title bar at the top, so I cut this panel into two pieces using the command SplitHorz("screen", "top", "bottom", 0.13, 4) which means split the screen panel into two panels called top and bottom. Do the split 13% from the top and have 4 pixels of spacing between these two child panels.
Then I do a vertical split to separate out the menu and party panels. SplitVert("bottom", "left", "party", 0.76, 4)

One final split, pl:SplitHorz("left", "menu", "gold", 0.7, 4),  for the gold box and we've got the desired layout, in around 4 lines of code. Far better than my initial attempt! 
I'm going to continue and flesh out the menu with the appropriate layouts for each screen and then add a little functionality where necessary.

If this post has caught your interest and you'd like to know more about the book I'm writing please check out the promo site here.



Tuesday, May 07, 2013

In Game Menus for RPGs

I'm going to be running ahead with the code again, a little this week, getting some of the menu stuff written out. Then I'll go back through it making it as simple as possible. The book won't create a full gui system as it would take up too much room, instead a lot of the positions and layout will be hard-coded (which, perhaps counter-intuitively, is a good thing, the layout code won't obscured by some opaque scene-graph, applying transforms to every element in a hierarchy, swarming with subtle bugs)


The above image shows a menu made up of panes, with the character panes heavily inspired by Final Fantasy 7. The same character is just displayed 3 times with a increased Y position. The MP, MP & XP bar are all working, the progress bar element is also something that was created in the previous chapter. The area under the Next Level will probably be used for status effects, but  I don't have any the moment (when I do this could be a good place to get some placeholder art http://game-icons.net/)

I want to add a GOLD/TIME piece of hud into the screen shot above. Then I want to start fleshing out some of the submenus.  

The problem with UI stuff is whatever you do, there tends to be a lot of code / data! But I'm going to try and keep it to a minimum.

If this post has caught your interest and you'd like to know more about the book I'm writing please check out the promo site here.

Saturday, May 04, 2013

How To Build An RPG: A narrative diversion

I'm writing my next book "How to Make an RPG" and I'm slowly coming to the end of the first part.

Recently I've been adding in a little of the game framework using a 'state stack'. The architecture is quite simple but suprisngly powerful. I want to demonstrate how powerful it is, so there's a small section in the book that creates the scene shown below.

A basic "game start" type narrative. All graphics are placeholder.

The image above demonstrates the use of the textboxes on the statestack and a simple fade state. The rest of this chapter will be about creating the in-game menu.

As always I'll be keeping this blog up to date with my progress and if you want to be notified when the book is coming out please visit the promo site below:


Friday, May 03, 2013

RPG Stack of States

I'm continuing writing my "How To Make An RPG" book.

Recently I went back through the GUI textbox code and text and changed it because I decided I could make it simpler and more straightforward. It took a while but was worth doing. Then even more recently I've moved off the GUI chapter and into the next chapter that lays down a little of the game framework and basic in-game menu. Once I've done this chapter, I'll be making a small game to finish this part of the book. After that it's combat.

Demonstrate a state stack, the textbox state and map-exploration-state
I've finally got to the stage where I'm combing GUI elements and the map code from previous chapters, so that's awesome! Each example gets closer and closer to resembling a full a game.

If this post has caught your interest and you'd like to know more about the book I'm writing please check out the promo site here. Learn how to write a JRPG style game such as Final Fantasy 6.

Tuesday, April 30, 2013

RPG Textboxes with "chunking" and options menus


Work continues on the "How to Make an RPG" book. I've added textbox code that will take an arbitrarily sized piece of text and break it down into multiple textbox sized pieces. I'm calling this process "chunking" for want of a better term. You can see an example below.


It's important that this is done automatically because typing out dialog should be as free and frictionless as possible, you shoudn't have to worry if it will all fit in a certain sized box.

The text doesn't appear like a type writer which is common to a lot of RPG games. I think I am going to add this effect, I'm just getting to be a little sick of textboxes currently, so I'm moving on :D

I've also added selection menus to text boxes,  now your hero can be presented with difficult decisions!

The selection can be added to a fixed sized textbox


Or a textbox fitted around the dimension of the text and menu


The font I'm using is the engine's debug font which happens to be monospace and a little pixely. These boxes work with any truetype font. For future updates I might switch to something a little nicer.

I'm looking to move on to and finish ProgressBars today (those pieces of UI used to show progress towards a next level, or current amount of HP/MP). Then I'll be wrapping up the UI widgets for now. I think I'll be moving on to a basic player / inventory menu system, then a small game to end this section of the book.

If this post has caught your interest and you'd like to know more about the book I'm writing please check out the promo site here. Learn how to write a JRPG style game such as Final Fantasy 6.

Edit: ProgressBars

Friday, April 26, 2013

Hosting Issues [Resolved]

I'm afraid my hosting provider, Linode, is having issues at the moment and so www.howtomakeanrpg.com is down! Hopefully everything will be sorted soon and I'll get it back online. I'll let you know when it's back up, if you're trying to get to it then thanks for you patience.

Edit - it should now be back online!

RPG Textboxes (again)

I'm continuing on with my next book "How to Make a JRPG" it's going well, as I mentioned in the last blog post I'd run ahead with the GUI code a little and the last two days I've been catching up with the text. Unfortunately this means I don't have any interesting screenshots today :( There's still quite a bit of work to do until I'm ready to finally move out of the GUI stuff. I feel like I've spent too long on it but it's definitely to the benefit of the code!



If you want a little taster of what's to come in the full book then please check out the article I wrote for gamedev.tutsplus.com called How to Build a JRPG a Primer for Game Developers where I take a look at a few of the systems that make up a JRPG. (Though the book is far more specific and you get real working code :D )






Also it's Ludum Dare this weekend, a global game jam where you're challenged to make a game in 48 hours. It's a great way to actually get something done and get some experience finishing a game. If it that sounds tempting then I strongly encourage you to give it a go!

If you want to be notified when my RPG book is released then please sign up here.

Wednesday, April 24, 2013

More RPG GUI

Continuing on with the code for my next book "How To Make An RPG", I am still messing with the GUI I'm afraid :D

GUI can be hard and complicated but I don't want to get crazy deep into it in the book; I want it simple and easy to use. For that reason, I've gone back to the start and rewritten it all so it's simpler. I'm now satisfied it's simple enough!

One of the things a good RPG engine should automatically do, is take a long piece of text and split it up into multiple dialog boxes, with a little arrow to notify you that there's more text. Like so:


Here's a text box that automatically splits up the text into two boxes, if you hit the ACCEPT button (or whatever)  it proceeds to the second box, press it a third time and the box is dismissed.

The little notification arrow I may tweak as it's very small. Ideally instead of an arrow I'd have a little image of the button you should press but that's getting off-focus a bit. More GUI to come in the next few days, choice boxes, progress bars and menus, all should be done by the end of the week.

Also it's Ludum Dare this weekend! You should take part! I'm going to be giving it a go, though I haven't done any voting for the theme yet.

As always, if this stuff is interesting and you want to make your own RPG then there's a promo site here where you can sign up "How To Make An RPG" book and be notified when it gets released.

Friday, April 19, 2013

RPG Textboxes for dialog

Last update of the week for progress on my "How To Write an RPG" book. I usually write the book and code simultaneously following a plan but for the GUI I've been running ahead on the code a bit. I want to make sure the initial code for GUI holds up well even when things get more advanced.

I've added in some tweens for presenting the textboxes, they scale the box and text but could just as easily also change the alpha. There's a stack that the dialogs are pushed on so there can multiple dialogs on screen at once.


Currently there are two type of dialog, a fitted dialog which fits around the words and an avatar dialog which is the same as the fitted dialog but allows you to add an avatar picture (you'll also be able to add a title / name but I've not quite got there yet). Then I need to add in support for a hard width limit and finally dialogs that breakup a lot of text into several boxes. Then that will be the textboxes done with and on to the other UI elements.I've got work I need to do this weekend but I'll be back on the book sometime on Monday.

If you're interested in writing your own jRPG then please check out my book's How To Make an RPG promo site here.


Thursday, April 18, 2013

Textboxes With Gradients

A textbox with a gradient. Scaled 2x
Hello, another update on how my progress is going with writing "How To Make Your RPG". 

Recently I've not pushed on with the book because I've been writing an article for another site to help promote it and also some work related stuff (which is going to continue to hold me up for the next few weeks :(). But writing should continue to move along nicely from next week.

Originally I wasn't going to have fancy gradient textboxes in the RPG book as I was worried it would be too much of a complicated diversion but then I thought of a simpler way of making it happen. I quickly added them this in afternoon.

The next GUI improvements will be getting automatic dialog boxes working and easy to create content for.

As I mention nearly every post, I'm writing a book about how to create a SNES era jRPG from the ground up. If that sounds like it might be your cup of tea then please check out the promo page and sign-up to be notified when it's released.




Wednesday, April 10, 2013

5 Tips for Marketing your Game and Talking to the Game Press

I'm writing a new programming book about creating SNES-style JRPG games and I'd like to self-publish; so recently I've become very interested in marketing, especially marketing related to the games industry.

Luckily there are some excellent resources out there. I've been listening to some of the talks from Launchconf a conference in Birmingham in the UK that tries to bring games journalists, PR people and game developers together to talk about this very topic! I thought I'd share some of the tips I picked up. There are definitely some actions here I've added to my to-do list.

1. Have a story



"A new match 3-puzzler coming out isn't really a story but a new match 3-puzzler from someone with an interesting background is"
- Keith Stewart, @keefstuart, Guardian Game Correspondent



"A lot of developers think it's the game that will interest journalists but often it's the developer that will interest journalists"
- Keith Andrew, @tweeting_keith, Editor at http://PocketGamer.biz

It's not just your game that's the story - it's you! How are you different, what's the story of how you came to the point of developing this game? Did you use to work for big studio like Rockstar on GTA and get tired of their endless grueling crunch? Was the game funded in an unusual way, is it targeting an odd market, did you overcome some kind adversity? An article needs some kind of hook to draw the reader in and make it stand out compared to all the other games.

The more concrete details you can give, the easier for the journalist to build up an interesting story for an article. For example "our game was influence by loads of films we saw and loads of books we read" is bad, "our game is influenced by 'The Shining' and Disney's 'Mulan'" is good.

2. Form a relationship with journalists


If a journalist knows you they're more likely to hear about what you're doing and more likely to write about it.  So how do you meet journalists?

Journalists, from what I've seen, spend a lot of time on twitter and this is a great place to "meet" them. Follow every journalist you can and join in the conversation, pitch in and demonstrate you know what you're talking about. A good twitter avatar can also help here (I think mine is pretty terrible by these metrics!).

Be useful to journalists, if you're a game developer it's likely you have some expertise that most journalist's don't. Be willing to help them out, it's common to see requests on twitter asking for people with expert knowledge of a particular topic or experience, so if you can help then do so!

Of course real life is even better than twitter, so going to conferences is good, inviting journalists to your events is good (Even if you're just a small indie and you have a board-game night - invite some journalists to join in. This was mention by Will Freeman as a way he's met developers.)

Final tip for this section: build up a relationship with a journalist before you need them, don't cynically try and build a relationship just to get something out it. A good relationship should be the priority not just the potential benefit to you.

3. Be opinionated



"As an Indie, within reason, you can pretty much say whatever you want."
- Keith Andrew, @tweeting_keith, Editor at http://PocketGamer.biz




Ever notice that Peter Molyneux manages to get quite a lot of press? There's a reason for that; he has strong opinions and he's happy to say outrageous things as well as give intelligent thought provoking comments.

"It's you Americans. There's something about nipples you hate. If this were Germany, we'd be romping around naked on the stage here." 
Peter Molyneux @pmolyneux


You don't have to be Peter but if you understand why journalists like him and quote him then you're going to be better positioned to deal with the press, build up a profile and promote your products. He wasn't at launchconf I just wanted to give an example of one his quotable quotes.

4. Build a community


"If you're proud of what you do, get the message out there, however you can and you'll build a community"

- Colin Macdonald, @ScottishColin, Channel 4's Games Commissioner


Put the time in to go to events, if you can afford it, PAX, E3, GameCity etc gives you access to the press and the public. The world's connected now, the general gaming public you interact with will tweet, write blogposts and post to their Facebook wall. This ripple effect helps build your community.

Get twitter followers by providing early access to your game, let them join in the conversation and see the development process. If fans are into your game they'll rally round and help you market it. If you ever browsed the comments of a popular kickstarter you'll see this in action for example:

 Direhippo 4 days ago
I've been jumping on all the forums I know to continue to promote this game using the paypal link:
Send it out to everyone you can!

If you hold a community event you can reach out to journalists and ask them to join you. For an indie this could be as simple as a get together at a pub. The press meeting your fans is wonderful as they'll provide new positive perspectives on the game.

5. Be prepared


You should always be ready to show off your game or product, you should have a tablet that someone could play the game on, you should have screenshots and videos to hand. That way you'll never miss an opportunity to show the game off or get some press. You don't want a hold-up or friction when you're trying to get coverage.

Be prepared, just like these girl scouts.


Have assets and press packs easily available from your website. Every email to a journalist should contain your best screenshots (or I guess a link would be good too), don't assume they'll remember who you are or anything about the game you're developing (not because they're terrible callous people but because they're inundated with similar emails 100s of times a day. With so many different games it's hard to keep track of it all, however well meaning!)


Tuesday, April 09, 2013

RPG Textboxes

The "How To Make Your RPG" book is progressing quite nicely and I've just started the chapter on GUI. jRPG menus are about 80% textbox so that's the first element covered in this chapter. The below box, in the screenshot, is a standard resizable textbox made from 9 different pieces (4 corners, 4 side panels, 1 back panel). The side panels and backpanel are scaled according to the size of textbox required. The border decoration for these type of textboxes is determined by the texture. The code is simple and flexible.

A basic jRPG inspired textbox (Scaled 2x)

The next order of business is to build on the textbox and add support for dialog boxes. A dialog box allows a lengthy piece of dialog to be split into multiple textboxes with a prompt to advance between them. I'll also cover additional elements at this point like an avatar portrait and title for the person speaking. Then a few examples that show how versatile these boxes are and then moving on to other elements such as the ProgressBar.

GUI isn't the most exciting topic but it's quite essential for any large RPG and there's definitely an element of enjoyable craftsmanship in doing it well. The GUI section also has the benefit of being rather small, we build a toolbox of useful elements that are then used throughout the rest of the book.

Monday, April 08, 2013

Making a JRPG: NPC Swarms

Watch them walk!


My animated gifs are getting slightly better but they're still not great! This is another update of the "How To Make An RPG" book. I'm coming to the end of tile maps and finishing off NPCs (which I'd hoped to have done by yesterday). 

The NPCs here all have a basic AI-type controller so they move around at random. They'll never move on to the same square. I've turned off the triggers on the doors but otherwise they  can walk through the doors and be teleported just like the player (which brings up the issue of teleporting on to other characters, which I'm side stepping entirely in the book because it's not an issue that will come during a game. But the code is there if someone wants to implement a solution; stop the triggers working if they'll teleport to an occupied destination - or my preferred solution - the good old tele-frag, just gib them :D) 

NPCs with collision detection is finished. I've got to wrap up a little more on map saving / loading. At some point tomorrow I'll have made a start on the UI chapter and we'll have text boxes galore. 

As always if you want to know more about the book or be notified when it's released please check out the promo-site:

Sunday, April 07, 2013

How To Make An RPG: Goodbye Maps, Hello NPCs

A new NPC, all graphics at this point are still placeholder
I'm still plugging away on the first draft of my next book "How To Make An RPG", it's progressing pretty well. I'm still on the first Exploration section but after another week  or so I'll be on to the Combat section.

Currently I'm coming towards the end of the section on tilemaps and most recently I've covered triggers and events. If, in the above room, you walk on one of the doors you'll be teleported to other door. This in-map teleportation is a stepping stone to creating worlds built out of multiple smaller maps. With triggers and events the functionality of the maps is pretty much finished. I'm currently adding support for NPCs with some basic AI, there'll be a small section on loading and saving,  then we'll be on to GUI everyone's RPG-favorite the textbox :D

As always I'll be keeping this blog up to date with my progress and if you want to be notified when the book is coming out please visit the promo site below:

Thursday, April 04, 2013

How To Make An RPG: Decoration and Layers

I'm back in the UK and my jetlag is slowly fading so I'm able to press on with my new "How To Make An RPG" book.
Decorations!
A jRPG is made up of lots of different systems and the first systems covered in the book are to do with tilemaps. Just before my laptop died I had covered collision detection and was about to move on to layered tilemaps. 

Today I got on to layers and that's pretty much done now. The character can smoothly walk around this room, if he goes right to the bottom, he'll be hidden behind the wall, if walks up to the banners at the top he'll be rendered on top of them. Layers and decorative features are all in! This really allows for far more interesting maps, improves reuse of art assets (like the carpet and banners) and makes the game feel and look better.

Next I will be covering triggers on the map and actions that can occur in the world. The demonstration for this will be the character walking into one door and appearing out the other. 

Every single section of the book has associated example code. Just for getting the map rendered there are 21 separate example projects, each a small easily digestible stepping stone that leads you to a fully realized jRPG game. The character movement and layer code is currently at 10 examples and by the time the book is finished I'm sure there will a few hundred example programs.

If the book sounds interesting and want to learn more then please visit the mini-site over here and sign-up to the mailing list:



Monday, March 25, 2013

The halting problem

I've been having a lot of laptop issues and it's finally died for good. A lesson learnt about making sure I have access to the right equipment when travelling! Unfortunately this means no updates to the "How To Make an RPG book" until next month (not too long now). I'll still work on sections but in an offline pad.

Sunday, March 24, 2013

How To Make An RPG : Magarita Update

I thought I'd give a very brief update of the progress on the book today - blocking tiles went in, now the maps walls actually stop the character! Also I started on the section that will extend the map so it will have multiple layers. Then this section is pretty much done and I can move on to ... dialog boxes I think is next. No image from me today, so here's a modern jRPG screenshot of Penny Arcade's On the Rain Slick Precipe of Darkness, the type of game the book will allow you to make:



I also got latex, the book formatting tool I'm using, compiling the source to a pdf, there are loads of errors to fix but at least I've shown it's possible :D

I updated the "Thank You For Registering" page on the site, it now has some links to allow sharing via email, facebook or twitter. I don't how often these links will get used but it seems worth putting them there.

As always here's the link to the site: http://www.howtomakeanrpg.com

Tomorrow I won't be able to work on the book as I'm poking around Sanur and checking out the beach for the first time since I came to Bali! (It's quite far from where I'm staying).

Saturday, March 23, 2013

Make Your RPG: Animated Movement

Today I finally got on and completed animated movement. There's a gif here but for some reason it seems to be really slow. The video file I took is fine, so it's some gif black magic I'm unaware of, but imagine it running at nearly twice the speed, smoothly, and you've got a good idea of where the game is.

My poorly made gif of the character animation.
I think perhaps I'd have better results creating the gif file in Photoshop but my laptop can't handle photoshop for that kind of task.

As I've mentioned several times and irritatingly mention every post, I'm writing a new book about Making SNES era jRPG master pieces. It's takes you from no coding experience to a finish jRPG game and gives you the knowledge required to set off on your own projects. The mini-site can be viewed here:
http://www.howtomakeanrpg.com
Please visit, sign up and share it with anyone you think might be interested!

Ok, that's the plugging over! :D

The first section of the book is about exploration - moving around a map - so as you can see from the gif; it's coming along! There's no collision detection yet, maps only have a single layer and there are no map "events" but it's getting that feeling of potential. I think when you get this far in the book, you'll start to really believe you can make a SNES era RPG, which of course - you can!

Games like Final Fantasy 6 were old games even when I was young, so they passed me by intially, the first jRPG I played was Final Fantasy 7! But the games before that, they were written by small teams of 5-10 guys (yeh all guys at this point in Game Industry history) and they wrote all the code in assembler, which is a fast but an awful way to write anything. Writing in assembler is like writing in invisible ink, you look at the code you've written and you can't understand it, you need to carefully trace through it again to see what's really happening. Which is why, outside the gameboy consoles, very little code is written in assembly these days.

The reality is, writing jRPGs with a modern language like Lua, makes you 10x to a 100x more productive than those guys could ever be on the SNES. Compilers have advanced too, so while you code won't be as fast as hand optimized assembler for the SNES it will be so fast for all modern computers you'll never have to worry about it, especially not with the way the code is presented in the book.

I'm hoping to totally finish the first draft of the exploration section before the end of this month, the next topics I'll be dealing with will be collision detection, layers and map events.

Friday, March 22, 2013

How To Make An RPG : Suckling Pig Update

2013 has been an interesting year so far, in January at Bigyama we were finishing our first Vita game, Quell memento, (out in April - check it out!) and by February we didn't have any more immediate work and we decided to take a break from for a while. By the February the 4th I was touching down in Denpasa, Bali and I'm still nearby in Ubud (though not for too much longer)!

I spent most of February playing tourist, which worked well out because on arrival in Bali, my laptop died and it took nearly a month to get it fixed! But I didn't just come for a holiday I also wanted to work on one of my programming projects. The project I decided to focus my efforts on is the "How To Make Your RPG" book and I think it's going pretty well so far, I've drafted out the contents and I'm slowly fleshing out the book. You can check out the book's website here (I'll be updating it early next month). I intend to self publish this book and I'll probably release a digital version first (pdf, epub and mobi) then later on a print copy.


My February and March office

This morning I took the long and somewhat dangerous walk into town, ate suckling pig and watched monkeys play around in the monkey forest. While I was walking around I decided I needed to return to parts of the book I've already written and rewrite them. This afternoon I've rewritten the camera code for looking around a 2d map for the third time which means I have to change all the  code examples after the camera is introduced and there are a lot!

So why would I do this and give myself so much extra work instead of getting on with the next part of the book?

>Was the code buggy?
No.

>Was it inefficient?
No.

I rewrote it because I didn't think it was simple enough; I want the readers of this book to be able to easily understand the code. I don't want the book to block their progress while they spend time figuring out exactly what the code's doing. Therefore I'm putting a lot of effort into making the code as simple and readable as possible. This might make my progress a little slower but I know the book will be better for it.

By the time I leave Bali at the end of this month I want a first section I can be proud of and that will really do justice to the reader.

If you want to be notified when the "How To Make An RPG" book is released you can sign-up to the mailing list here.

Thursday, March 21, 2013

RPG Maps and Navigation, How To Make Your RPG Book Update


I think my end of March target for the first draft of my "Make Your RPG" book was optimistic to say the least! I'm hoping instead to, at least, have finished the first section "Exploration". I'm breaking the book up into 3 main functional pieces "Exploring, Fighting and Questing".


The exploration chapter I'm writing now deals with loading up maps, efficiently rendering them, what makes a good map, character animation and so on. Each chapter ends with a small game and the exploration chapter will end with a prison escape game.

I've also commissioned some art for the book's mini-site which should make it look better and allow me to stop using Final Fantasy 6 placeholder art before I'm cease and desisted! Once I have the first draft finished I'll switch back to marketing for a bit and see if I can find more people who would be interested in the book. I'm open to all suggestions and assistance on how to let people who'd be interested in the book, know about it!

Tomorrow I'm going and looking at monkeys and eating roasted pig so my progress may slow (in fact I should be explicitly tracking my progress as I'm sure it would make more efficient).

Finally, if you haven't already done so please check out the site here and sign up to the newsletter.

Monday, March 18, 2013

How To Make an RPG - The Book!

I've started writing a new book about how to make old school SNES-style RPGs. After reading it you should be able to produce an RPG, and easily distribute it. The goal is to help people make this style of game, even if they're never programmed before.

An RPG very pretty but we can do better!

I've put the first version of my promo-page up this morning, to help gauge interest. Here it is (if you've already subscribed using the sidebar, this is the same list so don't worry). The images will definitely need changing to some less copyrighty :) The text is also likely to change.


I think I learned a lot from my first book and I intend to improve on it by quite a margin. My ultimate goal for this book is to have someone make a game that does well commercially, such as getting a Steam release. It would pretty easy after reading the book to produce a game like Cthulhu Saves the World, which has done well commercially and led to the authors making the Penny Arcade RPGs.

Let me know if there's anything particular you'd like to see covered!
This blog will probably have few RPG-centric posts as I try out ideas and flesh out parts for the book.

Friday, February 22, 2013

Photoshop for Game Programmers : The Slice

Starting a new project, like many programmers I like to grab some placeholder art so I can get some idea of what my final game might look like. I've been programming some 2d RPG games and wanted some path tiles to use for a test program. I found this image which fit my needs quite nicely

The source file - from which we will get our placeholder tiles.
This image above can be used to make paths through grass but at the moment it's all one image of 96 x 96 pixels. I want to divide it into 9 tiles of 32 x 32 each - 3 tiles per row and 3 tiles per column. This could be done be carefully selecting each 32 by 32 tile, copying it to a new photoshop document and saving it out - but that was is slow and error prone. So how to make thing more efficient? Enter the slice tool!

The slice tool is hidden under the crop tool, what you want is the "Slice Select Tool"
Select the "Slice Select Tool", a little 01 will appear on the image, press that and then press the "Divide" button on the control bar at the top of the screen. It will bring up a nice little ""Divide Slice" dialog box.

The divide slice dialog blocks lets you choose how to break up the source image

The "Divide Slice" dialog box lets you choose how many slices on the vertical and how many on the horizontal, since we know there are 3 x 3 tiles here, we can just choose 3 for both axis. Once that's done the source image will update in realtime and show the slices we've just asked for. Crisp perfectly deliminated tiles of 32 by 32 pixels.

The final step is saving out the tiles as separate images, I do this by choosing Save for Web and Devices.

Save for Web and Devices Dialog
Slices are Jpeg by default. If you want something other than Jpeg then drag and select all the slices and choose the output format you want. Then after choosing the format, press the save button and get this final dialog.

Save dialog with option for saving out all slices.
The big red arrow shows the option that allows all files to be saved out separately. Here we go:

All 9 tiles ... only the first is PNG because I didn't select *all* the slices in the Save for Web and Devices dialog - doh!

Wednesday, January 30, 2013

Kerning, Wrapping and Text Alignment

In my current project, I'm using the FTGL library for text rendering which does the job reasonably well, for Android I'm using a FTGL port called FTGLES (Ideally at some point I'd just like to be using just one of these.)

FTGL is very simple to get working but it doesn't support text alignment and text wrapping to the extent that I'd like. Therefore I've spent sometime modifying it a little and rewriting the central render loop (making it a little more efficient as a nice bonus too). Here's how everything looks now it's finished:

Horizontal Alignment

I want to be able to align my text to the left, right or center on the horizontal like so:


By default FTGL doesn't have support for right alignment. But it's pretty easy - just a case of getting the pixel width of the text and subtracting it from the x position. It's a little harder when text wrapping is involved.

Vertical Alignment


I want to be able to align my text top, bottom, center on the horizontal like so:



This is a little trickier because to do this well, you need to know where the baseline is (say if your were writing on lined paper, then the baseline would be one of those lines.) This wasn't easy to get out of FTGL so I worked around it.

The code supports any combination of horizontal and vertical alignments.

Consistent Baseline

If I render three pieces of text at the same Y position, I'd like it to appear as if each piece of text falls on the same baseline. Like so:

Text Wrapping

I want to be able to wrap paragraphs of text according to a maximum width. This text wrapping also needs to support the above alignment code. This picture uses a different font.


This shows only 3 of the possible wrapping alignment permutations but they're all supported. The text can also be scaled arbitrarily and everything still works fine.

I'm happy to stop working on this now. Though there are other features I could add: markup for colouring specific words in a text string, making FTGL go through my engine's pipeline like everything else, justified alignment, I suspect I've probably broken unicode support so testing that and fixing it would be good!

The hacked up code is available here: https://github.com/balaam/ftgl-align-hack