Tuesday, 15 June 2010

Tools in Python

There's been some time since my last update, so I've decided to write a new post to prove I am still alive and kicking.

However, the second post about Wall Chaos will have to wait a bit more, as I haven't finished writing it yet. Instead, I will show you some tools developed in Python that I have coded to assist me in the development of TINC (the first two scripts), and while I was playing Harvest Moon: Island of Happiness on my DS (the third one). The link to get the source code for the three of them is at the end of this post.

The reasons why I chose Python were that I wanted to get better at it, and mainly because it is a language I feel comfortable programming in. Besides, it is widely used in the games industry for tools or scripting, which is always a plus.
The first one is a simple level editor. If you remember TINC from previous episodes, it is just a clone of the Columns puzzle game. While I was designing test cases for it (yeah, I know...a bit over-engineered for a puzzle game) I got bored of editing text files by hand, so I came up with a GUI application. It may seem a little counter-intuitive at first sight, but it is quite easy to use in fact:
Select the checkboxes under the cell(s) you want to set and then pick a colour on the right combo box(you can choose "EMPTY" to clear the cells). The left-most checkboxes will toggle selection on a full row. Likewise, the top-most checkboxes will select/deselect full columns. Last, the checkbox at the top left corner will toggle selection on the full board.

I used wxPython as the library of choice for the graphical user interface. The main frame consists of two separate panels, the left one displaying the board and a grid of checkboxes to select cells, rows, columns or the entire board, and the second one displaying further functionality, such as colour selection, board clearing and exporting the board to a text file. 

Aside from the usual tasks related to GUI programming (layout, event binding, etc.), the most challenging part of the application, to name any, was the test for valid boards, since the program won't allow the user to export an invalid board.
A board is considered valid when there are no gaps left below a coloured block. For instance, the first screenshot corresponded to a valid state.

...whereas this one does not:
If an attempt is done to export the layout when the board in in an invalid state, the application will complain:
The validity check is quite straightforward. The board, initially assumed empty, is considered valid. After that, we'll start going through the columns as long as the current column is valid. To ensure that, the algorithm will start on the top-most row, and then it'll go down until the first coloured block has been found. If the column is empty, it'll be OK. If we find a coloured block, then every other block located in the rows below it must be coloured as well, otherwise the column, and therefore, the whole board, is considered to be invalid.
On the application, this check is performed when clicking on the "Export" button.
You may find the full code  under the "editor" subdirectory in the linked archive at the end of the post.
The second script that I coded while developing TINC is a bit more complex despite the fact that it does not come with a fancy user interface, as it is a command line tool.
You may find the full code  under the "editor" subdirectory in the linked archive at the end of the post.
Sometimes, when you're using enums in C++ (and other languages) you may need a text translation of the value. For instance, when logging messages, a string is more human-friendly than the enum's integer value, hence the need for this script (again, I didn't feel like browsing through all the enums and then writing the string arrays by hand, so I did some coding to automate the process).
It parses a specific header file where I keep type redefinitions, constants and others, searching for enumerated type definitions. Then, it creates a second header file, now containing several arrays of strings (one array for each enumerated type), and a set of matching inline functions, to translate a value of a certain enum to its matching string value. This screenshot depicts on the left side the source file, and on the right a portion of the generated translations file:



The script source code is now a bit more complex, specially on the parser side, relying on regular expressions to find enum declarations and such. The code relies on two classes: Context, which is actually the class in charge for parsing the source header file, and Generator, responsible for creating the enum translations header file.
Check the code under "enum_names.py".

My last tool is actually a lookup application I did to avoid checking the WWW when I was playing Harvest Moon: Island of Happiness, a game by Natsume and Marvelous for the DS. 
In case you don't know the HM series, these games put you in the place of a boy (or girl, depending on the game: the most recent instalments let you choose) that accepts a position as a farmer on a certain town. You'll get to develop the farm by growing crops, tending cattle, chopping trees, mining, fishing, cooking and flirting among several other tasks (if you've ever played Facebook's Farmville, it is a bit similar, but WAY MORE complex and a lot funnier).
It turns out that there are lots of recipes you can make by using several ingredients: the crops you've grown, the fish you've caught, and many others. At some point during my play-through I decided to fill my 'discovered/delivered recipes' (you can get a grasp of your progression throughout the game by checking the list of delivered crops, animal raw materials, gems, recipes, etc.), and I needed some quick reference about the ingredients I might need. As I said before, I wasn't in the mood for keeping an Opera tab constantly open to check every now and then, so I decided to develop a query application.
The GUI lists the set of recipes matching the criterion filter (you may search by the ingredient you need to deliver to unlock the recipe, or by one of the ingredients the recipe consists of), together with some additional information (name, description, stamina recovery, etcetera). The rows on the grid may be selected, and the text area below will display a list containing all the ingredients the recipe needs.
Again, I used Python and wxPython for the GUI. In addition, the application uses an sqlite embedded database where the recipes, ingredients and related data are stored. One of the python modules of the application contains the SQL code to create and fill the tables. I suggest using sqliteadmin, too, to manage the database. 
I intended to make the application multilingual, hence the initial language selection dialog, but it isn't functional, so at the moment Spanish is the only available language, sorry.
And, finally, here is the Dropbox link to the *.7z file containing the code for the three tools. Feel free to modify them at will. Credit will be nice, of course ;P
http://db.tt/YwdUywWD

Thursday, 15 April 2010

Wall Chaos (I)

Here is my second playable game, although due to the post's massive length, I've had to split it into two separate ones. The first one will introduce the game, and I'll go through its design choices, and on the second one I'll focus on coding details.

Wall Chaos is a game I did for a class assignment. They requested us to do a 2D game choosing among these three options:
- To make a 2D prototype of the game we'd chosen as the main project.
- To reuse and extend a 2D top-down tiled engine, a la Final Fantasy VI or the old Zelda games, to make an RTS or an RPG.
- To implement an isometric 2D game, the genre being free for us to choose.

The project was meant to be done in groups, but luckily we were also allowed to do it separately, which was what our group did, as we thought we'd have a bigger opportunity to learn from the experience (and I'll never be thankful enough for that decision, because I got the best mark in the class, mwahahhaha).

You can see Chuck Norris' mage twin in the middle of the picture, chased by mad
spiders

Although my favourite genres are precisely RPG and Strategy, I decided to make a game from the start (or almost), instead of reusing a basic engine, as I thought it would be more challenging and rewarding, and I could learn more.

I chose to do an isometric 2D 'shooter' game partially based on an idea I'd previously had for a 2.5D game. Although I wasn't considering the isometric map at all as a choice to implement the real deal, it just came naturally when I had to think of what kind of game to make. Still, I think a top-down view will suit it better, and when I put my mind seriously on it I'll do it that way.

This is the link to the binaries so you can download it. There is a short manual with the controls:
(Disclaimer: Music and sounds are obviously not mine; Credit for the sprites for the mage and the spider goes to Reiner's Tilesets. I did the walls, tiles and the health item sprite, as well as the HUD...the other graphics, well, I guess everybody knows them)

Here's the concept design:

Wall Chaos: The initial concept (Warning!! Wall of text ahead. To skip through the dirty details, read the TL;DR section instead)

Quick and dirty schematic 3D render, just so you can have an idea of how a level might be laid out. The green sphere would be the player, the red ones the enemies, and the small yellow one a projectile flying around the place.

Wall Chaos will be a 2.5D top-down action game taking place in rooms 'a la' Bomberman, focused in exciting, fast and challenging gameplay while at the same time allowing for some tactical possibilities.

Visually, the overall aesthetic look will be colourful and cartoony. Characters, enemies, etc., are therefore meant to be designed as super-deformed characters (References: Most 3D games for the DS, Dr Slump, Dragon Quest, MySims, ...).
The Legend of Zelda: Phantom Hourglass' visuals are also a great example of what I'd like to accomplish


Story: As the final test to complete your studies at a prestigious academy to be a wizard you're tasked to go to the remotest tower in the remotest corner of the kingdom and fetch your degree certificate, located in the highest floor of said tower. Instead of just answering a few questions,
you'll have to clear the game's many levels, each level matching a tower's floor. Some tips about the levels' layout, or the enemies that'll inhabit a level, may be given to you during cutscenes or loading screens.

Each room will be populated by several enemies you'll need to kill before time runs out. Of course, surviving is a must as well ;) To achieve that you'll cast attack spells with your magic wand, and invoke some powerful defensive magic to grant you some bonuses (such as a barrier deflecting enemy projectiles, increased defense or speed, elemental resistances, etcetera). By getting rid of certain enemies you may unlock new spells, and they'll drop items to help you through your quest, as the levels will get increasingly harder as you progress; you might get a better wand, a cloak of invisibility that might let you sneak past a column of enemies and such.

'But that sounds way too cliche and dull, and what's more, it seems way too easy and unchalleging. Where's the catch?,' you may be thinking.

Well, it turns out that the rooms are enchanted, and some walls will modify a magic projectile upon colliding. At its most basic, they'll simply rebound and decrease the projectile's life (for instance, initially the default spell may collide three times before fading out), but depending on the wall and spell type it may be imbued with additional effects (they may add up or not, allowing for some awesome combos in the first case).

As a result, the rebounds can be used strategically to defeat creatures located in unreachable places (for instance, in an island surrounded by lava), or to increase the spell's power. Stylish enemy deaths will be rewarded! (...and epic fails as well: there'll be something for everyone!)

However, a projectile will not differentiate between yourself (remember you're not a fully fledged wizard yet!) and your enemies, so the spells may hit you as well. You'll have to be careful!. Besides, there might be traps around a room.

WALLS:
- Common walls: The spell will just rebound keeping its properties, although its life time will decrease until it reaches zero. I'm considering to increase the damage they cause depending on the number of rebounds, so the last one before extinguishing will be the most powerful.
- Frozen walls: Depending on the type of spell that hits, the result may differ:
->A basic spell will turn into an ice spell, that may paralyse the first creature it finds on its way after colliding.
->A fire spell will revert to a basic spell.
->A lightning spell might turn into a combined IceStorm spell.
->...others
- Warp walls: If the spell hits that wall, it'll disappear to reappear through another warp wall located in the room.
- Fire walls:
-> A basic spell will turn into a fire spell: it can melt ice blocks or roast an enemy.
-> An ice spell will melt and extinguish.
- Piercing walls: It adds a spell a piercing ability: instead of dying out when hitting an enemy, it'll damage it and then pass past it.
- Etcetera

TYPES OF SPELLS. Some of them will be available as 'castable', and others will be made as a combination of several others, as the spell bumps against the enchanted walls.
- Basic spell: it just does damage.
- Piercing spell: it penetrates through enemies.
- Elemental spells: Fire, ice, lightning,...
- Sponge spell: it'll absorb any spell effect, adding them up no matter if they're even opposite ones (for instance, it might add the ice effect and then hit a fire wall without it getting destroyed: the resulting spell would cause ice AND fire damage)

After a while, you might end up with a Ultra-mega-super-powerful Spell of Doom, killing every creature at hand, only to find yourself dead as well because it hit a Warp Wall and then reappeared just behind you.
...and this would be the humiliating result


All of these rebound-based mechanics add an additional strategic component to the game, letting you cannon the projectiles around, as in the pool game. It also makes you keep your attention focused in both the enemies and your own attacks, or even a tricky, hostile environment. For instance, something 'funny' might happen to you after casting several spells without success or while staying still at the same place for a while...

Sadly, for this version (which is, basically, an initial prototype), I just had time to code one type of wall, one type of spell, two type of tiles (walkable and non-walkable) and a couple of items scattered around the levels (there were no enemy drops either). I didn't have enough time to implement some pathfinding, so the only kind of enemy moved around randomly like an idiot.

TL;DR Design in a few words, for the lazy ones.

Basically, you're put into a maze-like room where enemies roam freely: you must kill all of them before time runs out, hitting them with magic projectiles. The projectiles may rebound against walls, and you can use that fact to your advantage (although that might also lead you to certain death unless you're careful).



Tu sum it all up, despite the obvious limitations and flaws of this initial version I found the final result quite entertaining (okay, I may not be the most objective person to judge it), and I actually think that the complete idea has potential as a real, marketable game, so I'd like to implement the actual version. I was thinking of PC or DS as the platforms of choice, but it might work out on consoles (i.e, XBox Live, PSN network, etc) just as well.

Tuesday, 30 March 2010

Concept design: Würthel City

Given that compilation times on our final project for the masters are kind of high, I'm going to spend that idle time in-between doing something useful and write a new post.

(Yeah, I know I could use it as a legitimate excuse to slack off, as in XKCD's comic strip)

 


Well, going on-topic again:
At the end of yesterday's post I talked about a conceptual design we were asked to do by the U-Play Studios representative, which had come to give us a talk on starting up a video game developer studio. We were to think of ideas for a browser-based game.

To answer the question '...and what does a browser game look like?', there are lots of examples online, some of which you may have played already: Bitefight, Ogame, Ikariam, Striker Manager -done by the company that asked us to design the game, by the way-, and several more.

After a bit of brainstorming and casual chat with friends, I came up with 'Würthel City' (any similarity between the title/city name and certain massive corruption case in Spain being completely intentional). It allows players to put themselves in the shoes of a detective newly arrived to a metropolis where crime and corruption rates have skyrocketed.


Your goal as that detective is, of course, to become the best one out there. You'll be either competing or cooperating (via guilds detective agencies) with lots of other players to solve the highest number of cases.

To do that, you'll have to move around the areas of Würthel City, interact with NPCs and/or other human-controlled characters, and use your skills and equipment to make your way through the cases, which might range from robberies, drug trafficking, murders, corruption, kidnappings and such.






Click on this link for the English version of Würthel City's concept document.The PDF goes through these basic outlines in more detail. I apologise in advance for the crappy fake screenshots. I did some rough sketches at that moment to illustrate the concepts that I was trying to communicate, and didn't focus much in visual quality. I expect that they're descriptive enough, though.

PS: Würthel City, Spanish version

Monday, 29 March 2010

First attempts at design

So here we come again. I'm updating my stuff chronologically, and today it is time to post my first, lame attempts at game design, using an open source mind map tool called Freemind. I found it quite useful to sort out my thoughts.

This image shows the first one; it features some loose ideas about an evolution sim a bit influenced by Dwarf Fortress called Natsel. I began it hoping to create something more faithful to science than Spore turned out to be.



As you can see, I focused on how to create the world, the mechanisms throughout which the living beings would evolve and acquire new abilities, but I didn't get to develop the aspects more linked to gameplay.

Then I started thinking of THE MOTHER OF ALL RPGs, and started another mind map, this time a lot more exhaustive (but still incomplete). This one was one of the possible projects I proposed in the beginning of the master. Unfortunately, it wasn't appealing enough (besides being overly complex for the master's scope, I'd forgotten the mind map at home and had to write a dirty sketch with the concepts I managed to remember), but I'm still considering it as a future goal. I'll have to do an exhaustive go-through so I update it with some ideas that I've acquired recently while playing some other RPGs.

I'll probably talk more about this project in the future.


BEWARE!! Giant diagram.




On my following post I'll upload a conceptual design I did for an assignment which required us to devise a browser game. While the first thought that came to my mind was something related to those 'Choose your own adventure' books, set on the typical medieval-like fantasy world, I ended up switching to a detective sim after some chat with my flatmate.

PS: Here are the Spanish diagrams as well, although they're a bit outdated: While I was editing the English versions, I added a couple of notes and changes.


Natsel: Spanish version


RPG: Spanish version





PS2: In case Blogger decides to keep messing with the links to the images, here's the URL to the Imageshack album where I've uploaded the four diagrams

Thursday, 18 March 2010

TINC v0.1

This is my first game, coded at irregular intervals on my free time during 2008. To be honest, I'd already done one at the Computer Graphics subject while at university, but I lost the floppy disks where I kept the last copy -_-U
But that's enough talk about the past. Behold TINC!!
As you can see, it is totally not a shameless ripoff of Columns. Many people start by coding a Tetris clone, but being the spirit of contradiction that I am (well, that's what my parents like to say), I chose Columns instead.
It is coded in C++ using SDL, with some Boost to add some flavour here and there. Although I started coding it on Linux, in the end I switched to Windows and Code::Blocks, to finish with Visual Studio Express.
This means the game is for Windows systems only, I'm sorry (it might work on Wine, but I haven't tested it myself; if somebody is willing to give it a try, please tell me and I'll put it here as well).
Attached are the MU links to the binary files (most of the space it takes is caused by the VS2005 and VS2008 redistributable packages), and the source code. Since I haven't touched it again since last year, it is quite messy (not even mentioning the graphical interface, which I did in a rush and never got to refactor it again).
For those who never read README files, these are the in-game controls:
  • Arrow keys: move or drop the falling column.
  • Z/X: Rotate the pieces of the falling column up/down
  • P: Pause/Unpause the game
Oh, and if it crashes before starting the game, you may have to install the two VC redistributable packages I mentioned before.
Enjoy!

Wednesday, 17 March 2010

Hello, World!

Well, a week or so after I decided on a -bad- name for the blog, I think the time has come to finally open it to the public.

First of all, I guess I should introduce myself. My name is Tania (although I tend to use Ithil online, I find it prettier and geekier) and I'm a wanna-be game developer currently based in Spain. I have a degree in Computer Science and at the moment I'm studying a Master in Video Game Creation and Development at UPC's School of Professional and Executive Development in Barcelona.

My intention towards this blog is to use it as a tool for future world domination portfolio of sorts where I can share some ideas for games or even small projects I've developed either as a hobby or as part of assignments. In addition, you will also be able to find me rambling or ranting about videogames, the industry or programming.

As a gamer, I lean a bit towards RPGs, my current obsession being Bioware's Dragon Age: Origins. I also love strategy games (both turn-based and real-time) and several other genres, such as action games, adventures, platformers, puzzles, etcetera.

Let the show begin!