Posts in category 'hacking'
NethackDS Screenshots
Well, I promised some shots of my Nethack port in action, and I aim to please! Now, I couldn’t figure out how to get my code working with Desmume, so I just gave up and used a camera. You’ll have to forgive the consequent bluriness…
Here we see a newly minted game. On the bottom screen you can see the visible play area. On the top screen you can see the minimap, with a red box representing the displayed region on the lower screen, as well as the player’s status and the welcome message.
This shows the popup command menu. The user holds the L button (eventually this will be swappable, for you lefties) to make the menu popup, at which point the user can tap a command to have it execute. Much nicer than an on-screen keyboard, I think…
And this last shot shows the inventory list after selecting the Inventory command. As you can see, there’s a bit of clipping, but it otherwise works as advertised. If this were a Drop command or something similar, the user would be able to tap items to select them (multiple taps begin counting from 1).
So there you go! See, it’s not vapour after all! Well, not technically, anyway…
Update:
And now key remapping is implemented! This includes handedness swapping (swaps the shoulder buttons), and mapping commands to the joypad and the primary buttons. And the changes are persisted across sessions. Neat, eh?
NetHack + DS -> New Project!
When I first got my DS backup device, it didn’t take me long to track down, and quickly eliminate as impractical, the first, and to my knowledge, only attempt to make a DS NetHack Port. It’s a “port”, in the sense that it really just takes NetHack, shrinks it down, displays the virtually unreadable game on the upper screen, and a graphical keyboard on the bottom screen. Does it work? Sure. But only just barely.
So quite a while back, I decided I wanted to create a port of my own. Much initial hackery was begun, followed by the usual subsequent boredom, followed by the devastating loss of my DS and backup device in an unfortunate incident involving my crappy memory and an airplane seat pocket. The result was a project that languished in my subversion repository until, a few weeks back, my new R4 arrived in the mail which, when pared with the new DS my brother kindly bought me for my birthday, resulted in renewed homebrewing efforts!.
Since then, I’ve made enormous progress. The game is essentially playable right now, and sports:
- A top screen displaying a minimap, status and message display, and input prompt.
- A bottom screen showing the game map in unscaled, scrolling, tile-y glory.
- Support for movement using the joypad, as well as the stylus.
- A popup command list, toggled with the L-button, from which the user may select commands with the stylus.
- Full support for menus, again using the stylus for item selection.
- String input using a virtual keyboard.
- Save/Restore support.
Of course, if it were all roses, I’d release the thing right now. But there are bugs, and a few things on the TODO list, as well:
- Currently wide text is clipped… I’m not sure how to solve this, though.
- The menus should be pageable with the joypad.
- Quitting and saving should return the user to the flash cart menu, or possibly power off the DS.
- It desperately needs a left-handed mode.
- Keys need to be configurable.
And, of course, I need to test test test! I’m primarily worried about memory usage… I think I have most of the issues worked out, and I spent a fair bit of time teleporting around the game in wizard mode, causing general mayhem, and didn’t run across any issues. But I’d like more time with it to make sure the obvious bugs are ironed out.
And even with those problems fixed, I will fully admit that:
- It’s kinda fugly. But it’s fugly the way text-mode nethack is fugly, so it’s kinda charming that way, and
- The text rendering code, particularly for menus, is slow.
But, in short order, I’ll hopefully have a release out. Meanwhile, stay tuned for screenshots… assuming I can get desmume up and running and working with my port. :)
Oh, and BTW, if anyone has thoughts for a name (NethackDS is taken, so I was thinking something like “Nethack Touched!”, or possibly something even more lame, would work), please let me know! Plus, then I’d know if anyone’s bothering to read this thing, anymore. ;)
Running in the Rain - Wetter or Drier?
Well, as anyone living in Edmonton knows, the weather in our area has been, well… rather crappy. Cold, rainy, windy, it feels more like the fall than waning summer. And through it all, I’ve persisted in cycle commuting, mostly because it allows me to justify (excuse) a rather gastronomically decadent lifestyle. Consequently, I’ve found myself caught in more than a few showers over the last few weeks, resulting in much dampness, and, oddly enough, a bit of inspiration.
Now, a favorite show of many folks, myself included, is Mythbusters. They attempt to perform “scientific” experiments to verify or debunk various myths, preconceived notions, and so forth. Now, one of the topics they tackled was: Does moving faster in the rain keep you dry, or get you wetter? Well, in their “experiment”, I seem to recall they found little difference between slow or fast walking, which I found a little surprising, and during a recent bike trip, I found myself pondering how it is they could have found the results they did.
Meanwhile, I’ve also been digging more deeply into the joyous language that is Smalltalk, specifically the Squeak implementation, and a related web application framework called Seaside. However, I’ve been at a loss for a small-scale project to hack up that would allow me to flex my rather atrophed Smalltalk muscles. And so it was that, a couple days ago, while cycling home in the rain, I realized, why not simulate a person walking through a rain storm, and determine whether the Mythbusters results were accurate?
Now, before I get into the details, I should point out this really is pretty non-scientific. I’m sure there are details that I’ve missed which make this simulation completely unrealistic. But, it was fun. :) Now, a bit of explanation about my methodology. First, the simulation is two-dimensional, since I didn’t think the added complexity of doing a full, 3D simulation would generate sufficiently different results. Second, rather than moving my subject through a shower of rain drops at varying speeds, I decided to apply a uniform direction vector to the drops themselves (basically move the drops instead of the subject… the effect is the same, but the implementation is a lot easier). With that said, the experiment is set up as follows (note, these parameters are all configurable, but this is what I chose… they’re entirely arbitrary):
- The rain drop spawn field is 20m by 20m.
- The rain drops are created at a rate of 80 every second, distributed randomly across the top of the spawn field.
- Rain drops fall at the terminal velocity for a typical drop indicated [http://www.grow.arizona.edu/water/raindropvelocity.shtml here] (6.25 m/s).
- The subject is a rectangle approximately 6 feet tall by 6 inches wide.
- The subject’s walking speed varies from 1 to 8 m/s, stepping 0.25 m/s per experiment.
- The subject “walks” a fixed 20m during each experiment.
- Each experiment was repeated 10 times and the results averaged (since rain drops are spawned in random positions).
The final tallies can be seen in the graph below:
Granted, it looks a bit noisy, but the general trend appears to indicate that moving faster through a rain storm helps keep you drier! Though, the advantage does seem to level off (it looks like a roughly exponential decay, to me, with the limit at some non-zero value). Remember that, folks… the weather doesn’t look like it’s going to improve. :(
Incidentally, working on this in Squeak has been quite enjoyable. The richness of the class library made many tasks far easier than they would be in other languages, and the ability to fix bugs as I go, and then continue running the code is, to say the least, incredibly cool. And, frankly, I think Smalltalk is the most elegant programming language I’ve ever worked with. :)
Update:
Found an oversight in my simulation, but the above graph now reflects the latest version. In short, I had to make sure the playfield was populated with raindrops before beginning each walk. Otherwise, the subject could complete the walk before a drop ever fell low enough to hit him!
Update 2:
Woo! I win a gold star!
Distracted
So it turns out that buying a new backup device for my DS has had an extremely detrimental effect on my writing frequency. Actually, it’s worse than that… it’s a combination of a new backup device, with Nethack. Not good.
In particular, I got the idea in my head to take NethackDS and basically rewrite the user interface, to make it more comfortable to use. See, NethackDS takes the simplest approach to a port, making extensive use of an on-screen keyboard and an ultra-small font to provide an experience very similar to Nethack for Unix. However, the interface is far from efficience, and is pretty tough to read, to boot.
And so I took it upon myself to spruce things up. Now, I haven’t gotten very far. In fact, I’ve only just gotten some text on the screen (though this required porting a BDF parser and writing a bit of rendering code), but progress is being made… so, hopefully in a few weeks, I’ll have a fancy new DS port of Nethack to play with.
I’m not sure this is a good thing.