Archive for October, 2007

Top platformers of me

October 31, 2007

Top platform games of my choice:

1. Donkey Kong country (SNES)
2. Flashback (PC version is better then SNES version)
3. Prehistoric 2 (PC)
4. Soldier of Fortune (ZX Spectrum)
5. Pandemonium (PC)
6. The lost vikings (PC)

Games which I know about but will not put here:

Sonic the hedgehog (SEGA Genesis), Prince of Persia (PC), Blackthorne (PC), Oscar (PC), all Mario games (NES, SNES)

Donkey Kong country

October 31, 2007

I never had my own game console. My some of my friends had NES, so I’ve sometimes played in Duck Tales or Battle Toads and Double Dragon. Graphical capabilities of my ZX Spectrum were lower then of NES, but ZX Spectrum had Elite, Heavy on the magick, Dizzy, Great Escape and Castle Master. Games for ZX Spectrum were more interesting, where games for NES were stupid, and looked like they were designed for kids. Both systems had lots of games called “platform games”, when you look on your character, who is able to move up, down, left and right. For NES, my most memorable examples are Darkwing Duck and Duck Tales. For ZX Spectrum I’ve enjoyed Myth, Soldier of Fortune, Manic Miner, Saboteur, Jack the Nipper 2, Rex, Green Beret and Nebulus. All those games developed the features which make platformer more entertaining: ladders, elevators, ropes, moving/flying platforms, pits with water, spikes or lava, breaking walls or floor, teleports, secret locations.

NES and ZX Spectrum were comparable: both were 8 bit systems with approximately the same screen resolution. ZX Spectrum had a colour problem (called “attribute clashing”) and was using tape for loading programs, so NES games were looking more beautiful and animated, but those differences were not significant for me, and were not affecting gameplay much.

16-bit consoles were more impressive. Graphics and music were much better, animation was more smooth and levels were much larger. But “killer” games (Sonic and Donkey Kong) were still platformers, and gameplay was the same: avoid or destroy enemies, explore the level and find exit. They were still stupid as any game for kids. Mortal Kombat was a rare exception. 16-bit consoles were not very popular in Russia: Sega appeared in 1993, and 1994 was a year of PC dominance. I’ve played Sonik 2 times, and never played Donkey Kong myself

PCs had the same advantage of games: they were more interesting. Alone in the dark, Doom, Warcraft, UFO, Privateer, Lands of Lore were more complex and never tried to feel like a game, they pretended to feel like a reality. “Prince of persia” is an example of platformer made with that approach: animation was realistic. However, sometimes I’ve played stupid games like “Prehistoric 2″.

I don’t know why I’ve played it, and why I still want to play platformer games. In modern times I felt that I whould like to play “Sonic” and “Donkey Kong”. That’s easy: there are emulators for Sega Genesis and Super Nintendo, and roms are easy to find on the net.

This article is about Donkey Kong country. That’s one of a few games I’ve played on SNES emulators, and for me it’s a killer game for SNES. I don’t like “Mario”, it’s so stupid and cartoonish that I feel myself treated like a 5-year child. I like “DKC” for graphics: it is bright, but not sharp as in “Mario” or “Sonic”. 3D-modelled characters seem cool, the game really looks like it has a depth of volume. I like the style and humor. I like gameplay: speed is perfect, controls are smooth. Levels are linear, but objects such as barrels, tires and ropes allow variations. Variations between levels also good. I like that there is a big amount of secrets: bonus rooms and shortcuts.

At the beginning game seems easy. Difficulty is increasing smoothly. First really difficult level for me was “Mine cart carnage”, because it is faster then all previous levels. But this game doesn’t require lightning-fast reflexes: now I can complete this level very easily, because I remember that to do. The same story with other levels: you just need to develop a trick to overcome each obstacle. I like that, because that process is a sort of exploration. In water levels you can be sure that there is a swordfish helper hidden somewhere, because without it levels become too hard. My second stopper level was “Slippery ride”, because for long time I coldn’t find out how to climb two downslide ropes at the very end of level. Maybe that was an emulator problem: I was pressing “jump” quickly, and it was not working. But I’ve developed a correct way, and now it seems very easy. All difficult-if-go-straightforward levels in first four worlds have hidden shortcuts which make those levels very easy: “Barrel canon canyon”, “Mine cart carnage”, “Snow barrel blast”, “Slippery ride”.

This game has word “country” in title, and for me it really feels like countrly. Overall map, area maps, Cranky Kong – all that makes a consistent world. At first I was wondering: “Why Funky Kong was there, I can go back and play previous levels without him”. Later I undestood that he is needed to get over the borders of area. Then you same your game, the number of lives you had is not saved, because game designers want you to go to easy levels to earn more lives, and that’s a good idea in my opinion.

Several days ago I’ve completed that game, to my great satisfaction. My SNES emulator (zsnes) has a nice feature to record movies, and I’ve made a recording of my completion, so I’ve protected all my hardly found tricks from being forgot. The game itself is very nice, one of the best platformers I’ve ever seen. It has two sequels, which are definetely next on my list

Spirit of Lisp

October 8, 2007

While working on my “Scheme interpreter made in Java” I often thought about Lisp language itself. My interpreter is very small and simple, yet very powerfull, so I was trying to understand: where lies the core of it’s power. Since I’m learning OCaml now it is interesting to compare both languages, and to understand what makes Lisp different. At the beginning there were a lot of confusion in my head, so this article is an attempt to bring an order in my chaotic thoughts.

People often hear about very important feature of Lisp which is “code is data”. But, my impression is that this feature is rather secondary. My current interpreter doesn’t have any macro facility yet, it even doesn’t have car and cdr, and it’s still very capable. So, I think that core of the Lisp lies elsethere, not even in ability to process lists.

I think that Lisp was started as a functional programming language, so Lisp programs should be a set of function definitions and one expression to evaluate. Expression is a combination of function invocations, where result of one function is passed as argument to another. A distinguishing feature of Lisp is that function invocation is written as (func arg1 arg2 … arg3) instead of mathematical notation func(arg1, arg2, …, arg3). Mathematical notation is preferrable if used in expressions like y=func(arg1, …), but Lisp’s notation is preferrable if result of one function is directly passed to another : (func1 (func2 argX) argY). Lisp’s notation is also preferrable if function itself should be evaluated: ((lambda (x) (+ x 1)) 2). Compare with mathematical-like notation used in C for invocation of function referenced by pointer: (*func) (2, 5), which is more confusing for me.

Then I started learning Lisp, lambda looked like a magic for me: function is “produced”. Now it’s more simple: lambda is just a delayed expression. My implementation doesn’t analyze “expression” part of lambda, it is just stored as is. Then function returned by lambda is evaluated, it my implementation just maps function arguments to their values in environment, then evaluates lambda-expression. Other implementations may perform some optimizations, but they are not nesessity. If runtime itself supports recursion, then lambda will be automatically recursive.

Parentheses-based syntax, together with define, lambda and cond provide expressive, simple and clean functional core which is, in my opinion, a spirit of Lisp. My current inperpreter has implemented just that core, and I believe that provided language could already be called “Lisp”. It is definetely not OCaml because of syntax and also because expressions are evaluated dynamically. Dynamic evaluation makes implementation very simple. Note that there are no single mention of lists in language defined above: parentheses are used only to group functions and their arguments, in other words: to define structure of expression. Implementation decides how to represent parsed expression structure internally. I use ArrayLists, for example.

For more complex programs language should provide compound data structures. There are two basic choices: arrays and lists. For funcitonal programming lists are preferrable. “cons” creates lists, “car” returns content, “crd” advances to the tail of list. For functional programming sharing of data is safe. Introduction of lists also means that some memory management like garbage collection should be provided

Now I come to the main source of confusion. Then Lisp prints list objects, it uses the same parentheses-delimeted format as for entering expressions. I don’t know who made that choice, but it made Lisp both powerful and confusing. Next step was (quote), which allows to input list structure using the same syntax as used for output of lists, which is the same syntax as used for specifying program structure. From this very moment it becomes clear that single parser is used to create data lists and program, so internal representation of program and lists are the same. Starting from this moment it is possible to write “eval” in Lisp: parser will get parentheses-separated expression as data and will turn it into internal representation, then list-based functions will allow to traverse that expression. And this is a foundation of macros.

All written above is just my current opinion. Now I start to remember that good books like “HtDP” avoid mixing lists and expressions. Bad books such as “The Scheme programming language” start mixing lists and expressions very early. I think it is important to understand the difference, because it makes all things simple and straitforward. Paul Graham also thinks the same.