Hacker News new | past | comments | ask | show | jobs | submit login
Portal’s physics engine rebuilt in 25KB—on a graphing calculator (arstechnica.com)
220 points by username3 on Dec 5, 2012 | hide | past | favorite | 49 comments



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


Technically, that's a raycasting engine (a la Doom and Wolf3D). The first implementation that I know of that was made into a game was Daedalus for the TI-85, back in 1997 http://www.ticalc.org/archives/files/fileinfo/11/1147.html


You ain't done nothing till you coded a 3d engine on a HP48 GX: 131x64 pixels and a 4-bit Saturn CPU. The timing tricks to extort four shades of gray from the monochrome screen were awesome.

http://en.wikipedia.org/wiki/Saturn_(microprocessor)


This reminds me of this game for HP48. It had some pretty graphics for the time, using 4-grey colors with LCD timing tricks.

Unfortunately, it also meant the game was heavy (40KB!). And even more unfortunately, some HP48 emulators (most importantly the Android ones) do not support 4-grey graphics, making the game unusable... :(

Note : could find some screenshots here : http://www.hpcalc.org/hp48/games/adventure/sshots/phantasie.... http://i45.servimg.com/u/f45/12/35/12/06/bourg_10.png http://i45.servimg.com/u/f45/12/35/12/06/shop10.png http://img21.xooimage.com/files/5/9/8/hp48sx-city-150-5320fd... http://img24.xooimage.com/files/1/c/a/hp49-50-73x160-40469d....


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.


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

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


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


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!


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


I always find it funny that someone actually ported Fruit Ninja. http://tiwizard.com/downloads/fruit-ninja/

The controls are pretty clever too.


>>http://benryves.com/images/nostromo/bsp/2010.11.28/Walkthrou....

Not bad but it is not a 3D Physics engine. Just a renderer. Not the same thing. Still pretty impressive.


Certainly, I didn't mean to imply it is, just use it as a benchmark against which you can get an idea about what the 84 is actually capable of (the Portal thing isn't really a great demonstration of that).

(It is not in fact even a 3d engine, but rather a vector BSP 2.5D one that is technically similar to Doom. To the extent with Doom has physics (pretty much only momentum (seen prominently in how explosion knock back effects entities) and gravity, so not really) that demo kind of has physics. Actually I don't think he actually does momentum, and his gravity is primitive. He's pushing the calculator pretty hard, I'm not sure how much more you could add, but the 89 can do much better.)

Basically I think you could get something close to this on an 89 (with dramatically worse graphics/graphical abilities): https://github.com/id-Software/Quake/blob/master/QW/client/p...


That's the thing, though. I'd be awestruck to see a Portal 3D physics-like thing on the 89 and be playable, because I'd have no idea how the person pulled it off and as I said above it'd be mindblowing. If you're familiar with physics engines, perhaps you're familiar with how the GBA works at the hardware level and how a game for it is typically made? Super Monkey Ball Jr. is an example of a game that blew me away and I'm still not really sure how they pulled it off.


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.


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.


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


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"


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


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)


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.


You can't lock down an iPod or wipe its memory before a test.


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.


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


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


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?


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.


You don't think that ionforce is over-egging the criticism pudding by throwing in inferred claims about graphics, too?

I find it ironic that such a tactic should be used in a criticism that strongly applies the 'shameful' label.


You're right that it is ironic. It's ironic the same way bigots say that liberals are being intolerant of their beliefs.


You're right in a way. Portal could be thought of as two parts, the raw physics and the raw graphics. But when a lay person makes claims of recreating Portal's secret sauce, they're really implying the portal mechanism which is one part physical and one part graphical.

Literally recreating only the physics portion of Portal would be silly.

And yes I was intentionally trying to be sensationalist back because it's a waste of time being victim to submitter's sensationalist headlines, especially on a technical site such as as this (one would hope).


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


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.


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


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


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.


Not quite...


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.


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


This looks more like a standard 2d platformer.


The graphics are terrible.


It's a 96x64 B/W screen.


I think that's the joke...


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


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.


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



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


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 ☺



Yes, only I'm not spending $20 to play portal on a calculator...




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: