Archive for the 'Coding' Category

Heading Off to College with The Monolith

Friday, August 6th, 2010

It’s official: I’m registered for classes at the University of Michigan and I move into the dorms August 31st. Although I’m excited to learn more, go onto another stage of life, and experience what college has to offer, this summer has been excellent, and if I could repeat it or just sections of it I gladly would. I’m rather scared to move on; I think I will be able to handle the independence, though it will surely take time to get used to it. Most of all, I feel going off to college will mean saying goodbye – the phone just isn’t the same as being in the same room.

My cat died – our guess is either a seizure or a stroke. It was very sudden, and marks my second pet to die unexpectedly and swiftly. I’m glad that at least she didn’t suffer long. In a few hours my knowledge went from “your cat is sick and at the vet” to “your cat is dead.” I was shocked. By this point I’m okay, though.

As a graduation present, I built a $1,500 desktop and upgraded to a widescreen LCD.

Phenom II x 4 @ 3.4GHz

8GB DDR3 RAM

1.5 TB HDD

ATI Radeon HD 5770 1GB GDDR5

It runs incredibly smoothly. The bottleneck is of course the hard drive. I’d have gone for an SSD if they were reasonably priced, but that day has yet to come.

I’m enjoying my internship at IDV. I’ve gotten to look at both the sysadmin and developer side of things. There’s quite a learning curve to coming up to speed with a new codebase, but I got it. Coding requires long bouts of focus, while sysadminning can be more intense, but frequently stopped by waiting for the computer to complete some semiautomated process. I’ve also done more work on Cavez of Phear.

Keep on keepin’ on

Friday, June 18th, 2010

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.

Even More Progress

Monday, May 17th, 2010

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

Tuesday, May 11th, 2010

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.

Found it…

Sunday, November 8th, 2009

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.

Essay and More

Wednesday, November 4th, 2009

The first draft of this is dated October 18th, so many things in it are now dated, but here goes.

I’ve been thoroughly shaken by an essay question on a college application. Not that it’s a difficult question or anything.

Tell us about a time you used your creativity.

It should be easy enough. The problem is I’m having trouble thinking of recent uses of my creativity. I haven’t made any new Flash movies since 8th grade, although perhaps that’s for the better. They’re becoming increasingly embarrassing now. I made some comics Freshman and Junior year, but thaose were both for literature projects. I started making a 3D maze the last time I went to Camp CAEN, but that was the summer before last, and I stopped after I ran into an issue with sound under Linux in Zenilib. Writing about it makes me want to try picking it up again, but finding the time to do so will be difficult. It seems I have somewhat inadvertently found ways of being unproductive that are not obviously so, such as browsing Reddit instead of playing TF2. That’s not to say I’m not working hard, which I am.

My Dad’s Rosewill fan failed suddenly by making horrible grinding noises. Although PCI slot fans seem like a good idea, they might be too much trouble to be worth it. I’ll probably stay away from PCI slot fans for the time being.

Because I’ve had so much homework, namely in Precalculus, schoolwork has displaced my life somewhat. Synthetic division is nice because of the very predictable amount of space it takes up, and it’s oddly fun to multiply together factors to get a polynomial with the desired zeros. It’s making the math work to make something, rather than the other way around. It’s also strangely entertaining to factor in my head.

Thanks to this page I was able to figure out an otherwise extremely cryptic error in my crontab. It was in the line for server backups to the alarm upstairs. It’s not offsite, but at least it’s not in the same room. I also got GZIP compression working, with the assistance of these pages. To boil it down, the magic line is ob_start("ob_gzhandler");

I recently downloaded Cavez of Phear and it was fun. However, the lack of save functionality made it frustrating, as I had to continually replay levels after dying. As it is open source, and I had compiled it, (requires libncurses-dev) I decided to crack open the code and give it a go. With the very low number of comments it is somewhat difficult to read. It seems that once it loads in a level file made of of low-level, unprintable ASCII, it replaces special objects with the stone character, and makes entries in another array. I have yet to figure out why it needs another array for this. I’m also currently mystified as to why the save function (I didn’t write it, it works in the editor,) produces complete gibberish even right after I load the map and haven’t moved. It still does this when I undo the replacement of special items. I’ll probably have to rip chunks out of the program until it’s more evident. I really should try gdb. Maybe I should start a Git repo to make all this easier to manage, as although my memory is fuzzy on the matter I think I had parts of this working better before.

Despite my problems figuring this out, it is meaningful for me because although I’ve long known philosophically and logically that open source is far better for innovation and rapid development, I’ve never been able to directly participate in helping that process. (I’ve donated to and reported bugs for Wine, but that’s about it.) Even though it is a very simple contribution, it’s something that with a closed-source product would take emailing the developer or doing some strange dark arts with DLLs. With open source, I am able to open up the code and start to add a new feature. This is amazing.

I got my plate of food together and left it in the kitchen. Asking my sister to guard it against cats, I took my salad and milk out to the table. I returned for my plate, and noticed the empty one intended for Sarah sitting on the counter as Sarah held a full plate. I asked her if the plate was mine. No, she mumbled around the ham.

Matt called me over and asked if I wanted his old machine. He said it had stability problems. I’m now agreeing with that, as when I tried to connect to it just now to check the specs, it was unreachable. What I can remember is Athlon 39(?)00+ 3700+ at 2.4 GHz with 512MB RAM. It seemed stable at first… Maybe I should check the BIOS settings again, as I seem to recall it complaining about failed overclock upon POST.

Sick

Sunday, September 20th, 2009

My nose is congested and I was sneezing yesterday. I got up around 2am because I was having trouble sleeping. I think taking Psych is messing with me, as I to some degree harbor irrational fears that I exhibit symptoms of whatever mental disorder we covered last. It’s a really interesting class. If I had more time I’d gladly upgrade to AP. The current Psych assignment is annoying to me, as the podcasts we have to describe a study from seem to discuss a phenomenon in broad terms rather than talking about a specific study. I found an interesting article on conditional love.

I read about Steve Roberts, who seems interesting.

School has been overwhelming. I’m taking two APs: AP Computer Science, which teaches Java, and AP English Literature. AP Computer Science is at least currently pretty easy, as it apparently assumes no coding experience, which I find strange for an AP course. I wonder if it might be improved through an entrance exam and skipping the easier stuff, with the intro being instead in the existing Intro to AP Computer Science? As I haven’t coded Java before, although it is very similar in syntax to C++, it might be good that the class starts out lower-level.

One of the things I find about coding is that I seem to be unable, on my own, to think of reasons to program. My current line of thought is that simple games might be boring: they’re simple and will probably be clones of Pong or Tetris or something. When we actually wrote simple games in Advanced C++ Game Development at CAEN in 2008, (I didn’t go back last summer; they took away the dorm option so we didn’t get to spend evenings on our own machines.) it ended up being fun anyway. It could be fun to rewrite my maze game… The next problem I have in this is that I don’t have much free time with my current class load, so I’d have to sacrifice browsing reddit or something. At least it would be more productive, and perhaps more educational. Qualifying many of my statements seems to make my writing more verbose… (See! I did it again!)

AP English is satisfyingly rigorous, and I have by no means been able to complain that we aren’t doing enough. I’m going to a University of Michigan campus visitation over today and Monday, and I’m going to bring Hamlet and attempt to annotate during downtime; Act I Scenes 1-3 are due Tuesday.

I am told Computational Physics is equivalent to an AP, although it doesn’t seem bad at all in contrast to APE or Precalc. Relativity is really interesting, and the equations aren’t bad; it’s the logic I usually get tripped up on. That’s not to say my algebra never utterly fails. I really like Olstad. His website is very impressive. He is very careful about definitions, and on the first day (or so?) we discussed the differences between schooling, training, and education. After listening to our definitions, Olstad defined schooling as what goes on at school, training as specialized refinement of skills, and education as longer-term outlook for learning. He frequently calls schooling “the game,” (which makes Irfan lose often) and not the point of being there; I find this appealing. He also likes semicolons, calling them yield signs. This has influenced my semicolon use in this post. I’m not sure whether I’m overusing them.

Precalc and AP English give the majority of my homework. Precalc assigns homework consistently, even when the Seniors are gone, as I have learned the hard way. Now that I’m aware of that, hopefully I will manage things better. Pline has an evil genius chair, and I have yet to determine why.