Showing posts with label Computer games. Show all posts
Showing posts with label Computer games. Show all posts

Saturday, August 4, 2012

Hardcore Minecraft

We played multiplayer Minecraft again tonight, after many moons. This time we played in hardcore mode; no re-spawn. It played like the game I've always wanted Minecraft to be. Challenging, tense and satisfying. I definitely want to play more.

A majestic canyon

A field of sheep

Mana from Heaven

My companion's remains. The rock fell out from under him, into lava. He followed.
It was a disturbing, saddening and somewhat guilt-ridden experience.

Monday, July 23, 2012

The Walking Dead review

Fashionable zombie pop-culture bores me. I have a negative interest in anything to do with zombies. And yet... there is DayZ and now Telltale's latest adventure game series, The Walking Dead.

The Walking Dead is the only adventure game in the last fifteen years that simply must be played. Why?
  • The narrative and plot are compelling
  • The script is good
  • The characterisation is generally quite good
  • The puzzles are a balance between tricky, frustrating and satisfying
  • The art style is really good
  • The interface is one of the best I've seen in an adventure game
But importantly, it's because
  • It appears to have meaningful choices at almost every node of the dialog tree
  • What you need to do to survive is a great blend of disgust and grotesque fascination. (I think I've said "Oh my God!" more times playing The Walking Dead than any other game!)
Many dialog trees in the game have a timer on them. You often need to respond in moments. This is the most fantastic innovation in adventures games since the dialog tree was created. I doubt The Walking Dead was the first to use it, but it uses it extremely well. It's so tense. I was often locked in indecision. Occasionally, I simply couldn't decide, resulting in awkward silence. I love how not saying anything is an option! Of course, no matter what you say, it can't matter too much, yet it doesn't feel like that at the time. And that's the important thing.

Often events don't go the way I wanted or how I expected, but I just went with it. It's part of the story and it all seems meaningful. Only once have I re-started a section because of the way things turned out. This is great in two ways; 1) even though things don't necessarily go the way you wanted, it's not necessarily bad enough to force you to rewind and 2) I care enough about some events that I simply can't allow the game to continue after an event that was simply too wrong for me to be happy with. That might sound contradictory, but isn't.

The reason why DayZ and The Walking Dead are such good zombie games is because they're not really zombie games. DayZ is about the other people you play with, whether other survivors or bandits that hunt you. The Walking Dead is all about the other characters in the game. The zombies are there in a way that function almost as a relief. Zombies are simple. All you have to do is kill them (again). It's everyone else you have to be worried about. (But that would make a great twist, if zombies weren't exactly as we assume. If they transitioned from a Nazi SS officer to an Itialian fascist infantryman, then you'd have a whole new depth of narrative to explore.)

Episodal format? Seems like a dodgy way to get people to pay for a game that isn't finished. Episodal gaming is a bit of a relic in the era of kickstarter. It's proto-kickstarter, where some of the risks are put onto the consumer rather than all. In effect, I don't mind at all. In fact, I think I prefer it. I don't have the desire or time to sit down and play a game for hour on end. This way I can play it in chunks over a period of months. At episode two of six, I feel like I've gotten all I thought I would get from this game and I'm not even halfway. If quality drops by the end of the season, I don't think it matters. It's already been a whole lot better than many games I've played recently (looking at you Diablo 3).

This is the first game in years that I want everyone to play. I'm not just talking about my friends that don't play games anymore now that they've "grown up." I mean, my mum. She should play it. Sure, it's horrific, but it's done so horrifically well.

Tuesday, May 22, 2012

DayZ update

It looks like the developer of DayZ is doing all the right things. Latest update notes:

* This is a pretty major update. I don't really know what affect the new sickness and temperature system will have on player behavior especially with antibiotics being so scarce.
* It is the genesis of an idea, so please remember this might cause havoc. You need to be careful.
* To light a fire, you need matches and wood in your inventory. Place more wood in the inventory of a fireplace to keep the fire going.
* A fire that does not have wood in it will go out when you try to light it.
* You can tell you have an infection, because your character will start coughing. The infection causes you to loose blood down to a minimum of 6000. This leaves you with reduced blood until you take antibiotics.



Here you can clearly see the beginnings of a Minecraft like play. If done right - without the missteps that Minecraft took - could be really good.

Monday, May 21, 2012

DayZ, day 2

Totally different experience today. It was daylight. I found a survivor in a few minutes. We worked together to kill zombies and grab loot off dead survivors. (We didn't kill them!)

After taking-down about seven zombies, I ran out of ammo and had to seek safety on top of a pipe, after climbing a ladder. I lost contact with my buddy. I heard shooting and looked up. Off in the distance, there he was again, taking-down zombies from the top of a tower. They went for him, climbing up the tower. Everything went quiet for a couple of minutes. I couldn't move, still too many zombies to try to risk a run for it. But then my new found friend was back again, in a different spot, drawing the zombies away from me. "Run for it!" he cried.

Why did he care? I was useless. Injured, unarmed, stranded in the middle of a zombie ocean. Yet he helped me anyway.

I ran. I got to a higher place. I was safe for now. I read on the server messages that Cal was dead. I was dismayed. How could I have lasted longer than he did? He had all the gear and the knowledge. I was alone again.

A few minutes later I dropped from a platform. My legs were broken. The zombies feasted on my entrails.

Pictures:

Partner in zombie killing

Site-seeing

The zombies

Safe-zone

Zombies climbing

Death

Sunday, May 20, 2012

DayZ

To play DayZ I had to buy Arma 2. After, I followed the installation video-guide on the DayZ download page without a hitch. For mod of a game still in alpha, it was easy to setup.

I started-up DayZ, joined a US server (the Aus and NZ servers were full) and was ready to go.



It was night time. Real night time. No moon. I could hear the waves crashing on the beach and see stars in the sky. I heard ominous music. That was it. It looked like this:


Hmm... What was I to do? I tried waiting for daytime (that's what you do in Minecraft.) It didn't work. After about a minute it was as dark as ever.

I looked in the menu options to find the key to turn-on my torch. There didn't seem to be a key for that. I looked in my kit. I had ten flares. I threw one. I went from no light to so much light that I was clearly a sitting duck. Having read about zombies and bandits, I was concerned. I tried pressing all the keys on the keyboard to find the key that would turn-on my torch. I didn't find the key for "torch." Hmm... That's unusual.

I picked up the flare. I dropped the flare. I picked up the flare. Was I suppose to walk around with a flare in my hand like a complete chump? There didn't seem to be any other option. I couldn't see a thing without a flare.

Off I went, knowing full well that I'd be dead in about thirty seconds time. I crossed a railway line. I found  a derelict building. See Exhibit B, Derelict Building:


I dropped the flare and went inside the house so I could find a bunch of great stuff I could use. Like a torch. The building was empty. The flare went out.

I threw a flare and picked it up to carry with me. I walked away from the building. The terrain changed from flat to a hill slope. I walked up the hill. The flare went out. "Okay," I thought. "I can deal with this. I'll just walk in the dark. I'll be fine."

I walked in the dark. I saw a building. It was the same building as Exhibit B. Unknowingly, I had double-backed on myself.

Perplexion set in. I couldn't walk in the dark. I didn't want to walk with a flare. What was I to do?

I stumbled back to the railway-line. See Exhibit C, Railway-line:


"Okay," I thought. "I'll walk along the railway line." At least I could still see that in the pitch black. After about a minute, I saw a flare! (It wasn't mine!)

I ran to the other flare. I was really excited. I had been wandering around for about 20 minutes with basically nothing happening. Finally, there were people! I was going to say "hello." Sure, they might kill me, but at least I wouldn't die alone.

I was so close. Then I heard a horrible sound. Oh my God, zombies! It was freaking scary. I didn't know where they were but I knew they were close. I fumbled for my pistol. This was going to be nasty. A zombie charged up on me. I fired away. It went down. Then another came up. I missed and it swiped at me. A few more shots though and it went down and all went quiet.

I decided to crouch-down and move slowly towards the flare. That way no-one would hear me. I'd be like a ninja. After all, there might have been more zombies out there and I was still a long way from the flare. I needed to be careful, the second zombie was almost the death of me.

But crouching is slow. After a minute I still felt like I was a million miles away. I decided to make a dash for it. Surely those two zombies were the last. And if not, I could make it to the light before they caught me. I would be like a cheetah.

I was not like a cheetah. I was a wounded and imprudent sucker. Two more zombies heard me and came for me. This time I was too slow. They knocked me prone and started to feast on my entrails. But it wasn't the zombies that really killed me. What really killed me was my impatience and a fool's hope.




My first play of DayZ was confusing, short and ultimately tragic. The only goal I'd had - to reach the flare - was never realised. But I'll be back and I'll have a torch.

2012, the year of the computer game

There are a few good computer games that have come out over the last year, with a bunch more to come. My favourites so far are:

Legend of Grimrock

Such a tight old-school role-playing game. Every component of this game has been thought about. The puzzles, the monsters the characters, the items. There is never enough food. You're always just about to run out of health potions. Monsters are always one step away from killing your characters. You're almost completely lost and confused by the puzzles.

The most freaky moment thus far has been when I was adjusting my character's inventory and an ogre came charging out of the murky black. That was the first time I'd seen an ogre. My party was dead ten seconds later.

There is one aspect to the game that at first seemed tedious. You have to click on a combination of icons every time you want to cast a spell. I eventually realised that this is a way of making the combat more tense. You're trying to remember the combinations and click the icons before you get smashed by something like the guy below.


Unity of Command

As gratifying as Legend of Grimrock has been, every moment of my time with Unity of Command has been better. Thus far, it appears to be a perfectly crafted strategy game. You have to look for weak points in the battle line where you break through with tanks and mechanised infantry to either charge through to an objective or surround the enemy. Supply lines have been implemented so simply but so effectively. It's devastating to see the lines cut by a lone enemy unit.

Unity of Command is like chess where you can beat the computer and feel like such a bad-arse as you do it.

Turn 3. The Russian line has been broken.
Russian units have been cut off from their supply.

Turn 4. German tanks charge through to take the scenario objectives.
German infantry deal with the remaining Russian troops that have been overrun.
DayZ

I played this for the first time a moment ago. Wow. It's something pretty special. I'll write up my feelings about the game in the next post. In short, it's a terrifying game. I have no idea if I like it just yet, but I'll definitely play it more.

DayZ at night. The house is lite by one of my flares.

Games still to come

Two sequels to one of my favourite games are being released this year. They are Xenonauts and X-Com. They look like they're going to be very good.

2012 is shaping up to have very different games to the malaise of mediocre to dreadful games that have been around for long time now. Now all I need is Elite 4 (never going to happen) or a new X-Wing game to come out and I'll be set.

Saturday, May 19, 2012

Diablo 3

I'm playing Diablo 3 multi-player this evening. It is the first time I've played a Diablo game multi-player. I have fond memories of the original Diablo game from 1997. I played it for hours, though never got close to finishing it. I never played Diablo 2.

I've played Diablo 3 single-player this week. I find it utterly perplexing. There are some astonishing design decisions. They seem so poor and obvious that I realise they can be nothing but deliberate. These are:
  • Gold is something you need to pick-up, rather than being instantly added to your inventory. Why oh why?
  • There are really special magic items need to be identified before they can be used. This takes a right-click and about 10 seconds. WHAT is the function of this mechanic?! I am completely baffled by this.
  • The story seems neither good nor bad but completely antithetical to the sort of game that Diablo 3 attempts to be. In multi-player, especially, I can't see how the story could do anything but get in the way.
  • Health orbs drop at such a rate that they are frustratingly difficult to avoid as they work instantly and don't do anything if you're already at full-health. It's as though I'm being punished for not being very good at evading a good thing (that I might have wanted to come back to later).
  • Every attack is a special attack. I was completely thrown by this. How do I make a normal attack? You don't. It probably didn't help that I started with a Monk and therefore assumed that he wouldn't be using any weapons at all.
  • Aside from the big fat men that explode snakes, none of the monsters have been particularly interesting. I was expecting a lot of funky variations. Maybe they come later. Maybe.
Add to this list issues with lag and DRM. Yet, Diablo 3 isn't a terrible game. I'm not sure that it is fun, but it's compelling enough.

Almost all of the issues and weirdness can be blamed on D&D. Designers need to get beyond D&D. Game rules for RPGs are basically arbitrary. You can come up with whatever you want. D&D had a whole bunch of really dumb stuff that was baffling when played around a table and completely useless when played on a computer. RPGs, computer or otherwise, need to get away from D&D almost completely.

Tuesday, February 28, 2012

Computer Reversi, Part 1 (Or how I learned to stop worrying and love the bits)

After noughts and crosses I thought I’d try Reversi (Othello). Reversi has simpler rules than chess but remains complex enough that it hasn’t been mathematically solved, yet.

I thought I’d find a wealth of information on the net about how to program a Reversi game. However, there wasn’t all that much out there. I found some helpful blog entries at Red Alt Blog. I used that as my starting point.

The best resource for understanding how to program Reversi is at the chess programming wiki. They have an Othello page as well as pages that helped me do a bitboard version of Reversi, with move generation and resolution (dumb7fill), population count (i.e., number of bits on the board) and board serialisation (using bitscans). I'm hoping it'll also be helpful for position evaluation later on.

The tasks needed to code a Reversi computer game with a learning computer opponent are
  1. Game state representation
  2. Move generation
  3. Move resolution
  4. Determine game over and winner
  5. Graphic User Interface
  6. Save/load and undo/redo moves
  7. Position evaluation (i.e., fitness/objective function)
  8. Depth-first search algorithm (e.g., mini-max or nega-scout)
  9. Book/database based analysis (e.g., opening book, transposition tables) 
  10. Mathematical optimisation (e.g., simulated annealing or genetic algorithm)
This blog entry addresses steps 1-6, providing source code for a Unity implementation of Othello. The game logic is written as C# and compiles as mono inside Unity. I assume knowledge of:
The following sections describe some interesting parts of the source code, relating with the first six steps outlined above.

Reading the source code

The entry point for the application (the Main method) is the Start method of the GameBehaviour.cs file. This file is attached to the main camera in Unity. The GameBehaviour.cs file creates the board and pieces as 3D objects and hosts an instance of GameManager (see below). It also manages the UI controls to save/load games, undo/redo moves, setup the human/computer players, start a new game, etc.

The files that do all the real work are:
  • GameBehaviou.cs
  • GameManager.cs
  • GameState.cs
  • BitBoardHelper.cs
  • Play.cs
There are source files, 64-bit Windows binaries and Mac OSX binaries. There are two solutions files contained in the source files. The one named with VS2010 is the one you should open in Visual Studio. It contains a test project and a preliminary attempt at reading the Thor database format. But that will be for another post. You can load the project in Unity via the "Reversi.unity" in the Assets sub-folder.

GameManager

The GameManager class does the work-a-day tasks of the game. Tasks such as:
  • Save/load
  • Undo/redo
  • Tells you whose turn it is
  • Tracks the list of plays
  • Tracks the turn number
GameState

My GameState class handles most of the game rules of a Reversi game. You pass it two unsigned 64-bit integers (ulong in C#). These numbers are a bitboard representation of the game. The first number represents the current player's pieces. The second number represents the opponent's pieces. E.g., the starting position for black is represented as 0000000000000000000000000001000000001000000000000000000000000000 in binary. When you lay out those zeros and ones on an Reversi board, you get:


Why represent the pieces like this? Bitboards appear to have advantages over other board representations. They appealed to me because I often feel withdrawn from the goings on of the computer. Bitboards were a chance to get in closer to the CPU and play around with individual bits.

One interesting aspect of the GameState class is that it is temporally agnostic. It doesn't know what turn of the game it is. It doesn't even know whose colour is to play next. All it cares about is that it is someone's turn and it figures out where they can play and what happens to the board once they do. I like the simplicity of not needing to deal with time.

The GameState class will tell you if the game is over and whether the current player has won.

BitBoardHelper

I created a BitBoardHelper class to add some extension methods to my ulong bitboards. These methods allow me to count the number of bits, find the indices of the bits and find the unoccupied bits of any two bitboards. I'll probably expand this class when I work on the computer opponent.

For finding the indices (bitboard serialisation) I used the De Bruijn method to do the bitscanning. For the bit count (population count) I used the SWAR Popcount routine.

Play

There is a Play class in the project that will find all the valid moves for the current player and also resolve a chosen move (i.e., flip of the pieces that need to flipped once a piece has been played). The basic idea is to focus one direction (cardinal or ordinal) at a time, scanning 8 locations in parallel. Red Alt explains it well (see under the bitboard heading). Once I could detect where a player could place a piece, I used a very similar method to resolve that move. This class is called by the GameState class and is only different to the BitBoardHelper class in that it has specifically Reversi functionality.

Graphic User Interface

The GUI uses the Unity 3D graphics engine. Much of the code that I use in the Reversi project is a simpler version to what is found in a previous article on Unity and path-finding. Unity displays the board and captures user input.

Save/load games and undo/redo moves

Save/load and undo/redo are interrelated. To do them, I need to keep track of the moves made by the players. If I do that, I can:

  • Save: Write the move list to the hard drive.
  • Load: Read the move list from the hard drive, start a new game, apply move list - one move at a time - until the last move is applied.
  • Undo: Start a new game, apply move list until the desired turn (similar to load).
  • Redo: Identical to undo.
Part 2

In Part 2, I intend to cover the aspects of creating a computer opponent for Reversi. The primary goal is to be able create an opponent that can beat me in a game. (Not a highly goal.) Hopefully, I'll be able to have it beat all but the best Reversi players.

Tuesday, November 22, 2011

Comments on Skyrim


I've been playing Skyrim in my (ever dwindling) spare time.

Good things:
  • I play by simply allowing myself to be drawn to whatever seems interesting. I don't particularly care about completing quests, I wander. It's working really well for me. I'm often stumbling onto something interesting.
  • I went on a quest to recover a helmet. (I deliberately chose the most banal of the quests.) It was fun. I crossed over a bridge in a treacherous cavern. I fought a couple of frost trolls. Burnt 'em.
  • I started back to Solitude (a city of Skyrim) and saw the ghost of a headless horseman ride by. It just appeared and rode off. I tried to follow it for a while but was distracted by some midnight revellers who offered me a drink. I drank. When I looked back, the horseman was gone.
  • I saw some rabbits hopping around underwater. Then I saw a white wolf walking underwater. Mammals in Skyrim have strong lungs.
  • On the quest to "find King Olaf's verse," I made my way to the body of Svaknir, at the bottom of a stairway. I was expecting to find a book here. There was no book. My character became trapped in a dungeon, never to escape. (Some bugs are cool.)
Bad things:
  • Books in Skyrim are boring. Tip for next time: Bethesda, if you're going to have poorly written text, write less of it and link it to the gameworld in some way. I only open books because of the possible quests or skill bonuses.
  • Food appears to be useless. They've put so much effort into it, it would have been good to have a requirement where you need to eat and drink occasionally to keep your stamina up.
  • The UI is bad. You can use it and thankfully the core of it (choosing spells and items) is okay, but it's still bad. You have to hit 'tab' to close the menu? What's wrong with 'esc'? See: interface comments.
Skyrim screenshots

Tuesday, June 28, 2011

Computer Opponent: Noughts & Crosses

The next task on my list for making a strategy game is writing a computer opponent. In the tutorial I describe how I’ve used variations on the minimax algorithm to play noughts and crosses (tic-tac-toe). I chose noughts and crosses because it’s finite (always ends in 5-9 moves) and simple, yet there are thousands of different solutions. Eventually, I plan on using a minimax type algorithm for a game which will use the hex board tutorial I created in Unity earlier.

The C# source code for this project is available here.
The tutorial is available here.

The end result of this project is a console application that plays noughts and crosses with itself. It cycles through games using negamax, alpha-beta pruning and negascout. Every game is, of course, a draw. (You may notice that negascout is slower than alpha-beta pruning. This is because I haven’t ordered the search tree, it’s such a simple game that it isn’t worth it.) There is also a test project that runs a number of tests to make sure that the algorithms are doing what I expect them to do.

Friday, June 17, 2011

Unity, hexagons and path-finding

I’m creating a strategy computer game again. This time I thought I’d write some tutorials as I go. In this tutorial, I bring path-finding on an hexagonal grid together with Unity.

I assume a good knowledge of C# and no knowledge of Unity. If you know how the A* search algorithm works, you’ll probably be able to read all the code without any problems.

You can access the tutorial here.
The source code and Unity project file are in a github repo.
A Windows binary is available here.
A Mac binary is available here.


Screenshot of the result