Hacker News new | past | comments | ask | show | jobs | submit login
Accurate remake of Pac-Man in JavaScript (shaunew.github.com)
140 points by vacipr on Sept 1, 2012 | hide | past | web | favorite | 59 comments


Double standard, HN?

At least qxcv sees the light: "It's one thing to make a Pac-Man-like game. But this is being called the trademarked name Pac-Man, and you've copied the artwork straight from Pac-Man.

Seems certain this isn't an official licensed version. In which case, you should change all those items immediately. It's illegal and it's just not cool.

Here are the guys you are ripping off. Tōru Iwatani and his friends at Namco. Tōru is a very nice guy:

http://pacmanmuseum.com/history/Toru-Iwatani.php "

I enjoy seeing recreations of code like this. It's educational and fun, and this Pac-Man does not take anything away from the original.

It's unfortunate that IP law is so vague and intimidating. It can easily have a chilling effect on innovation and creativity -- you're afraid something might not be ok, but you don't really know, so you just don't try. For me, that's a red flag in a legal system. Competition, creativity, and education are all great things that deserve clarity and protection, both as an original creator, and as someone adding value with the basis of past work.

Agree, esp. regarding creative suppression and intimidation.

While one should respect the law, I do wonder how the GP can so factually and confidently, conclude the project's legal status.

For example, only as recently as April 2012, did Namco Bandai choose to even register the trademark for "Pac-man" in Europe. In addition, Midway Games, who previously owned the distro rights in the USA, filed for Chapter 11 in 2009.

I certainly have no clue as to it's status, but I do know there is often a digression between what a person thinks is illegal, the actual law, intepretation of the law, case law (e.g. precedents), politics of the law, pragmatic issues etc. Hence the reason we have lawyers, that understand these issues better (and even then, they often disagree with each other). There are also degrees of legality (civil, criminal etc) from jay walking, copyright infringement, patents to mass murder and genocide.

Is Wikileaks illegal? Did Samsung illegally create certain Android smartphones? etc.

Is <x> illegal?, does not seem like a simple boolean, for a wide range of values.

The author of this project, is clearly a huge Pac-man fan, does not appear to be profiting financially (released the source on GH), and is generating interest in a product, that could be potentially be capitalized on by the rights holder.

It's not double standard IMO.

You don't buy Pac-Man from namco anymore (I hope they've stopped selling it). So, nobody (much less them) gives a damn if it is being ripped off.

Doodle Jump, on the other hand, is a game that you can (and millions do, every month) buy from the App Store. If you build a clone of it, the Lima Sky guys might lose some customers.

That's why creating a Doodle Jump clone is wrong, but creating a Pac-Mac clone is not.

People do indeed continue to buy Pac-Man from Namco (http://www.amazon.com/Namco-Networks-40406PAC-MAN-PAC-MAN-Do... for instance, put there as recently as 2010), and the general IP is alive and well. (New games, and a new Pac-Man 3D cartoon is already in production for airing in 2013.) Namco has in the past sent cease & desist or DMCA takedown letters to websites hosting clones of their IP (here's a story of but one, again from 2010: http://www.techdirt.com/articles/20100730/17081510430.shtml), if you bet they don't care you're going to lose that bet. Besides the original by itself there's also lots of collections that are sold fairly often (every year? at least every few years) that Pac-Man comes with.

If you're arguing that "apparent recent interest by the IP owner" is the moral basis (obviously not the legal basis) for ripoffs, then you have to conclude that this Pac-Man clone, too, is wrong.

Thanks a lot for the info. I certainly didn't imagine, even in my wildest dreams, that an ancient game like Pac-Mac could possibly be still alive and a source of revenue for Namco. Pac-Mac game in 2010? 3D cartoon in 2013 (wiki link: http://en.wikipedia.org/wiki/Pac-Man:_The_Adventure_Begins)? I can't believe it.

In that case, I was wrong and this game should also be "condemned" by HN :) Thanks.

This is illegal too. I didn't bother posting again because it seems more obvious. In the previous example, many probably didn't know it wasn't an official port. (author added disclaimers later)

Is it morally wrong that this was created? I appreciate that this exists, and personally am more likely to purchase or promote official Pac-Man products because of it. I think it's a good thing.

Legality is important, but underneath that is the purpose of law itself. I like the idea of keeping in mind both legality and the intent of the law.

If you are making something cool, that adds value (including entertainment), and does not pretend to be, or detract from those you borrow ideas from, it seems ok to me. You may disagree with my particular idea of fair use - the main point is to promote thought about general morality, and not just condemn on the basis of legality alone.

So I presume that the person who made this knows it's "illegal" to use the pacman name and doesn't care. So that's fine, its not like I am not going to report him to whoever owns the ip.

The previous example, a) it wasn't clear that the author knew it was not right b) the people affected where the type of people who would post to HN.

Let me ask you this, do you see anything wrong with someone creating a hipmunk clone called "hipmunk.co" and use their exact CSS and HTML? It's the same situation. If you see nothing wrong with that, then that's where we disagree.

Edit: there's no reason why he can't provide entertainment and value but just name it something else, and use original graphics. To clarify: no one is arguing against the creation of a game that plays the same. The argument is using the exact name and artwork.

hipmunk is not over 30 years old, though, and is not far older than the USA's originally agreed upon reasonably limited lifetime of copyright protection, before Disney lobbying created the never-ending copyright extension in the 20th century. So there's that distinction.

I donot think that this application is illegal as long as the author did not use any original art work and trademark (if it still applys, trademark needs to pay to extend it, right?). 1. Any patents related to pacman expired already. 2. Copyright law does not forbid recreation of original games. The JS author just need to make sure all the code/art was created by himself. Please point out what is wrong about my understanding of the law system if there is any.

I just played Ms Pacman for 10 minutes. It looks like they used all the original artwork and ghost behavior routines (Red, Pinky, Brown all do the right thing) - right down to the timing of the reversals around 5 and 20 seconds.

>Here are the guys you are ripping off. Tōru Iwatani and his friends at Namco. Tōru is a very nice guy

Do you Tōru personally? He could equally feel the opposite, happy his work is receiving renewed attention.

I'm not sure any of us on HN even know the position of Namco or Mr Iwatani, or for that matter, whether they would be in agreement with each other. In fact, many creative people, do not align philosophically with corporations that represent them.

The remakes look really good -- good job! Does the original Pac-Man remake use the same AI behavior as the original arcade version? I ask because I tried using the "safe spot" trick (src: http://strategywiki.org/wiki/Pac-Man/Tips#The_safe_spot ) and the red ghost caught me every time.

The safe spot works for me. The safe spot exploits the fact that ghosts are not allowed to turn upwards in the corridor immediately below the safe spot [1]. That behavior was accurately emulated in this version.

Make sure the red ghost passes below your safe spot from right to left. It wants to turn upwards, but it is not allowed to, so it has to keep going. It then circles around back in a T shape.

Make sure you are facing upwards, so that the blue ghost circles the center of the maze.

Finally, be mindful of the scatter phases [2]. A scatter phase will bring the red ghost out of his loop, so you need to lure him back into it. After the final scatter phase you can stay in the safe spot indefinitely.

[1] http://home.comcast.net/~jpittman2/pacman/pacmandossier.html...

[2] http://home.comcast.net/~jpittman2/pacman/pacmandossier.html...

It didn't seem to work. I'm not a Pac-Man expert, but the ghost behavior didn't feel the same to me here as it does on an emulated version of the original.

(I liked the speed though, Pac-Man is too slow.)

The hiding spot doesn't work, so there is definitely something amiss with the behavior. Still very fun.

It looks like there was an attempt to copy at least some of the original AI behavior. If you click on the "Learn" tab, you can choose which ghost to play and visually see their AI objectives via a little node that travels infront of the ghost's body. As you probably know, each ghost had their own AI objective and behavior in the original arcade Pac-Man. While their movement's appeared random, they were actually not, and you could exploit each ghost's "weakness" to win.

I could of swore in the original Pacman the blue ghost will flee when confronted and there's a path for him to escape into.. Which would explain "Bashful"s name (and Japanese name which translates to Fickle).

Only if red Shadow is behind pac-man. Bashful targets the location (pacman + (pacman - shadow))

The AI's out there apparently. I've heard Marcin Wichary, explain that he reproduced the AI in JavaScript when he built the Google doodle.

I think it's in this video: http://www.youtube.com/watch?v=ttavBa4giPc

I've been receiving complaints about this from multiple people. To my knowledge, the safe spot only works because the ghosts can't go up from the passage below it. It's hard to isolate this bug unless I get a play-by-play or video to compare with the original.

I've uploaded a fix, so it's working now. Thanks for the feedback.

Excellent, I like it. Coincidentally I just read the Pac-Man dossier this morning[0]. An excellent resource on how the AI and overall game works. Might be a good way to get the AI a bit more accurate.


Uncompiled source code is available here: https://github.com/shaunew/Pac-Man/

The term "source code" implies that no compilation has occurred /nit

I'll nitpick right back at you: since JavaScript is not compiled in the software sense, I could only mean compile in the sense of "produce (something, esp. a list, report, or book) by assembling information collected from other sources: the local authority must compile a list of taxpayers."


Is it therefore accurate to say that the uncompiled source code is compiled in https://github.com/shaunew/Pac-Man/?

Touché. I guess so :)

Nicely done. I presume there is no sound? I have also seen this done in an Excel spreadsheet with very realistic game-play and sound.

Thank you for making the controls work right. Most remakes I've seen won't register a turn if you press the button early, which makes it almost impossible to play at higher speeds.

The creator of this remake gave a talk on it at the houston.js meetup this week. I was thoroughly impressed with how much effort and thought he's put into this project. He said that the Pac-Man dossier was his inspiration and seems to genuinely love the game.

For those of you who have criticisms about the game's accuracy, I suggest that you submit a new issue to his github repo: https://github.com/shaunew/Pac-Man/issues. That's what open source is all about, right?

No — open source is about you being able to take the code and do pretty much whatever you want with it.

Being able to report issues is entirely orthogonal to that. Lots of non-open source projects accept such reports, and releasing something as open source does not carry any implicit promise that the author will pay any attention to such reports.

I like how the learn mode lets you see the AI algorithms and the practice mode lets you rewind. It's like Braid for PacMan. Pretty fun. It'd be interesting to play as the ghosts and see if you can write simple algorithms for a ghost team to capture pacman.

Looks very nice. My only complaint is that all the JavaScript code is in one file, which makes it a bit harder to casually peruse (I was curious how you implemented the ghosts' AI).

You can see the whole source here : https://github.com/shaunew/Pac-Man/tree/gh-pages/src

I wonder how he compiles these files into one though ? THis is the main drawback of javascript to me at the moment : having to write everything in one big file.

Looking at the code, I'm pretty sure the contents of each file is just dropped into an IIFE. A pretty simple Ruby script would take care of this.

What a marvelous piece of work done in explaining different aspects of the game, specially the level generation. And awesome remake :D

Also its really helpful for game programmers to learn from.

Accurate enough to also include the level 256 bug?


@anonova that's what i was thinking!!! i skimmed the code but couldnt tell if they included the infamous "kill screen" bug. i was never good enough to ever reach that level in the original arcade version, but my best friend's older brother was: Pac-Man’s Kill Screen – Level 256 [video] http://www.methodshop.com/2012/08/pacman-kill-screen.shtml

I'm impressed with how well it works with touch input.

Works on the iPad and works well

Having recently watched King of Kong (http://www.imdb.com/title/tt0923752/) I highly doubt the accuracy of these "remakes".

I probably phrased this incorrectly, hence the downvotes. These arcade machines have specific timers, odd hardware characteristics, hard memory limits, etc, that are likely impossible to replicate in software accurately - in addition to the software algorythms they use.

In king of kong, you will hear how a blob of solder in the right location will change the characteristics of the game to invalidate the entry for world record status.

Simply looking at the framerate counter at the bottom you can see that this isn't in any way "accurate". By looking at the github repo, you can even see the author has written about some of the inaccuracies - timing, collision detection, randomization, and bugs.

Hi, I'm the author. The framerate you see at the bottom right corner only indicates how often it is drawn. The game loop is actually sophisticated enough to keep the game updating at a solid 60Hz like the original, so the speeds are accurate because of that.

I feel like I hammered out the most of the critical inaccuracies, and I left out the original bugs because I found it preferable.

You've done a great job, and I am in no way intending to be critical. My only concern was the claim of accuracy. It is an outstanding simulation of the original, and I commend you for your work on it.

However, leaving out the bugs, for example, makes it not accurate. As for the timer, I don't see how you could guarantee the frequency in a javascript VM. It could be similar (by continually testing how inaccurate it is and adjusting the frequency of subsequent iterations), granted, but this is not accuracy (it is emulation). As for memory, etc, many of these older games had "death screens" where a buffer overflows and simple crashes the game, preventing you from continuing past a certain point - that too would be very difficult to accurately model in javascript. The list could go on and on. And this is in no way critical of you, or what you have done - it is simply statement of fact about accuracy!

As an aside, Billy Mitchell (the first person to ever get a perfect pacman score) was one of the stars in the movie The King of Kong.

Again, I think what you have done is AWESOME. But it is not accurate (and likely could not be).

Urghhh... I wish i'd never posted anything now :(

no, not a problem. i am agreeing with you now. curious, what should i call it instead? perhaps, faithful? or near-perfect?

I have no idea, im afraid. I like the thought of an "ambitious reproduction", but "awesome" works just as well :)

This is awesome, but he should support WASD too.

how abt porting it android? using trigger.io!! i guess it would be super cool.

The firefox beta on android runs the game really well.

Works nice on my Nexus7

Very impressive!

Menus broken on galaxy nexus of touch Browser. When I tap on a menu item, the tap registers twice, including whatever occupies the same position on the next menu. Example: Quit - No, which loops back to the game. Also, Credits.

Thanks for the detailed bug report. I resolved the issue by adding a 200ms delay after a button press.

Thanks, I'll add a delay to prevent that.

Speed it up please. The arcade version is much faster. This is plays really slow. I think the pac man should move at least 25% faster.

I've compared the speeds, and they're accurate. If you're talking about the fast mode in some arcade machines, you can try "play turbo" which emulates that.

Registration is open for Startup School 2019. Classes start July 22nd.

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