
Accurate remake of Pac-Man in JavaScript - vacipr
http://shaunew.github.com/Pac-Man/
======
Jach
<http://news.ycombinator.com/item?id=4431197>

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> "

~~~
tylerneylon
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.

~~~
wamatt
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.

------
gpcz
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.

~~~
jrockway
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.)

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

------
city41
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.

[0]<http://home.comcast.net/~jpittman2/pacman/pacmandossier.html>

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

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

~~~
Timothee
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."

;-)

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

~~~
Timothee
Touché. I guess so :)

------
SeanDav
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.

------
kd5bjo
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.

------
pgambling
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?

~~~
salvadors
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.

------
iamwil
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.

------
rkaplan
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).

~~~
cocoflunchy
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.

~~~
prophetjohn
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.

------
chinchang
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.

------
anonova
Accurate enough to also include the level 256 bug?

<http://en.wikipedia.org/wiki/Pac-Man#Split-screen>

~~~
accarrino
@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>

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

------
emehrkay
Works on the iPad and works well

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

~~~
heykoo
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.

~~~
undershirt
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.

~~~
heykoo
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 :(

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

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

------
arasmussen
This is awesome, but he should support WASD too.

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

~~~
undershirt
The firefox beta on android runs the game really well.

------
DonnyV
Works nice on my Nexus7

------
sunjain
Very impressive!

------
Evbn
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.

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

------
wilfra
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.

~~~
undershirt
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.

