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

Sunday, June 29, 2008

Non-blocking sockets and Linux

Hi.

I just got through mucking around with system calls under Linux to make the network subsystem of the Sphere RPG engine work. Very painful experience.

Anyway, I fixed it, almost totally rewrote it, and I noticed a few issues with the old code.

First, reuse of a port on a machine was a pain, because my listening ports weren't using SO_REUSEADDR (which can be set with setsockopt at the SOL_SOCKET level). By what I read online, ports relinquish themselves after about a minute. Not fun when you're debugging network apps.

It didn't help that somebody conveniently forgot to convert a port number to network byte order when packing the listening port into the address structure.

Then, there was an issue with sockets being blocking. The Sphere network API is meant to be asynchronous, so obviously that was a big problem. But it's what followed that really caused problems.

The routine for checking the state of a given socket wasn't working at all. The code wasn't terrible, it's just that it didn't do the job it advertised. You'd think it'd be simple: checking if a socket is connected or not.

What. The. Hell.

Sockets are fairly well documented, you can find a lot of info about them by entering even vaguely related terms into Google. Non-blocking sockets are a whole different ball game. It took me days of debugging and trawling through Google to find links that were even remotely helpful.

A guy who was looking at the same code had his father help with a stop-gap solution that worked under Mac OS X. Performing polling on the socket was a step on the right track. But sockets under Linux act a fair bit differently, or they must have, because the code he got didn't work for me in Linux.

I spent most of yesterday reading pages of returned event flags from the poll() system call in an effort to find out how to check if a socket was connected or not.

The solution? When a peer closes their end of a connection, your socket receives a POLLIN event. An attempt to read() or recv() will give you zero.

The link that changed it all: I was operating under the false assumption that a disconnecting peer would raise a POLLHUP or POLLERR signal. How wrong I was.

I also checked for -1 without errno == EAGAIN, since this is asynchronous sockets we're talking about. Tests seem to show that everything is working. It even works for that guy using Mac OS X.

I need some tea.

Wednesday, June 18, 2008

The spaces

After all these years, I got back to mucking around with GearHead and GearHead 2 again. Something that bugged me about those roguelikes was that the were developed on Windows: in itself, not a terrible thing.

But the problem is with the difference in the nature of the terminals versus Linux. Linux terminals are usually 80 columns by 24 rows. Windows uses 80 columns and 25 rows. That missing row causes Pascal's drawing routines to go loco-roco. Makes the games unplayable.

I wrote a shell script a while back to send terminal escape codes to resize the terminal under Linux to use 25 instead of 24 rows. I picked it up, and it still worked.

The problem is: spaces. My directories have spaces ZOMG!!1 There's a long explanation for that transgression, but long story short, I needed my home directory to be consistent.

I just spent the last hour or so updating that script to work, regardless of where the thing was launched from. Anybody who has attempted to get scripts into Linux desktop launchers will know what I'm talking about: those scripts are never launched from the right directory. Stacks of quoting and unquoting, remembering that single quotes don't allow variable substitution, and a bunch of other things.

Spaces are a pain.

Maybe I'll contribute the script back to the GearHead community once I've brought it up to quality standards. I made it this far, I may as well finish it.

Sunday, June 8, 2008

Ponk: A Pong clone



Two paddles, one ball. That's the name of the game when you're playing Ponk, a Pong clone made with SDL and Common Lisp.

Download Ponk source (120 KB ZIP archive)

Requirements:
  • A Common Lisp implementation (I use SBCL)
  • ASDF (SBCL comes with it)
  • CL-SDL (SDL bindings for Common Lisp)

Launching: If you're using SBCL, just run the *nix shell script:

./ponk.sh

If you want to run it from within CL:

(asdf:oos 'asdf:load-op 'ponk)
(ponk:start)

You may have to switch to the directory to make the font load right (use (sb-posix:chdir "path/to/game/") with SBCL).

Controls: Cursor keys for Player 1, WASD for Player 2. Holding left and right will make the ball faster/slower when it hits your paddle. ESC will end the game. First player to reach 10 points will also end the game.

Saturday, June 7, 2008

MGS4 spoilers

Well, I won't go into details, but major spoilers for Metal Gear Solid 4: Guns of the Patriots have been leaked on the Internet, less than a week before its worldwide release. I didn't mean to look; they just kinda crossed my path. And they're not really "spoilers" to me anyway: I don't have a PlayStation 3 and I don't intend to get one anytime in the foreseeable future. But even with the game "spoiled", I can say one thing.

This game is going to be EPIC.

Tuesday, May 20, 2008

Dweller is back

Holy cow! Dweller is back online again! I remember some time ago this not being the case, so pick it up while you still can.

Dweller is a roguelike game for mobile phones. If you're after a surprisingly addictive game to tide you over on the train on the way to work, this just might be the thing for you. Sure beats wasting time on card games. I've played it myself quite a while ago, and it's surprisingly easy to control, and the levels show lots of variation. Highly recommended.

Friday, March 28, 2008

AVGN: Double Vision Part 1

The Angry Video Game Nerd

(Watch out, GameTrailers as a site bleeds bandwidth.)

I've been watching this guy's videos for a while, and his most recent instalment takes a look at two of the Atari 2600's competitors: the IntelliVision and the ColecoVision.

I was practically raised on video games. I have very clear memories of playing games on my Atari 2600 and mucking about on the NES. I also remember having an IntelliVision, but the memories of this particular console are patchy at best. You can imagine my excitement when I saw this video posted up.

Already I'm spotting a few familiar titles: Zaxxon appears in the intro (though to be fair, Zaxxon appeared on a lot of platforms.) Space Battle with the funny dots drifting towards the clouds in a green field.

This first part talks about the IntelliVision. The console I recognised immediately. Well, that's not quite true. Really, the most distinct part of the IntelliVision are the controllers. They had a grid of metal-like buttons that "pop" when you press them, and a huge round... "thing" beneath that. Nobody forgets a controller like that.

The Nerd points out the IntelliVision's wood texture. I never remembered that, though it was something that I was proud that my Atari 2600 had. The 2600 is a real man's console, wood finish and all. The IntelliVision was always "the console with the big disc button."

The Nerd has a few complaints about the system. One of them is that, without instructions, they're difficult to understand how to play. Apparently, that didn't deter me from playing the games anyway. My experience boiled down to pressing random buttons and seeing what would happen on the screen, if anything. It's a legitimate complaint, compared to, say, the Atari 2600, which had a joystick controller that only had one button, versus the cluster on the IntelliVision controller. I think the games were actually more complex; probably a result of the developers having more buttons to play around with.

Speaking of the controller, that's another of his complaints: they suck. That I didn't notice as a child either, but when you're at the stage where any kinds of blinking, moving lights will amuse you, I suppose it slips by the radar. I don't remember putting much effort into doing well in these games. Since, as I implied before, Atari 2600 games were simpler, it was a lot easier to figure out how to score points and do better, so I put most of my effort into that.

The controller doesn't consist solely of the numbered buttons and the big disc thing. There's another four buttons stationed on the sides. They were tiny and black, and I never remember them doing anything useful, so I mostly ignored them.

Since the numbered buttons don't mean much by themselves, each game would come with a slide-in plastic card thing. What you'd do is slot it over the buttons from the top, and then you'd at least be able to tell what the buttons actually meant while playing the game. I always thought these were really cool, for no practical reason. I just liked seeing the funny little pictures on the thing. I only remember one picture, from one card: "PT Cruiser", with a picture of a small ship above it. Watching the video, I vaguely remember seeing a few more cards, like the one from Space Battle, with the funny triangles, but they never made much sense to me. As a kid, sometimes I'd just play around with the cards, cartridges be damned, just so I could muck around with the pictures.

Then the Nerd reaches for Advanced Dungeons and Dragons. I never had this game myself, but the limited visibility and exploration of dungeons immediately make me think of Neverwinter Nights, and Castle of the Winds.

I had a golf game. The Nerd doesn't cover it, which is just as well, because I remember not being able to hit anything. You wouldn't think that picking a club, hitting a stationary ball at some given strength would be that complicated, but I don't think I ever scored a single hole the entire time I had this game, and indeed the console itself.

Buzz Bombers. Didn't have this game myself, but it reminds me of Donkey Kong Jr. 3, where you're some guy with a spray can trying to get what I presume is Donkey Kong Jr. to the top by spraying him, but there are bugs all over the place trying to grab stuff from you. Now that I think about it, there's not that much resemblance.

And now the Nerd pulls out the "IntelliVoice voice synthesis module." What. The. Fuck. This box is totally new to me, I've never come across it in my life. This should be amusing. Only a handful of games supported it. This box, and indeed the whole console, was made by Mattel Electronics. If you were a kid like me, you remember having at least one speech-based toy made by these guys.

The first game that the Angry Video Game Nerd pops into this thing is B-17 Bomber. And the first thing that strikes me is the voice. Well, that'd be the first thing that strike anybody at that point, but I distinctly remember that exact same guy's voice in those Mattel speaking toys. Did they just hire the same old man for all of these things?

Another thing that sticks out is the terrible voice synthesis of everything after the "Mattel Electronics presents..." bit, which is to say the speech is horribly mauled, possibly "spoken" by another person. I use that word loosely, since it kinda sounds like the syllables were pulled from different parts of some recording. I wouldn't make a point of it, because the speech technology was fairly advanced for its time, but, like those Mattel speech-based toys, following the instructions are impossible because of the distortion.

My memories of the IntelliVision are vague at best. In fact, I don't even remember if I had this before, during or after I got my Atari 2600, which seems to dominate my memories. Probably just as well.

Good times.

Thursday, March 6, 2008

Pac-Land

What. The. Hell.

A classic game that I remember from my childhood. A classically confusing game. Nothing in this game makes sense.

The first thing that struck me when I fired up Pac-Land for the NES was the so-called publisher's logo. It must have been a very long time ago, because I don't recall any company by the name:

NAMCOT

In case it isn't obvious, that's "NAMCO" with a 'T' tacked onto the end. Couple that with the "Pac" in Pac-Land, and that's classic IP stealing right there. (Update: Apparently, NAMCOT is a legitimate alternative name to NAMCO. See the comments.) That doesn't bother me too much, but it's always symptomatic of something far worse.

The gameplay. What's this thing supposed to be about? There's no mazes, no dots to collect, and apparently the only aim is to go from left to right, or from right to left. There's ghosts, and there's Pac-Man (even if he is adorned with a hat, for whatever reason), and that's about as far as the Pac-resemblance goes.

Here are the controls: A goes right, B goes left, and any press of the D-pad causes that yellow thing you're controlling to jump. What the hell. How can you screw up controls on the friggin' NES? There's only four buttons and a D-pad. The only way you could possibly screw this up is if you never saw what a NES controller looked like. Or if the "creators" hacked this abomination of a title out of something else, which would lead one to wonder how the original creators screwed it up.

It's so hilariously bad that it's good for five-minute time-wasting runs. If this wasn't on the NES, I would have no reason to play this. And yet since it is, I'm rather curious as to what happens at the end.

If there is an end.

Monday, January 28, 2008

Barkley Shut Up and Jam: Gaiden

A post-cyberpocalyptic RPG about basketball? What's not to like about this game?



The gameplay is solid, with an unconventional battle system, lots of puzzles and secrets abound. It's also hilarious to boot, and even makes a few nods to Space Jam, if you've ever watched that. Highly recommended.

If you can't slam with the best, then jam with the rest.

Tuesday, January 8, 2008

Dud characters

So I play RPGs. These games have characters, often many characters. But only a few characters are allowed to be in the party, or at least fighting. Those in the party get stronger and stronger, and those who aren't get weaker in comparison.

Therefore, at best, switching characters is an inconvenience: wading through menus, having to choose who to take, and sometimes even having to backtrack to a certain place. At worst, it's a massive pain, as you discover how weak these guys really are.

A while ago, my sister was playing Legend of Dragoon on the PSX. She managed most of the game just fine, but when it came to this one particular boss, not even repeated attempts could get her through. It must have been the fifth attempt when I suggested that she use the dumb, stupid sideline characters that were never used. She beat the boss on the first try.

I was just playing Front Mission 3 on the PSX. So far, I've beaten every battle with flying colours, but this one tiny map with a bunch of powerful wanzers (wanderung panzers, German for "walking tank" and the main unit of the game) were proving difficult. The situation was a bit different, this time I was forced to use one of my dud characters (Pham, for those who have played the game.) My first attempt at the battle failed slowly and dramatically when I got into the unfortunate situation of losing both arms on the two wanzers that were still on the field and ran out of restoration items. I even had these two pilots eject from their walking robots and shoot their pistols at the one remaining threat, but this thing had powerful evasion bonuses, and I ultimately lost.

My second attempt shared nearly exactly the same strategy as the first, but with one tiny difference: I attacked with Pham's wanzer first for each turn. I made this decision after I noticed she had more HP on her robot than my main machine-gunning guy. This tiny difference was enough to seal the battle for me.

So you see, even the dud characters have their time in the spotlight, so don't neglect them.... too often. I do miss the old hey-day of the original Front Mission though, where you could opt to deploy everybody for every battle.

Stupid people, on the other hand...

Friday, January 4, 2008

I just finished POWDER

Well that was fast.

Photobucket

And thus, the inappropriately-named FUCK completed his quest to escape the dungeon by killing some demon at the 25th level and retrieve its heart. It's kinda unfair: what'd this demon ever do to him?

Come to think of it, killing that demon was one of the easier fights in my play-through of POWDER. I fought it over the water in my water-walking shoes; I actually had more trouble and took more damage finding the heart submerged while I nearly drowned in my armour.

Some lessons learned:

Get food, eat food

For variety's sake, I'd chosen Endure Hunger over Clean Kill (leave a corpse with virtually every kill). All the games before that I chose the latter. Now I know why.

The following should not be eaten:
  • slugs of any kind
  • invisible stalkers
  • chameleons (unless randomly polymorphing is your idea of fun)
  • dragons and elementals (they just give you elemental weaknesses)
Eating bats can quicken you. Eating mages will boost your mana. That's all I can remember. Just become a corpse vacuum. 99% of the time, you'll get away with it.

Reflection is fun!

In programming and in POWDER. I was lucky enough to get a shield of reflection early on, and it basically makes you impervious to any ray-based magic or dragon's breath attacks. They're more common than you'd think.

WARNING

Helms of warning > helms of telepathy.

Warning is the reason why I appear as a question mark in the screenshot: I can sense myself. Warning allows you "see" all enemies, but only by their relative threat level. Compare this against the power of telepathy, which only detects a subset of enemies ("intelligent" ones) and doesn't show how dangerous they are at all.

Beware cockatrices

The single most annoying enemy in the game. It petrifies, and it attacks on sight. I used wands of sleep to get around them, as well as divine intervention (which can sometimes restore you.)

Cave trolls

They revive. You can tell because attempting to eat their corpses always fails. I supposedly killed 25, with other kill counts running only up to about 10 or so, but it looks like it counts re-kills too.

Faith

Each level-up gives you the chance to worship a deity. Choose one and stick to one, because they'll do handy things like heal you, purge poison, revive petrification, and give you free things. None of that tribute bullcrap in other roguelikes.

Zap unknown wands at monsters

Most wands have a negative effect that will harm you if you zap yourself, except the wands of light, digging, speed and invisibility, and perhaps teleportation. Most are just medieval pistols.

Read all scrolls

Unlike wands, virtually all scrolls have some sort of positive effect. Pick up a lot of exotic items, and read a scroll of identify, and suddenly you can see how awesome your inventory really is, while avoiding cursed-item landmines.

There's only one bad one, and that's the scroll of fire. Try not to do too much random scroll reading at low HP.


Anyway, here I am on the surface... I think I'll duck back down into the dungeon for something to eat. I swear that place is like a DIY buffet.

Thursday, January 3, 2008

POWDER

When I first stumbled across this title at The Linux Game Tome, I was half-inclined to believe it was something to do with drug-smuggling. To my pleasure/disappointment, it was a roguelike, which, come to think of it, tends to have the same addictive quality.

Like any other roguelike, you run around in a tile-based dungeon and beat stuff up until you die or complete whatever psychotic quest the creator has assigned to you. Unlike a lot of roguelikes, this game is not only available on Windows and Linux, but also comes in GameBoy Advance and Nintendo DS ROM flavours. In fact, the game was originally designed for the GBA, which shows in its restriction to 4-way movement and the fact that a context menu is available for all actions.

It raises an interesting point: why do dungeon crawlers suck so much on consoles?

It's not the addition of nice graphics. I think nice graphics are a good thing, and certainly something that a lot of games could benefit from. It can't be the controls, since the controls in POWDER are quite workable.

My theory is that the game development teams are too preoccupied with the 'random' concept that is intrinsically present in roguelikes as a whole. The very term "roguelike" is coined from the game "Rogue", which has been around for decades. The field has gotten used to the random concept, and often pushes ahead to add their own individual flair, such as ADOM with Tower of Fire and underwater levels, and Nethack with the many and varied ways to do things with other things. In POWDER, worshipping deities actually makes a difference, and the gameplay is deceptively simple, hiding a large and varied core. Looks like it was pulled straight out of the VGA era though, graphics-wise.

Console dungeon crawlers are just that: dungeon crawlers. The developers get it all wrong, nearly all of the time. I couldn't stand more than 10 minutes of any version of Azure Dreams, because the levels all looked and felt the same. The items hardly varied, and the effects were uninteresting. In POWDER, I can throw a knife straight up, just to fall back down on my head and stab me. It's totally useless, but it's amusing and shows that the creator put thought into the game. I don't think I've ever come across an effect in a console dungeon crawler and thought, "Wow! That was cool!"

It seems a bit strange, but it's the non-random bits of roguelikes that make them really stand out. POWDER delivers.


Anyway, there are four versions of POWDER available: Windows, Linux, plus GBA and NDS ROMs. If you're after something for your cell/mobile phone instead, look into Dweller (looks like the main site has fallen into disrepair, but you can still find it in Google's cache if you search for "dungeon dweller". First hit.).

Wednesday, January 2, 2008

Stupidity? Meet opportunity.

According to some source I just pulled out of my arse, a blog is born every two seconds. As if we didn't have enough already.

Here's what I'm interested in and therefore post about:
  • old-school retro games
  • computer programming
  • lol internet
  • other stupid geekery
Enjoy!