Saturday, January 31, 2009

Building blocks (part 2)


Let's take a closer look at the new tiles I've created. Keeping with the idea that the center area of the tile should be simple and repeatable, once again I've marked this area with a square.


Rock:






Grass:






Very simple, and hopefully effective.

Progress report: Feb 1


One month in, and I'm still going. That's some kind of record for me. :)


I spent a lot of time trying out various art styles this week. My attempts at incorporating real photos failed, primarily because there was always a dominant artifact in each picture which ruined the effect when repeated over and over.


I've finally settled back into a simple cartoon style similar to the placeholder art I've been using until now.


The big news is that I've designed the lead character. Check him out, along with simple grass and rock tiles:






If the character looks familiar, here is why:












You don't need a single bone of artistic talent to trace. :)


I'm not sure what I'll do next week. I need to add a wall jump move, because I want to start designing levels soon and that requires knowing what the player can do. But I'm also really keen to implement NPCs, as I have some ideas to make conversations interesting and context-sensitive without requiring much work. Stay tuned.

Saturday, January 24, 2009

Progress report: Jan 25


I've totally disregarded the goals I outlined for this week. The good news is that I have made progress, and some of the things are pretty cool! Introducing:


XML loading



Pretty much everything is now loaded from XML files. 1 goal achieved. :)


Intelligent tile rendering based on adjacent tiles



No need to specify whether you're defining a top-left corner tile, a bottom tile, etc. The tile engine looks at all adjacent tiles and automatically determines which sprite to render, so I only have to deal with a handful of truly distinct tiles rather than 16 separate sprites for each.


In the absence of a level editor, this makes the grid definition easy to read and to change. Did somebody say ASCII art? Check out the sample definition below.


<TileTemplate
IsLeftSolid="false"
IsTopSolid="true"
IsRightSolid="false"
IsBottomSolid="false"
>
<Acceleration Horizontal="-0.25" />
<TileSize Width="40" Height="40" />
</TileTemplate>

<TileGrid IsActive="true">
<TileSize Width="40" Height="40" />
<GridSize Width="16" Height="9" />
<TileTemplates>
<TileTemplate
Path="Object/Tile/SolidTile"
GridSymbol="1"
/>
<TileTemplate
Path="Object/Tile/PlatformTile"
GridSymbol="-"
/>
<TileTemplate
Path="Object/Tile/WindLeftTile"
GridSymbol="("
/>
<TileTemplate
Path="Object/Tile/WindUpTile"
GridSymbol="^"
/>
</TileTemplates>
<Rows>
<Row Tiles="1111111111111111" />
<Row Tiles="1111000000001111" />
<Row Tiles="1100000110000011" />
<Row Tiles="110(((^110000011" />
<Row Tiles="1--(((^110011001" />
<Row Tiles="1(((((^110000001" />
<Row Tiles="100----110001111" />
<Row Tiles="1000000110000001" />
<Row Tiles="1111111111111111" />
</Rows>
</TileGrid>

Wind



If you were paying attention, you would have noticed that the tile template above includes an Acceleration tag. When a character's position is updated, acceleration from the tile at the center point of that character's position is also applied.


Terrain



In my last progress report, I toyed with the idea of modelling terrain using a very simple technique of enforcing a minimum and maximum height at each point in a level. It is now working, albeit with some limitations.


In order to be able to draw terrain that transitions smoothly from each point to the next, I decided that each terrain would have a fixed number of available increments to choose from, and each of these increments would have an associated sprite. This could mean having to create a lot of sprites, but I'm leaning towards each segment in the terrain being very small (~10 pixels), in which case I shouldn't need more than 10 sprites for every terrain. I'm also planning to use the effect sparingly, partly to limit the amount of art I need to create.


Sound effects



Making sound effects should be a crime. It is ridiculously fun!


Microsoft has a tool called XACT, that can be used for managing sound effects and music. It is the same tool they give to AAA game publishers for the Xbox 360. You don't have to use it, but it gives you a lot of flexibility.


The general approach is that I fire off an audio cue from my code, and the audio system responds with a sound or set of sounds. For example, if I was making a tennis game I might fire off a "HitBall" cue, and the audio system would play the sound of a ball hitting a racquet (and possibly also a grunt, if it was a womens' match).


Where it gets really cool is that you can provide multiple sounds for a single cue, and specify the probability of each sound playing. In testing my code, I had the main character saying "Jump!" whenever he jumped. But very rarely, he would instead yell out "I'm flying!!!". You probably had to be there.


Anyway, here is an example of how to hook in an audio cue to an animation:


<Sprite Name="JumpRight">
<SpriteAnimationFrames>
<SpriteAnimationFrame
Duration="0"
AudioCue="MainCharacterJump"
>
<TextureRegion
Left="0"
Top="50"
Width="50"
Height="50"
/>
<DisplayOffset
Width="-3"
Height="-2"
/>
</SpriteAnimationFrame>
</SpriteAnimationFrames>
</Sprite>


In my code, every sprite is also an animation, so I could create a singing, dancing tile if I wanted to. That might sound silly, but I am considering building a grass tile where the blades of grass slowly sway in the wind.



Here is a short video of some very basic terrain and wind effects:




Thursday, January 22, 2009

Hello world



Building blocks


I want to share a cool technique for quickly building tiles for 2d worlds. In particular, avoiding the need to design separate blocks for perimeter tiles. Take the following screen:






Although the effect is subtle here, notice that all walls carry a black border. To achieve this, tiles positioned at the top-left of a structure must look different from those at the bottom, etc. There are 16 combinations in all, and we want to avoid having to design them all individually.


Here is the single tile I used to achieve the screen above, magnified 4x:






The key is to make the tile a little bigger than it should be, in this case 40x40, and to position the black lines outside of this area. Here is the same tile with its 40x40 region shown with a square:






As long as the area inside the square can be tiled nicely, you can pretty much go for your life in the outside area, and then chop up the tile in various ways to create the 16 images you need. Here is how the tile would be chopped up for the top-left tile:






While this example is very simple, the concept is very useful. For example, in the next couple of weeks I'm going to create a tile containing a nice grass texture and with blades of grass protruding out of the top of the tile.


The only requirement is that the sprite engine you're using must support position offsets, otherwise the extra size will stuff up the screen position of the tile.

Sunday, January 18, 2009

Progress report: Jan 18


I'm bringing it... if you consider doing nothing to be bringing it, that is.


Aside from adding gravity, I toyed around with support for diagonal tiles, but ultimately shied away from it. I'm sticking with simple blocks, and instead I'm going to build a simple terrain system to complement it.


The idea is that every x position has a minimum and maximum height, and if a character's movement deviates beyond that they will be pushed back into play. This should allow me to model flowing, natural terrain very easily, and then use tile grids to model rigid structures like buildings. Despite some big constraints, the combination of these 2 simple concepts should allow me to build some interesting worlds very quickly.


I should have a fair bit of time this week, so hopefully you'll see some progress. My goals are:


  1. Load level data from XML

  2. Add wall jumping and ledge grabbing

  3. First attempt at some real art


By the way, if anyone knows some good free software for capturing screen video footage, please let me know. I'm sure that would be much more interesting than reading this rubbish. :)

Friday, January 9, 2009

Progress report: Jan 11


Not a lot to say, so I'll keep this brief.


I've brought over most of what is useful from past projects, and I am now up and running. I have a controllable character interacting with a tiled room. The graphics are placeholders from a previous project, and the controls are literally push up to move up, etc. Next I'll add gravity, then I'll start developing proper character movements as discussed in my previous post.


The quality of my art is one of the biggest risks of the project right now. I half expect people to take one look and dismiss the game on account of its appearance. I have an interesting idea to combat that, but I'll try it out first and then get your reaction, because if nothing else you'll have a good laugh and I don't won't to spoil it.


Next week is looking like being very busy, work-wise. I hope to post my first video by the end of the month, and you should see some screenshots before then.


Ciao for now.

Wednesday, January 7, 2009

The art of movement


Few games are good enough to be fun just running around and doing nothing. Grand Theft Auto is one such game, with thrilling pursuits that distract people completely from its story and objectives.


Super Mario 64 is another, because of its superior character control. Jumping, cartwheeling, somersaulting, diving, jumping off walls, skidding, sliding. You don't control Mario... you ARE Mario.


I'm increasingly clear that I want to invest in character movement, and attempt to capture some of that Super Mario charm in 2d. Jumping from wall to wall to traverse a vertical corridor. Rolling underneath obstacles and enemies. Diving through narrow gaps. Leaping onto and up walls.


Ideas?

Saturday, January 3, 2009

Command and conquer


I've never been very organized. I have a bunch of useful XNA code scattered throughout various projects, which for whatever reason I haven't moved forward. So while I work out what type of game to build, I've started consolidating some of my past work into a common assembly that can be used in all future games, starting with the current project.


One such item is a console window that allows commands to be issued and settings to be configured dynamically, to improve the efficiency of repetitive tasks in both development and testing. For example, refining gameplay parameters including gravity, acceleration and jump height, jumping to a specific level, or collecting items that would otherwise require hours of play time.


This is nothing new, but to give props where they are due, my work was inspired by a series of articles on efficient development. Check out part 1, part 2, part 3 and part 4.


And finally, here are a couple of screenshots of the console in action:









Now I just need to build something, then I can configure it. :)

Friday, January 2, 2009

Gameplay


For reasons of time and skillset, I'm planning to build a 2d game. And probably tile-based, for speedy level creation.


However, I don't know what style of gameplay to offer. The points of contention include:



  • Avoid enemies (e.g. Super Mario) or collect weapons and destroy enemies (e.g. Contra). My bias is sans weapons, because the sophistication and attack patterns of enemies required for a weapons-based game is much more, and I'm trying to minimize the work involved.



  • Individual levels (e.g. Bubble Bobble) or one giant world (C64 had heaps of these, e.g. Finders Keepers, but I can't think of many recent games that fit this mold). Although it means more work, I'm inclined to build one giant world, because the replay value is much greater.




What do you think?

It begins!


I consider myself to hold a lot of creative energy. I've started countless projects; movie scripts, video games, web sites, music albums, computer software, novels, and probably more.


And yet, aside from a few songs and one failed web site, I've never completed a project. Usually, once I've exhausted the creative aspects of the project, I think of a new idea that is more appealing and seems to hold more potential. Other times I just get bored.


That is why this blog was born. At the end of 2008, I asked myself what I wanted to achieve in 2009. Not a New Years resolution that would fade in a few weeks, but a goal to strive towards and to be proud of achieving.


In 2009, I resolve to design and build a video game, and to publish it to the Xbox Live Community Arcade!


I will communicate my progress through this blog, and I especially welcome your guidance and thoughts on various topics as the project progresses.


Before I leave, here are a few screenshots from previous video game projects that went astray:









It begins!