Hacker News new | past | comments | ask | show | jobs | submit login
Pacman running on DCPU-16 (fingswotidun.com)
266 points by reitzensteinm on Apr 20, 2012 | hide | past | web | favorite | 58 comments

While certainly very cool, this is unfortunately using an unofficial sprite spec[1].

There's plenty of awesome things being done with the official specifications though, like this minesweeper clone: http://0x10co.de/lqnit and this simple raycaster: http://0x10co.de/o3xss

Vim is also in the process of being ported: https://github.com/DanielRapp/0xVim

[1] http://fingswotidun.com/dcpu16/sprites.txt

I think it'd actually be pretty cool if the actual game had multiple DCPU versions in the universe. It would give it even more of 1980's computing feel.

Explore the planet, fight off hordes of zombies to obtain... a DCPU16 - REV C!

It's not certain if there's going to be different DCPUs with different specs. Notch has said[1] that there's definitely going to be versions with different clock rates floating around in space or on abandoned spaceships.

[1] http://vps.thomascomputerindustries.com/logs/freenode/0x10c-... (search for "[11:38:45]")

> [11:39:56] <_notch> fly in highly radiated areas, and random bits in ram will flip

Everything I hear about this game makes me want it more and more.

Notch has said that when he "upgrades" the DCPU spec, the old CPUs will continue to work as they have, but new CPUs will become available. I don't have the reference handy though.

While it might be using an unofficial sprite spec, everything you linked at 0x10co.de is using an unofficial input and graphics spec… That's what the community does: fill in the missing pieces!

0x10co.de is based on official input and graphics specifications taking directly from the DCPU emulators Notch has leaked/released.

I found a bug in minesweeper. Start new game, don't move selection, press F, press F again and enter.

and the pacman baddies walk through the walls pretty frequently. Still, it's awesome!

How utterly marvellous! The entire outpouring of exploration around DCPU-16 is a wonderful example of the hacker-spirit "Here's a thing, what can you make it do?"

Reminds me of my community of modders and mappers of the original Jedi Knight game. The engine was out-of-date pretty soon after release, but it's only within the last few years that the editing community has died down. People found ways to create 16 bit textures (the game only came with 8bit colour-mapped ones), how to implement bots in multiplayer, they hacked the binary to remove hard-coded graphical limitations. All of this happened while there were far more powerful engines like Quake 3 and Unreal available to play with.

Sometimes it's good to see just how far you can push an idea.

This reminds of Heroes of Might and Magic III WOG - The folks changed the executable so much that future scripts were encoded as text, hidden in the message-boxes showing information about the map to the player (they would pop once in a while, if the game scripts says so).

I know how crazy (in good sense) are the modders - I had to help release the mod tools for World at War and Black Ops (I work at Treyarch).

Well it's turing complete so... ;)

Actually, one of things that the DCPU reminds people of it's not enough to just be Turing complete. You also need hardware to represent the state of your machine (graphics monitor or console), and ways of providing input. Turing Complete machines aren't very interesting if you can't see what they're doing ;)

Also, don't forget, you 'only' have 100,000 clock cycles to play with.

A good, but pedantic, point. ;)

It's kind of insane that people are writing games in assembly for a CPU in a game. I feel like 0x10c is going to be some sort of milestone in terms of innovation.

Next up is the immersive technology.

As someone who knows absolutely nothing about CPUs, is this CPU design _that_ good, or is it just the fact that Notch made it that's generated all this hype?

What's (potentially) revolutionary about this game is the deep rooted support for emergent gameplay. A telltale sign of a great game is that players themselves, in exploring the game, find new and interesting things to amuse themselves. Minecraft is an obvious example, with hundreds (thousands?) of public servers dedicated to varied pursuits.

A different type of example could be EVE, where the rise and fall of corporations is gameplay not written in by the devs, but gameplay created by the players. Any game that has developed a professional gaming community could also be lumped into the category of having emergent gameplay, since there is an entirely new game mode (spectating) created by a community surrounding the game.

When I look at 0x10c, and know that I'm going to have complete control over a CPU in game, and this CPU will be the basis of my pursuits in the game, I know that there will be interesting things to be done. This is because there's such a strong focus on allowing players to create their own gameplay. No other game (that I know of) takes its players' creativity seriously enough to rest so much of the fun on their shoulders.

Having Notch to hype the game certainly helps, but helping to create this world is alone an exciting prospect.

I think it has very little to do with the design of the CPU itself but rather the unprecedented introduction of a functional CPU being emulated and usable/programmable within a game itself.

The fact that it was Notch gave it visibility, but I think the following is more than just design or cult-of-personality.

Simplicity is extremely important. A lot of emulators appeared the same day that the spec was released. That not only needed people who wanted to implement the CPU, but also a spec that could be implemented in under a day.

There's a bit of Benevolent Dictator effect here as well. It's not that the system is the absolute best, but it's something that people can target for interoperability. Someone can write a compiler and someone else can write the emulator.

No it's not a great CPU design at all, it has some big limitations.

Can you expand on that? I'm genuinely curious (as an un-informed observer)

There is a good discussion of it here: http://fail0verflow.com/blog/2012/dcpu-16-review.html

The key criticisms center around it being not a instruction set for compiling C and other higher language code. The biggest reasons for that are:

1. No ability to store based on the stack pointer (this is great for handling local variables not in registers)

2. No ability to deal with negative numbers

3. No way to address single bytes, everything is full words only. This makes many basic manipulations take many instructions

4. Not very many registers, particularly in light of limitation 1

The 6809 and 6502 had far fewer registers, but didn't have any of the other limitations listed above.

As an aside, I find it entirely plausible that these restrictions are, if not designed for, at least desired in the design.

As they make the work of a compiler harder, they promote coding in assembly to get faster code. This, on the other hand, leads to lower code quality (as avoiding gotchas and dealing with corner cases correctly is a lot easier even in c than in assembly), which creates more "drama", which is good for gameplay.

I don't think the 6502 had #1, or at least not in an easy way. Accessing, say, the second element from the top of the stack required you to copy the stack pointer to the ?X? register, then use that to index into the stack. That works, but is cumbersome.

Not having interrupts makes it interesting to multitask as well, since every program has to be made to explicitly multitask cooperatively.

>No ability to deal with negative numbers

How is representing a number in 2's complement verboten?

That was a great link to read. Thanks!

The CPU design is bare bones which is part of the fun.

How long will it be before somebody ports a nice VM to DCPU-16 or targets a compiler for it? The architecture is so simple and familiar I'm guessing that's not a terribly hard job. Folks are probably not going to write their programs in DCPU-16 assembler.

It does exist: https://github.com/llvm-dcpu16/llvm-dcpu16. The only problem is that there's not going to exist a compiler in-game. People will have to import the compiled assembly code, which isn't nearly as fun as staying in the game during the whole process.

Which is a pretty good argument for building a self-hosted Forth. You get a compiler and REPL suitable for commanding the computer in a package that will fit easily in the limited memory resources available. If you use threaded code with an "inner interpreter", it's possible to generate very compact code and fit a lot in a small space, or you could emit machine code directly ("subroutine threaded code") for speed.

There are already a number of compilers targeted at it. Browse through reddit.com/r/dcpu16 and you'll see a new one pop up every few days. I'm curious how long it will take before we see compilers that are good at optimization. Pretty much every compiler I've seen crop up makes admissions that it's generating terrible code.

Having good names for functions and variables makes even assembly readable.

Names: what a great idea.

I've been finding all of these programs incredibly refreshing and easy to read. Each instruction does exactly one strictly-defined thing before moving to the next instruction - so simple!

It will be interesting to see if my level of refreshment remains intact as the level of complexity inevitably explodes. Even this pacman game, which is the most complex I've seen yet, is much simpler than whatever space ship or armada management programs people will eventually start writing.

Its funny because in retrospect anyone can see how this game should be a success due to how folks were using Minecraft to build complex machines. And yet it came from Notch again (ok, he has a massive fanbase which will probably determine his success, but anyway...)

I think having a massive fan base really just helps to speed up the launch of something, and it doesn't determine success in the slightly longer term.

With a new and great product, you have an exponential growth curve. People find it, think it is great and tell their friends and so on.

The only difference with having a fan base built up already is you get to start further along the curve.

It's still the same curve though. And how great the product is determines the shape of the curve, not the fan base.

In my opinion anyway, for whatever that may be worth.

This brings back distant memories for me: ages ago, just for fun, I wrote a quick-and-dirty PacMan clone for the TRS-80 Color Computer, which was powered by a lousy-by-present-standards Motorola 6809 processor.

I have to agree with some of the other comments here, 0x10c looks to be some sort of milestone: a fully programmable, Turing-complete game!

Minecraft is Turing-complete too. You just have to build your own CPU and there's no way you're going to get 100 kHz out of it. Heck, so is Dwarf Fortress. People have built CPUs in both.

Personally, I say the difference is that Notch makes meta-games. That is, he makes game worlds in which people create their own games.

You are absolutely right -- in the sense that even a dead-simple Turing machine built inside one of those other games is Turing complete too.

0x10c feels like a milestone, though... I guess it's because the in-game CPU this time around is usable on a human timescale. If in-game networking is ever added to 0x10c, one could even imagine a usable minecraft clone inside the game. It feels different this time.

Yes, I think it's an important milestone in terms of making that sort of mechanic more available to everyone. Most people were building small, special purpose circuits instead of general purpose devices, simply because it was difficult and wasteful to build your own CPU... unless that was their goal in the first place.

I agree that 0x10^c will likely be something special.

The 6809 was one of the nicer processors back in the day. I still wish it and its successors had won over 8080 and is follow ons.

Yeah, it was nice. OS-9 was pretty nice too.

I have heard that although I never used OS-9. I programmed a 6809E on a development board in college after having learned 6502 assembly in high school. Liked it a lot better than the 8086/8 assembly I took the semester afterwords.

I remember OS-9 as being very unixy and much more powerful than the single-user, non-multitasking, 'toy' desktop operating systems of the day -- like, say, CP/M or the Apple II's OS.

It meant that one could have a powerful, multi-tasking, multi-user system just by installing OS-9 on a cheap TRS-80 CoCo (typically hooked up to a home TV). It felt like a great deal at the time.

As to x86 assembly language, I've had almost no exposure to it, so I can't really judge it.

You don't even have to be a computer game to be Turing complete :P. You can actually simulate a TM in Magic[1] (a card game). Looke at

[1]: http://draw3cards.com/questions/2851/is-magic-turing-complet...

Darn, looks like this is not editable like the code at http://0x10co.de

I was looking forward to seeing if I could figure out how to cheat and give myself infinite lives (I'm not very coordinated so that's the only I'll ever win ;-))

It is editable. Stop the emulator and enjoy.

You already have infinite lives.

Is this the new demoscene?

I think raspberry pi and 0x10c will both be a part of the new demoscene.

Is it just me, or do the ghosts seem to all be moving fairly randomly, rather than following 4 different, but consistent, behaviours (like in the original Pacman)?

Yes, ghost movement is definitely different and easier - for one thing, they don't chase pacman when they get close like they do in the original game.

As great as Raspberry Pi is, this is much more likely to get my kids and their friends programming.

Note for people with narrow screens: if you scroll over to the right you can run the code :)

I think it's pretty awesome but I'm not going back to assembly. If Notch implements a Java version (for the in game CPU) then I'll definitely buy and play the new game.

I could only say one thing... Whoa!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact