Keep on keepin’ on

Date written: June 18th, 2010 Catagory: Coding, Hardware, Life

My social life is shifting away from these precious tubes of ours in many ways. Being within walking distance of places I would actually want to go really helps. I find it far more fulfilling to talk face-to-face with people, and the Internet, Reddit in particular, seems to just fill that void with funny captioned pictures and the occasional interesting article. I’ve been keeping a journal of sorts and that’s proven enjoyable. The freedom that the summer and my parents give me is fantastic.

I have an internship at IDV and it’s interesting. I am happy to report that when actually coding, such as in C#, much less so in configuration files, programming techniques are generally applicable. It’s nice after floundering around to have little sections of activity where I actually feel like I know what’s going on.

As a graduation present I’m putting together a monster gaming rig. I was very happy to be notified that this would happen. Once I get the parts and snapped together ordered I’ll put together a writeup on the build.  I’m looking forward to it.

Sound Modification and Logic Games

Date written: May 23rd, 2010 Catagory: Software

I found a sound tool that’s interesting. I built the SVN version, and while following the Install From Source page I ran into two problems: my ffmpeg wasn’t compiled with –enable-libmp3lame, which apparently resulted in 0-byte output, and I didn’t realize the ‘where ffmpeg’ part of the link was meant for me to fill in, although in retrospect I feel silly. If people are interested in a more in-depth tale I can put together a guide for getting it running under Debian/Ubuntu.

I also discovered via Reddit an interesting logic game called Manufactoria. My sense is that it takes a rather strange type of individual to enjoy it. My complaint is that the music is quiet and the mute button doesn’t actually stop it.

Even More Progress

Date written: May 17th, 2010 Catagory: Coding

I’ve made big changes to Cavez of Phear!

Because most terminal windows default to 80×24, it now fits in that space. There is no longer a lives system because it was only frustrating and didn’t add anything to the gameplay. A game should not be difficult through starting over again if you make too many mistakes. With the saves and without the lives, it allows for focus on the puzzles. Upon death, the savefile will load if it’s of the same level. I recoded the key bindings to be cleaner, and it now supports multiple keys for a single command. Sortie made very nice tutorial levels.

The editor is much improved and can now place bombs in addition to bomb packs, apply physics to a level, and make changes in rectangles and whole-level fills in addition to single points.  It also is more flexible in opening and saving files. I also fixed the persistent and seemingly vague problem that it sometimes required multiple keypresses to get back to the main menu. It ended up being caused by recursive calls to main_loop(). There’s now yet another while(true) in the main loop that gets break;‘d out of for it to go back to the beginning and load a level or save as needed. I greatly improved the screen dissolve function – it only writes to each position once, and is guaranteed to cover every location in 1840 writes. I fill an array with all possible positions, perform a Fisher-Yates shuffle on it, then iterate over the array, writing spaces. Writing the shuffle algorithm was interesting. The previous one did overwrite – it was pure rand() – and took 10000 writes, which led to horrid performance over SSH, and it wasn’t even guaranteed to clear everything. In general I’ve tried to improve the UI – the reaper on the main menu only comes in from the left on the first run, after which the menu comes up without pause. I’ve cleaned up a lot of code, but there remains is_ready(), which Sortie tells me has something to do with asynchronous file operations, and do_the_monster_dance(), which I’ve been avoiding because it looks messy.

In playtests I’ve had trouble with people getting confused because they don’t read the directions. I’m resisting making big boxes proclaiming what the controls are because I’m assuming players are intelligent, and so far they’ve managed to figure it out. I got embarrassed when I didn’t realize which commits had gone through and made an inaccurate, duplicate commit. I’m worried that I might get caught up in a never-ending parade of new features and not stop long enough to add more levels. I suppose with all the improvements to the editor it’ll be much easier.

Next on the list of feature additions is support for level packs, cleaning up the level code by actually reading the directory instead of relying on a #define, figuring out why the game spontaneously quits on some keypresses and freezes on Ctrl-S, and perhaps reimplementing the menus in light of the knowledge that ncurses has menu functionality.

If you’d like to try it out, either grab PuTTY and ask me for a shell account, or download the source, compile it yourself, (requires ncurses) and have fun!

EDIT: I like to think that my desk’s keyboard platform is falling off because I coded so hard all day and it couldn’t take the greatness. The friggin’ monitor is hot!

Progress

Date written: May 11th, 2010 Catagory: Coding, School

Nine school days until seniors leave! Both my APs are now what amounts to study hours now that testing is over. It’s nice. Comp Physics created some quality quotes yesterday:

“Light pours forth from your rear and keeps you from falling through your chair.” (In reference to photons, the electromagnetic force boson behind most Newtonian forces.)

“We call it the ‘Ultrapurple.’” (Ultraviolet)

I’m working more on Cavez of Phear. The save file format is now one file, the code has been further cleaned up, (Mostly eliminating copy-paste) and I’m working on adding features to the editor. I had some problems with not closing file pointers initially, which caused very strange behavior until I realized what I had forgotten. If anyone wants look at the github repo, it’s here.

Update

Date written: April 3rd, 2010 Catagory: Site Related

The power outage made for a very interesting problem. I had inadvertently broken PHP by turning on compression in php.ini when apparently I wasn’t supposed to. This was back when I was trying to get the WordPress compression working. I didn’t know PHP’s configuration wasn’t working until the server was forced to reboot due to the power outage. The initial problem was that the server was not set to turn back on automatically after power loss, which I had set intentionally fearing damage if it attempted to turn on during a brownout, but perhaps I should enable that ability. Even once it turned on, after a fsck (over 330 or so days of uptime I think) it hanged on setting the clock and needed a hard reboot, which necessitated that I go over to the server physically and reboot it. Before this I set the DNS entries to my dad’s house so that I could display an explanation of what had happened, and I changed my password for my DNS service as it had gone too long without being reset, and subsequently forgot to correct it in the call to the update script. I managed to get the DNS fixed, then I found PHP was broken, then in the course of my attempts to fix that, lighttpd refused to start at all. I was unaware that I could only declare one error.log, so it appeared that it was not giving any error output, but it was writing to the last error log I had declared, and I was checking the wrong one. Thanks to incredible help from the folk in #lighttpd on freenode, it’s working again.

In other events, I set up Skype on my Grandma’s machine, and I hope she finds it useful. I’ve been working on Breakout in AP Comp Sci and physics collision is interesting, but I think if I end up making a game I’ll be using a physics library for sure. MIT didn’t accept me, as I anticipated. I’ll be going to University of Michigan, but I still have work to do and forms to fill out on the way.

New Machines!

Date written: February 14th, 2010 Catagory: Hardware

My dad’s work got new computers, and instead of throwing them all out, I got two.

Pentium 4 @ 3GHz with HyperThreading

3 GB DDR 533 MHz

160GB HDD

I’m moving my graphics, sound, and Gigabit Ethernet card over to one of them, which is my new desktop. It’s not true dual core, but the clock speed increase alone is enough to warrant a move. I don’t have Windows on it yet, and I intend to get Windows 7 if my dad’s work isn’t able to loan me a CD to reinstall XP. Hopefully this machine will be able to handle Assassin’s Creed without stuttering. I plan to remove my 1.5TB external from its enclosure and mount it internally over SATA. That should fix the horrible latency and throughput issues I’ve had over USB. The other machine I have working as a Freenet node. I’m using full-disk encryption on both machines, and it’s cool. There doesn’t seem to be a drastic hit to performance, as I feared. The only issue is my own fault: I almost forgot the encryption passphrases, and actually forgot the root password on the Debian box. I remembered it, though.

The machines run fairly hot. I now have a mouse-hand heater. That doesn’t seem good. The room is warm, too, and I’m not sure how much of that is due to the sun, and how much is due to the three computers. My network architecture confused me by doing exactly what I told it to do. I set up static DHCP mappings based on MAC address, then DNS entries based on those IPs. This allows me to ping dad.asksteved.com and have it resolve locally to my dad’s machine. It didn’t occur to me as I moved my Gigabit card from my old box to this new one that the IP and DNS entry would follow. It took me a while to realize I was trying to log into myself, which was why the key wasn’t matching. It was pretty funny. The old box is going to work on MilkyWay@Home. My next step is getting the requisite power strips and Ethernet cords to put the two non-desktop machines in the closet. One of them could run the alarm songs in the morning so that I don’t have to keep my desktop on at night.

Homework’s going well. I have a small amount of additional Precalc studying possible, then AP English. Comp Physics is done.

Life Is Being Overwhelming

Date written: January 26th, 2010 Catagory: Life

Finals went well. I have an A now in all classes except for Precalc, in which I have an A-. This is despite getting 97.5% on the Precalc final. Oh well.

It seems I’m trying to do too much between school, homework, robotics, and the oddly involuntary Reddit. I doubt I’ll be able to get enough time for NHS and I may have to quit. That’s too bad, but there’s not much I can do about it. I wonder if in college I will have the same problems with time management. I’m looking forward to college, as I hope to have additional freedoms there, including philosophical discussion, which Morrison tells us is present late at night on college campuses. That might have been replaced with our lovely Intertubes by now, but I hope not. Freedom includes what I see Pat doing, for example, which is getting up at 10 and trudging off to classes at 2. That said, additional freedom also means additional responsibility. As far as I can see, this means I will need to make sure on my own that I get up and make it to classes on time, not get locked outside of my room, and avoid ill-advised parties. That shouldn’t be a problem if I’m able to earn enough ISK to feed my EVE subscription. I’m unclear on how much I will need to buy and how much the magical Umich (How is that capitalized?) card will provide to me. Responsibility has an upside: if I have more responsibility for my surroundings that means I’ll have more power over them. The practical implication of this is that I will no longer be surrounded by piles of things that aren’t mine that I can’t move. I like minimal surroundings, and take pride in the fact that the contents of my tabletop and drawers, with the exception of clothing and a desk lamp, fit in a “small” packing box. I should mention the computer is on the desk, not the table, and furniture is not included. Still, I see it as an accomplishments of sorts. I have managed to avoid excess clutter to an extent. That said, most of the box in question is still unpacked. Perhaps I should throw it out (or recycle it; if I recall correctly it’s mostly paper) as I evidently have no need for it.

Wow, this is turning out to be quite stream-of-conciousness. I hope, gentle reader, that you are able to keep up with my rambling.

Although I still hold on to the hope that my new second semester classes will be interesting, my initial impressions are not very good. I like both teachers as people, but I do not think they have good teaching abilities.

Mr. Olstad should create a video series on how to teach properly.

Synergy+

Date written: December 28th, 2009 Catagory: Life, Software

I found Synergy+! I have a Linux box set up next to my Windows one now, and I can slide my cursor between the monitors of the different machines, and control both with one keyboard and mouse! The Windows machine runs the server. I’m using a stereo Y-cable to connect both machines to the speakers. I’m concerned that it might not be good to connect two sound outputs to the same cable, although there are speakers so it’s not directly between outputs… I really need to learn about electricity!

Synergy+ was surprisingly easy to set up, and following the directions worked without issue. I set up sshd on the server using Cygwin by running ssh-host-config and following the instructions. Running ssh-keygen got me my RSA key for the client, which I copied into ~/.ssh/authorized_keys in Cygwin so that I could have passwordless login. With passwordless login, I was able to add the creation of an SSH tunnel alongside synergyc localhost.  (localhost so that it uses the tunnel.) I also have the server running as a system service.

The end result is that Synergy+ is automatically started and securely tunneled. It’s pretty fun. Perhaps next in my string of projects will be setting the second monitor up on a monitor switch so that I can change between dual-monitor on one machine and one monitor each.

At the end of this break I will have attended no less than five Christmas parties. Too much travel!

EDIT: After accidentally closing Firefox on my left screen by attempting to open a menu on the far left of my right screen, I realized I could start the transfer range between screens at 5% and end it at 95%, making a part of the top and bottom of the shared edge not transfer. Hooray configuration!

EDIT Jan 17 2010: I now use autossh to make the tunnel persistent. Combined with Synergy+’s ability to retry connections, this makes it a lot easier to keep the machines connected between reboots.

sftp-server

Date written: December 25th, 2009 Catagory: Software

I decided to compile the latest OpenSSH, largely because I can, and partially because I was trying the throughput patch. It didn’t work out too well, which might be due to my aging hardware. I discovered that after removing Debian’s package and compiling and installing OpenSSH from source, I no longer had a running sftp-server. After some investigation, I found that although it was attempting to load the sftp-server subsystem in /etc/ssh/sshd_config, the executable was missing. I copied it from the compilation directory to the directory set in sshd_config, set the permissions, and restarted sshd. It works now!

Found it…

Date written: November 8th, 2009 Catagory: Coding

I figured out the bug. As I had suspected, it was stupidly simple. I was immediately overwriting the saved map with the saved game variables. That explains the mysterious sequence of numbers. I don’t know how I thought that would work: writing, not appending, different information to the same file.

The next problem was that the special object array wasn’t being regenerated correctly. That was another easy problem, as I had simply neglected to make a function call.

I’ve had trouble working from someone else’s code. At least these problems are fixed now, and I like to think I’m getting the hang of it. I’m happy the problem wasn’t a fundamental misunderstanding of C on my part. I still don’t understand why the special object array exists in the first place.

I’ve also added pausing, and plan to work on the difficulty curve, customizable key bindings, a main menu, general code cleanup, and smoothing out the rough edges in the UI.