

Portal’s physics engine rebuilt in 25KB—on a graphing calculator - username3
http://arstechnica.com/gadgets/2012/12/portals-physics-engine-rebuilt-in-50kb-on-a-graphing-calculator/

======
Jach
Not quite--this is more a recreation of the Flash Portal clone. i.e. it's all
2D graphics and 2D physics.

I got my hopes up for a moment, preparing to be awestruck. Since I have a
TI-89, that's what I think of when I hear "graphing calculator". My TI-89 can
do 3D stuff (for instance this fun maze generator game
<http://www.ticalc.org/pub/89/asm/games/amaz89.zip>), it would blow my mind to
have anything close to a Portal 3D engine on it.

It's still awesome but not as mindblowing as the title suggests...

~~~
tertet
It would not be that hard to write a 3D physics engine for a TI-89 calculator
(Assuming you already know how to write a 3D physics engine, which I do).
Problem is, it would be useless since it will probably take tens of seconds
(if not more) to calculate each frame.

~~~
jlgreco
I would not be so sure. It really all depends on how much physics you want
your "physics engine" to have. Rag-dolls? Not likely. Quake 1? Sure, you could
do physics to that extent on an 89. The 89's are more powerful than you may
suspect, unlike the 84 (seen in the article), they have Motorola 68k's.

Here is an idea of what you can do with a 84's Zilog z80 (warning: long
animated gif):
[http://benryves.com/images/nostromo/bsp/2010.11.28/Walkthrou...](http://benryves.com/images/nostromo/bsp/2010.11.28/Walkthrough.gif)

(corresponding blog entry: <http://benryves.com/journal/3739423>)

You can get a lot more out of an M68k. (Actually, to be fair, the M68k
calculators' larger screen size works against them, but if you are willing to
sacrifice graphics you can easily surpass that demo.)

~~~
gipsies
I remember playing a lot with my old TI-83. One of the most impressive games
was DOOM: <http://www.ticalc.org/archives/files/fileinfo/238/23843.html> Best
video I can find: <https://www.youtube.com/watch?v=TuupoxmeQ6U>

Unfortunately I never had a TI-89. Would've been awesome if I had one back in
the day, and then test these games:
<http://www.ticalc.org/archives/files/fileinfo/405/40593.html> and
<http://www.ticalc.org/archives/files/fileinfo/323/32318.html>

~~~
jlgreco
Ah yeah, good stuff. I was always partial to Gemini and Wolf on the 83+
(<http://www.ticalc.org/archives/files/fileinfo/247/24742.html>,
<http://www.ticalc.org/archives/files/fileinfo/277/27767.html>). Wolf even had
an on-calculator level editor!

~~~
ANTSANTS
Gemini blew the socks off of all my middle school friends, but I'm embarrassed
by the amount of time I spent on Galaxian in math class. Maybe one of these
days, I'll dig out my 83+ and complete the no laser, no death run that I was
always aiming for, just for old time's sake.

In hindsight, I wish I had spent that time learning Z80 instead...

------
geori
The memory limitations are a bitch. It isn't that difficult to build your
engine in that amount of space, but storing any decent graphics or level maps
are nigh impossible. I had to quit working on a Zelda clone and JRPG because
of memory issues. To this day, I've only seen one long game actually worth a
crap and that's Joltima -
<http://www.ticalc.org/archives/files/fileinfo/34/3456.html> Karneges had to
use every trick in the book (huffman compression on 4 bit tilemaps) to fit it
into 32K of RAM.

Still, it's impressive to do anything like Portal on the calculator. Glad that
someone picked it up, even if the headlines are sensational.

~~~
loeg
You can absolutely page in data from Flash memory as needed, it's just non-
trivial (and not handled by the "OS"). On devices with flash memory as an
extension of RAM (TI 83+, 89, and 89 titanium), this could help for read-only
level data that isn't needed all of the time.

Edit: Of course, Joltima targets the TI-83 (different from the 83+), which
doesn't have any flash memory. Bravo, Justin Karneges.

~~~
jlgreco
You can also go the "App" route and make the whole thing an application that
runs straight from flash.

Advantages are you can use many flash pages so your application can be
massive, and your program will be easier to launch/distribute. We have the App
signing keys so these days this route is pretty simple.

On the other hand you have to "allocate" ram to write to or scrounge for ram
in predetermined areas in the address space. With regular assembly programs
you can have "static" allocations that you can write to. Also programs don't
take up a minimum of a single page, so they are generally preferred by people
who are more comfortable with their calculator.

Damn, now I really want to revisit that z80 scheme implementation I was
working on a few years ago...

~~~
geori
Paging really, really sucks to manage on a TI calculator.

That being said, I loved working with the 32KB limit and optimizing every
single byte out of my code. You got to learn all of the tricks like "XOR A" =
1 byte vs "LD A,0" = 2 bytes. However, some things sucked, like having to
frequently write new sprite routines or tilemap scroller routines. I even
ended up writing a logo style scripting language to handle animations in a RPG
just to save a few KB.

Yes, this is clearly the 3% case for Knuth's quote, "... 97% of the time:
premature optimization is the root of all evil"

------
fatjokes
> While programming for graphing calculators admittedly doesn’t give
> Marcolina’s work a wide reach

Are they joking? Those TI 83's will be used by high school students in the
US/Canada as long as TI has this chokehold on schools. They've outlasted god-
knows how many versions of Mac's, PC's, Nintendos, Xboxes, PS's.

~~~
Evbn
How is the TI-83 still a thing? iPod is superior in every way: CPU display
size and color, flexibility, cost (well, if they produced a last-gen version
for the down market, it would be)

~~~
bcoates
Battery life. Durability.

Also, don't underestimate the value of a UI and hardware keyboard centered
around a specific workflow. Calculators are almost the opposite of a
tablet/phone, computers specialized to programming and user input, with
communication and content consumption as an afterthought at most.

------
ionforce
That is an excessively sensationalist headline. Portal, physics and graphics-
wise, does way more than that graphing calculator.

To imply that they are equivalent is shameful and ignorant.

~~~
vacri
I don't see any claims of recreating Portal's graphics. I think yours is an
excessively sensationalist criticism.

~~~
peterhajas
Claiming to recreate the physics engine implies that somebody remade the
Source engine on a calculator. This is a massive exaggeration.

~~~
vacri
The title says 'in 25kb on a graphing calculator'. The only way it's "amazing"
is if you know what a graphing calculator is, and if you know that, then it's
pretty obvious that the title is a mild form of poetic license rather than a
sensationalist attempt to mislead. And really, when people think of "Portal
physics", for the most part they think of 'a hole between two non-adjacent
surfaces you can travel through', not 'a realistic 3D world where objects
behave according to newtonian physics', because the latter is a dime a dozen.

Honestly, how many people who know what a graphic calculator was would
_seriously_ think that they "remade the Source engine", misled by the
'sensationalist' title?

~~~
Evbn
The technically fascinating aspect of implementing narbuncular/portal physics
is the optics of looking into a portal, not the trivial translation/rotation
of passing through a portal in a platformer sideview.

------
oellegaard
Awesome! Too bad I gave my TI84 to some girl, after leaving college :(

------
meaty
I have doom on my TI Nspire CAS :) Unfortunately the crappy screen is no good
for playing it.

I've seen all sorts of hacks like this over the years but to be honest, I've
fallen in love with the HP50g for hackability. The thing is awesome.

Not sure if its just me but I seem to accumulate calculators.

------
TommyDANGerous
Watching that demo on the calculator makes me want to play Portal.

------
NanoWar
Wow that is so awesome. It's running on 6Mhz after all!

------
hnruss
TI-83+ was my only hand-held programming system. In high school, I wrote
Blackjack, Trapshoot, and a Whac-a-mole clone on it, along with a few
originals. I hope that touchdevelop takes off-- it might be the only reason
I'd get a tablet.

------
stickdick
Not quite...

------
rheide
It's an awesome achievement, worthy of geek praise. But even if I'm being very
generous I wouldn't call this a physics engine.

~~~
NanoWar
There is however another approach by the same guy. Called Zedd Physics
Library: <http://www.ticalc.org/archives/files/fileinfo/441/44185.html>

------
jiggy2011
This looks more like a standard 2d platformer.

------
senorcastro
The graphics are terrible.

~~~
jlgreco
It's a 96x64 B/W screen.

~~~
JackWebbHeller
I think that's the joke...

~~~
jlgreco
Ah. People here are being rather negative so I took it as a sincere criticism.

------
Evbn
More like Portal: Flash Version 2D

<http://portal.wecreatestuff.com/>

Weird that this portal-dedicated person and Are Technica hadn't heard of
Portal 2D.

------
yozmsn
Oh how I wish I still had a usb-TI83 cable, still have the calculator just not
the cord to plug it into my computer...

~~~
ygra
This one? <http://www.amazon.com/☺/dp/B00006BXBS>

~~~
andrewcooke
ok, i have to ask - how do you get smiley-face amazon urls?

[update: huh, so it can be arbitrary text. what's it for?]

~~~
ygra
I didn't want the original (very long) URL which included the product name at
that place (the technical term might be SEO-friendly URLs). So I first
replaced it by an underscore to keep it short and then tried whether I can put
something nicer in there. This wasn't generated by Amazon ☺

