Sunday, July 28, 2013

Ghost Train RPG - Unity 01

Ghost Train RPG - Unity

First in a series of worklogs for creating a Unity RPG.

Scene 001 is going to be our starting scene.  We are in the middle of a small town on the rails.  Here is where we'll be introduced to the world, talk to some people, gain employment and buy some stuff.

Our city should look like a Victorian era city mixed with steampunk/futuristic elements.  Cobblestone streets, old brick buildings with lots of pipes, signs, and some futuristic generator looking stuff.

Start a new scene.
Game Object/Create Other/Plane
Change scale 1000,1,1000 (might shrink that later if it's too big)
Rename it to "Ground"
Under Assets, create new folder "Ghost"
Under Ghost folder, create new folders "materials" "textures" "scripts" "prefabs"
Found a good cobblestone/brick texture at Texturelib.com
Imported into Assets (under Textures)
In Materials folder, right click, Create/Material, named Cobblestone01
Drop texture into Material for diffuse (We'll add normal in a sec).
Project Hierarchy/Standard assets/Character Controllers
Drop "First person controller" onto your scene.
Delete the game object named "Main Camera"...you'll have one attached to your Character Controller

Now sometimes it's a bit difficult to find where you put something.  Do this:
On your plane named "Ground", change Transform to 0,0,0
On your Character controller, change Transform to 0,1.3,0 (you can also just put it at 0,0,0 and drag it up on the y axis.  The character controller has to be completely above the plane, but not much otherwise he'll fall through).

Now, when I test the game, I see that the plane is grey cause it is large and the material is not tiled.  I played around and found for my material that 2000x2000 tiling looks good (it's going to depend on your texture and the size of your plane).

Now, make the normal map for your texture.  Easy way is to take your diffuse texture and make a copy of it and import into Assets.  Then in the Import Inspector, choose Texture Type=normal map.
In cobblestone01 material, select Shader=bumped diffuse.  Drop your normal map onto the normal map texture.  I want to see the bumpiness, so I add: Game Object/Create Other/Directional Light.  Right now I don't care what direction it's pointing.

Test the scene and it's crazy bumpy!  Back to our normal map in the Inspector.  Change bumpiness to 0.05 and apply.  That's good for now.  I'll prolly go in later and change it a bit...there's improvement to be made.  But it's fine for now.

BTW, Save Often!  My Unity crashes a lot!

Saturday, June 15, 2013

Jinx Minecraft Tshirt contest design

Well, I created this design for the Jinx Minecraft contest, but it was not accepted.  I think it must have been the contrast was not great enough and would not have looked clear on a shirt.  I hope that was it cause I spent a ton of time on this and thought the idea was sound.



XNA off; Unity On (and how to successfully import a Blender model into Unity...)

XNA being a "dead" language now (or at least no longer supported), I've switched to Unity.  Big change, but I'm liking it so far.  Some of the Unity Engine makes programming so easy, while the rest is just as difficult as XNA was.  The graphics is extremely fun and easy.

So, my Ghost Train project will move to Unity and likely will be 3D, just because I'm having a blast relearning Blender and putting that together with Unity.  I'm a complete noob, so even though there are thousands of tutorials out there for Blender and Unity, I'm going to post notes and examples.  There are some very specific things you can do with these two programs that make the workflow so much easier.  Maybe I can save just one person a headache trying to figure this stuff out.

Currently, I'm using:

Blender 2.67
Unity 4.1.5f1
a very old version of Photoshop (6.0.1 ...no, not even CS...I've had this one for years and years and it's comfortable)

So, here are my steps to create a model in Blender and import into Unity successfully (lots of trial and error and forum scouring to get to this point!).

  1. Well, create the model.
    1. Base mesh, extrude, rotate, scale (more on this in another post).
    2. Knife tool to cut new faces when needed.  Mesh Tools/Add/Knife.  Drag from one area to another and then hit enter to finish cut.  Seems to work best between two established edges.
  2. For each object in the model, first make sure all normals are pointing out, otherwise parts will appear missing or transparent.
    1. Select object
    2. Put into edit mode (tab)
    3. On a 3d view window, type "n".  Brings up a set of info on the right side of the view.
    4. In Mesh Display/Normals, click the face button and set a size that makes sense.  If the normal is pointing out, you will see it radiating from the center of the face (blue line coming out).  If not, it's pointing in.  If it's pointing in, select the faces pointing and do:
      1. From the bottom menu do, Mesh/Normals/Flip Normals.  Repeat this for groups of faces until all are pointing out.

  1. Now UVW Map the object(s)
    1. Go to Edit mode.
    2. Use edge editing and select edges to cut.  Then choose Mesh/Edges/Mark Seam.  This is the cut for the UVW map.
    3. Repeat until you have broken the model down into parts that make sense.  
    4. Now, select all faces, type "u" and choose Unwrap.  If you have one view as UV/Image Editor, you should see the mapping.  
    5. Export that mapping by doing UVs/Export UV Layout
    6. Paint the texture using your favorite image editor.
  2. Apply the texture to the object (Select the object, in UV/Image Editor pick Image/Open Image).
  3. Save as a blend file.
  4. Put the blend file and the text map(s) into the Assets folder of your Unity project.  It will automatically import it (even at runtime).  
  5. This step saved me a lot of headaches:  Go to the import settings of the blend model in Unity, and choose to Calculate Normals.  This makes the model look like you created it in Blender instead of trying to smooth it out and making it look terrible (at least all mine have...even a simple cube).  To me, this is key...especially when doing wall segments that snap together...otherwise the light will break up on each piece making it look like each object is separate instead of one unified wall.  I do this on all models!

Wednesday, May 1, 2013

Ghost Trains - Librarian Concept

Concept art for Librarian.  I envision a wizened older character carrying a large book or scrolls.  When he moves, papers fall out of his book behind him.


Wednesday, April 17, 2013

Ghost Train - Coding in a dead language

So, I find out today that XNA is essentially a dead language.  Microsoft will not longer support it and offer new releases.  It will be considered officially dead on April 1, 2014.  That leaves me in a bit of a conundrum.  Do I continue on in XNA, having only just started to learn it and not too deep into coding my game that it would hurt to stop?

If I do stop, then what?  Unity?  I've tried it and I know it's powerful (I've played many great games made with Unity), it just doesn't feel like coding does in XNA.  I like to see the lines of code.  That's part of the draw for me.

Likely I will continue on with this project in XNA and then figure out what's next for the next project.  I feel like a modern scholar studying Latin.  There's not really any reason to except to do it...

Wednesday, April 10, 2013

Ghost Train - Menus and Gamestates

Of course I jumped right in and started programming the action part of the game, cause really I had to get that instant gratification of seeing graphics on a screen with some input.  Having a bit of that (still much, much more to go), I need to go back and define the menus and the rest of the game.

Here are the different states of the game:

0.  Main splash screen.  Just a picture with "hit spacebar to continue".
1. Main menu.
2. Hire hunters.  This is going to be like a  bar or employment line.  You can see your available slots and build a team off of that.
3. Purchase items.  Special equipment for the team.  Buy, then give to a character.
4. Overall map.  This is where you see all of the train lines and select the one to work.  Train lines open as you get better.  Other optional idea is that instead of a map, you get a job posting screen and you select one of a few open jobs.  Either way, this state is where you select a route to work.
5. Action state.  This is the main game on the traincars.

There are probably some sub states in there like a screen before #4 and #5 that just says press start when ready.  I can always add those in later as I identify them.

Here's where my lack of programming background comes into play.  I'm not exactly sure how to create new callouts for the gamestates, so I have implemented them directly into the "update" and "draw" processes.  This seems to work fine, though is probably not the most practical method, especially if the program was large.

Right now, gamestate 0 is the main opening menu and gamestate 1 is the action part of the game.

protected override void Update(GameTime gameTime)

        {
            if (Gamestate == 0)
            {
              //Updates here...keyboard input.
                {
                    Gamestate = 1;
                }
            }
         

            if (Gamestate == 1)
            {
              //Updates here...keyboard input.
            }
            base.Update(gameTime);
        }

       protected override void Draw(GameTime gameTime)
        {
            if (Gamestate == 0)
            {
                //Draw something here.  Main Menu
            }
         
            if (Gamestate == 1)
            {
               //Draw something here.              
            } //
          }

I also saw from Microsoft's gamestate sample the use of the region marker and I'm using that to break each gamestate up so I can quickly find it.  This marker allows you to collapse code to make it easier to find.  Kind of like a bookmark.

#region gamestate0 draw
...
#endregion

Neat!  Now I have a main menu and you press spacebar to enter the next state.  Exciting stuff!

Tuesday, April 9, 2013

Ghost Train - Controls

As this is a skill based game, I want the controls to be intuitive and quick to access.  The player should not be hunting around for keys on the keyboard, but should be able to keep their eyes focused on the screen.  Thus the keys have to be grouped and used in a manner that would allow for ease of play.

There are three control groups:

1. Character select.  This is number keys 1-5, to be accessed by the fingers of the left hand.
2. Action button.  This is the spacebar to be pressed by the thumb of the left hand.
3. Move button.  This is the arrow keys to be used by the right hand.


The flow of play would work like this:  Select a character, move that character into place, then hit the action button.  Select the next character...and repeat.  The position and facing of characters is important as the ghost will be moving and attacking and most actions have a small area of effect so characters will need to be close.

I'm focused on Windows development at this moment, but keeping Xbox in mind as well as I want to see this game on XBLA at some point.  I've considered controls for the Xbox controller and map the ideas above like this (though this would need to be tested out):



Monday, April 8, 2013

Ghost Train - Beginning XNA

So, I'm new to programming.  I've done tons of unix shell scripting and some javascript, but never really programmed with a real language.  It's going to be a huge learning curve, I realize.  I did some initial research on what to program in and have decided to use the XNA plugin for Microsoft Visual C#.  I was recommended to some really good beginner tutorials which I've spent some time following and playing around with the ideas in each to see what I can get from it.

I selected XNA because it seems tailored towards game programming and also it allows one to develop for Windows and XBox, both of which I'd like to support.

The tutorials I've been mainly using are at: http://rbwhitaker.wikidot.com/xna-tutorials which I highly recommend.  There are a few things assumed, but he does a great job at explaining the basics.  There were only a few times I had to look things up in other places to really get the gist of the exercise.

Using the tutorials, I've learned to:

1. Make a screen and change the size.  I'm standardizing on the normal xbox screen size for games.
2. Put graphics on the screen.  A background (which I eventually want to be scrolling giving the impression that the train is moving).
3. Use number keys to select one of five characters on the screen.  The character portrait lights up (blue halo) to show which character is active.
4. Use the number keys to move a sprite character around the train.  He can only move on the train and is restricted from going too far left or right (going off the train).  When the character is selected it only moves that character's sprite.


So, not much of a game yet, but I see it starting to shape up and Visual C#/XNA is fantastic to put you into the thick of it rather quickly and be able to see fast results.  If I couldn't see it yet, probably would have quit.

I'll talk more about the controls and about creating graphics soon.

Friday, April 5, 2013

Ghost Train - Types of Hunters

Jeb grabbed the Soul Hammer and held it close to his chest in fear.  Through the limited periphery of the gasmask, he could see the electric blue glow of one pissed off spirit.  Andrux was in front of the crew facing the ghost.  He carried a large Aether Shield and Jeb was glad he was behind it....

Ghost Hunters, Bulls of the Line, Spirit Miners, Enforcers...whatever we call them, they are the characters that a player has access to.  I want there to be at least nine types of character, each with variations so that your choice of up to five is somewhat difficult.  Do you take another DPS guy, or a Librarian?  Pick a tank or another trapper?

The type of ghosts will also effect which characters are most effective and it might take a few tries of different combinations to capture the ghost.

I'll use terminology from other games to explain the types of characters and what they do:

1. Tank or controller.  This character draws the attention of ghosts and redirects their attacks away from other characters.  If you had a ghost in the middle of a train car, you could move the tank to one side and have it draw the attacks and the rest of the chars on the other side draining the ghost.
2. Trapper.  Think of this guy like the Ghostbuster who has the trap.  He's there to catch the ghost when it is mostly drained.  It's a delicate balance.
3. Striker 1.  Damages ghosts with a weapon (Soul Hammer or Spirit Axe, something neat).  This one does fast damage, but small amounts.
4. Striker 2. Like the other striker, but very slow attacks dealing lots of damage.
5. Striker 3.  Area of effect damager.  Useful for multiple ghosts.
6. Sheild/Defender.  Kind of like a tank, but does a bit of damage for it's high armor.  Might just combine this with Tank.
7. Librarian.  Wears aetherial goggles and spots ghosts.  Maybe knows lore/weak points of ghosts.
8. Healer 1 - Heals a team member with lots of damage.
9. Healer 2 - AOE healer.

Each character only has one action/power.  This is a skill level thing where there is a chance at failure each try.

Characters have a few stats:
Class (as above, though want more atmospheric names)
Spirit - This is their health bar
Speed - How fast they move back and forth on the train

In addition, each power has a subset of stats like how much damage, how long it lasts, area of effect, chance to succeed.


Speed concept.  Going for a Victorian era, post-apocalyptic miner/engineer sort of vibe.

Ghost Train - Designing

What impresses me about games like Ridiculous Fishing and even Angry Birds is creating a fun, engaging experience with a few simple mechanics.  I want to keep the design for Ghost Train (this is just the working name, btw) simple but fun.

Here are the elements that I want to include:

  • A moving train.  Trains move from city to city on the map.  A train might have 3-7 passenger cars.
  • Ghosts.  A ghost is on the train and is sucking the souls out of passengers.  There are different types of ghosts, each with unique abilities.   
  • Ghost Hunters.  "Line Bulls" as John Harper describes them in Ghost Lines.  Players will have 2-5 of these hunters, each with their own specialty.
  • Hiring.  Hunters are hired (maybe from a bar or employment line).
  • Different train lines which get progressively more difficult.
  • Upgrade system/equipment buying.
The action part of the game, I envision as a relatively fast paced fight between the Hunters and the Ghosts.  This is kind of a twitch action, but I also want it to feel somewhat puzzle like.  This is something between a boss fight in World of Warcraft mixed with a rhythm game.  You are constantly selecting characters from your crew, positioning them and activating their power, then moving to the other.  You need all characters working in concert to capture the ghosts.

Narratively, I imagine the battle happening something like this:  The characters enter the train car.  It's full of passengers, but no ghost to be seen.  The librarian moves to each part of the car, putting on his goggles and scoping out looking for Aetherial matter.  He spots a ghost sucking the soul of an unwitting passenger.  The player moves the librarian out of harms way quickly and moves his damage guys in.  They start hammering away at the ghost with spirit hammers.  The ghost isn't just going to stand there and take that so he attacks the nearest hunter and starts draining his spirit.  The hunter's getting weaker and weaker, so the tank moves into position, attracting the attention (and wrath) of the ghost, leaving the damage guys alone.  The ghost is getting weaker and weaker.  Keep going and the thing will evaporate from existence...but you need to capture it to get the reward.  So, when it's weak, but not dead, you bring in your trapper, moving him into place and activating the spirit trap.  After a couple of tries, it sucks the ghost in just in time.  All the while the passengers keep sipping their tea unaware of the danger they were just in.

Sunday, March 31, 2013

Ghost Train - An Experiment

I've been wanting to program a game for some time now.  I love to play games, but there's always this moment where I wonder if I could have done it different or better.  Now it's time to test out that theory.  Like I said, I've wanted to do this for a long time, but the inspiration that kick started the process was two-fold:

1. Ridiculous Fishing for the ipad.  Such a silly idea that is absolutely brilliant.  I love everything about this game from the simple but engaging mechanics to the lovely pixel art.  If you haven't played this, you owe it to yourself to do so.

2. Ghost Lines, a very minimal RPG by John Harper.  It's a free 4 page pdf that is just dripping with ideas and setting.  I'm quite taken by John's layout skills and game design ideas and this is just another of his wonderful contributions to the tabletop gaming community.  Ghost Lines

So, I'm going to publicly design and implement a small computer game based on these two ideas.  Hope you enjoy the ride.

Toolwise, I'll be relying on the following to complete this game:

1. Moleskin notebook.  Ideas, sketches, design notes.  I'll take pictures of some of the pages and post them.
2. Inkscape.  Graphics.  I'm going with a 2d retro aesthetic for this game.
3. Microsoft Visual C# and XNA plugin.  I want this to be a Windows game and also would like to implement on the Xbox.   I'm learning programming from scratch, so I'm sure this will be amusing.