Tuesday 7 June 2016

Alone: A Finished Project

It has been almost a week since the digital fair, and now would seem like a good time to have a final update.
The digital fair was largely successful and plenty of people was able to see the project (though I must admit our station was not in the best location and our display not the most flashy.) Since the last update, a lot has changed: placeholders are taken down and actual images put up... too much to list actually, the game is essentially finished.
None of this would be possible, however, without the help of friends.
Now for a brief rundown of the technical stuff.
Scene transition: an integer variable that changes every time the player touches the right most side of the screen. The player is then promptly teleported back to the left and the background will change if needed while monsters change their active states.
Platforms: there is only a single platform in the game (what? bad level design? have I not stressed enough times that the most important part of the game is the poem?) and it never moves. Fairly simple to implement (interaction between player and the platform, however, took a lot longer).

Attacking: No screenshot for this one, you probably won't look at it anyway. It's fairly patched up and is implemented within the monster class for ease. Not the most rigorous way and hurtbox for the wolf is weird, but nonetheless worked.

Everything else is relatively simple, it just takes a while to place the images and music in the right places, all hard coding stuff.
The end result is something like this:


Currently, it is impossible to kill the final reaper. This is because the game strictly follows the story of the poem and in the end the character will die.

Enough of the boring stuff, let's move on to the actual digital fair itself!

We left the school to go to the fair at about one and arrived around 2. After setting up, we had some time to go explore Science World then proceed to eat pizza. Around 4 o'clock is when more people start showing up, and that's when the real show begins.

The handsome young man on the right is my partner Alim, the less handsome person on the left would be me.
It's Alim's first time looking at the finished game
The number of people who visited our station isn't too bad as our project wasn't too flashy. We only had a laptop, two speakers, and a projector. The projector, however, was pointed at a vending machine which faced the other way from where the visitors would come, and it was essentially useless. :(


Alright, that's a few pictures to give you an idea of what's going on. A few things that I learned/realized: younger audience members do not care much for the poem elements and rush through the game expecting this to be a full fledged game, often leading to some degree of disappointment. Older audience members instead have trouble avoiding the enemies while reading the poem, though they are able to understand that the poem and the atmosphere are the most important parts of this "game". On the poem side of things, I was able to find more meaning in this poem as I progressed in making the game. Some elements, whether intended or not, allowed me to have a different look at the poem. I started off thinking that this poem did not really have a theme, and my goal was to make the atmosphere as dark as possible. Towards the end, however, I was able to realize that the theme can be "no matter your actions, you will have to face death sooner or later." Of course, there are other ways to interpret the poem, such as making the best out of the worst (not dying on the way to the shed and fighting till the end), and it varies from person to person. I must say though making a game from this poem has allowed to me understand it a lot better.

In conclusion, combining poetry and gaming is an idea with great potential. While this project is relatively simple and experimental, I can envision full fledged games (not just some point and click choose your adventure thing) based on stories and poems. Given enough time, a whole genre of games may even be created whether it be for education or entertainment. We'll just have to wait and see.

These caution wet floor signs are made to look like bananas? Amazing.

Saturday 28 May 2016

Alone Update: Object Collision!

A small but very important addition has been made: The game now knows when you are getting absolutely wrecked by ghosts and wolves and you will lose health when touching an enemy.
Up next is the changing of scenes, maybe platforms, and then attacking. When that is finished, all that left will be to put in the graphics and hopefully sound!
A desperate koala tries to escape flowers and penguins.

Wednesday 25 May 2016

Alone: An English Project

Wow I haven't been using this blog much at all! I almost forgot about it. Logging on today, I realized that I have two nerding out drafts that I'll hopefully finish sometime before the end of the school year. Anyway, into the main points.

For an English project, I am tasked with creating a game based on a poem written by a classmate(apparently in less than 20 minutes, impressive huh?) This poem is called Alone and it looks something like this:

This game will be for a technology fair sometime soon, and I have all the reasons to make it really good. Some background information though I am only an amateur programmer with almost no experience in game making(For a French project I made a point and click game that feels like its stitched together, though it worked pretty well.)  After a bit of thinking, I have decided to make a platformer type game instead of perhaps a choose your adventure game that was first envisioned. The poem itself limits the game play quite a bit as I cannot find any part of the poem that can be made into a game. In the end what I had in mind was a game in which the player would walk across the screen and encounter several enemies along the way, perhaps some ghosts and wolves, fitting the mood. Trust me though, it looks REALLY good in my head. I used wpf on visual studio and experimented with Images and the Dispatcher timer, not too shabby actually.
Currently ~100 lines of code in the Mainwindow class
Now for the specifics.
Probably really messy declarations, just made all player related things static because there will only be one player. I am using a few of the Windows default images for place-holders, as you will soon see. The commented out portions of the code involving rect and prect represents the (more than likely failed) attempts at a lazy and non-math solution to object collision.
The timer tick event is triggered every 5 milliseconds (wow I thought I set it to 15 milliseconds) as seen in Mainwindow(). This essentially updates the locations of the Image objects every 5 milliseconds. In addition, this event will also check for user inputs, namely the A, D, and spacebar keys. I had the W and S keys to move the player vertically, and eventually commented them out once I implemented jumping. The jumping was actually quite tricky to do and took quite a while. Since no collision exists, I had to bound the player's Image within the canvas' borders. Since the movement isn't continuous and a high velocity would exceed the bottom edge, a lot of changes had to be made before the player was able to fall to a fake gravity while jumping.
Another part of the failed attempt
Quick! Sneak in a picture of the xaml file to look cool!
Hard to have a game without enemies, up next is the monster class(only ~80 lines, as I don't have to stuff everything in here).
Note the public variables, I was too lazy to make accessor and mutator methods.
Monsters follow a similar scheme, with their independent DispatcherTimers that tick every 15 milliseconds. While not entirely obvious from this picture alone, there are two types of monsters(for now, as I have yet to find anything else fitting for the poem): wolves and ghosts. Ghosts are pretty slow and will follow you in the 2D plane while wolves can only move at a fixed height, albeit with a faster speed. The idea is that the player will have a weapon (maybe a branch?) that allows him/her to fend off the monsters but still giving him/her the option of avoiding combat and just jumping over them.
Monsters in their most natural habitat
The result looks something like this:
The koala is a jumping player, the penguins a ghost, and the flowers a wolf.
As this is stationary, one probably can't tell that this thing works, but trust me it does.

The next step is collision. I had some experimentations with Rectangles and realized that they are not the same as Rects, so that was the failed attempt. As I browsed the internet for an elegant solution to collision, I saw a comment suggesting that wpf isn't a game maker. It is right. Wpf made games are probably going end up feeling like a lot of the problems are covered with a band-aid instead of solved. So, naturally, I turned my eyes to Unity. With about half an hour of playing around I was able to get gravity to be applied on one sprite while not on the other, perhaps I should be watching some tutorials.
Is all my wpf work going to waste?
So now it seems like wpf is a backup plan in case Unity fails. Moving forward I am waiting on some art from my friend. If you are an artist and would like to draw a few things, perhaps the background or the sprites (don't worry they'll be silhouettes, I can't ask too much of someone who is working out of the goodness of their hearts), please contact me by commenting down here somewhere. The background will just be a general dark blue and dark red sky with maybe a dark forest closer to the ground. Somewhat like the game Limbo. 

Anyway, this is a pretty long post and here is hoping that this project will end well. 

In Unity there is strength. 

(Start it at 1:14, embed not treating me well.)
Ironic isn't it? Alone is the name of the game.