Mr. Emmett

Posted on 2nd May 2011 in Something Daily

I just put my first game up on my website – you can play it with Web Start and download the source. Here’s the link. I just presented this game, which was my Java 101 project, to a current Java 101 class. It was a very good experience having to go over old code of my own and reacquaint myself with it enough to explain it in a manner that made at least a little sense. People in the class didn’t have that many questions, which was not entirely surprising to me. I remember when I was in that class, despite being mostly clueless as to how something like that would be implemented, being unsure of what question to ask due to lack of knowledge, and because of how confident and knowledgeable the presenter seemed. Now I get to be on the other side of it, where I’m the confident and knowledgeable one simply out of experience, and people are asking me questions. It was very nice, and I got to plug my website. All around a great experience, and I hope I get to do more of that.

Having a website that I update regularly is changing the way I use this blog. I used to post everything I did right here, but now I have a series of specialized outlets for all of my work, that have developed as a result of me trying to come up with a good website design. Basically,

  • stuff I draw goes on tumblr
  • music goes on Soundcloud and then embedded here
  • i write here most days
  • websites and everything else that’s worth it get posted to the gallery

That’s the basic breakdown of how I’m handling my online portfolio at this point. It’s changing like crazy, but that’s how it exists right now.

As for how am I doing today, it’s been very hectic and will continue to be hectic. I don’t think I’ve been less motivated to do a Music History paper than I am right now, and it’s due tomorrow. Also I’m recording a concert tonight, and I still have to finish my roommate’s website before I leave for the summer. And of course, all I really want to do is go through this hacking tutorial. But it’s a pretty good day.

Bill Withers and Mice in Java

Posted on 29th April 2011 in Something Daily

The few weeks before finals are never fun. I have way more stuff to be doing than time to do it in, and my desire to be productive is inversely proportional to how nice the weather is. But I think I spend too much time thinking about how much work I should be doing, which generally increases stress instead of decreasing it. Let’s just talk about what’s already done.

I had a long mix session last night for my second project for recording technology class, a cover of Bill Withers’ “Use Me”. The session seemed to go on forever, and I was totally cranky and tired by the end of it, but listening to our mix this morning, it sounds even better to me than it did last night. This is our rough mix, check it out.

Use Me by Raised by Robots

I played the clavinet part (not a real clav, unfortunately) and helped engineer and produce the whole thing. This has been a fun project, and it’s awesome to have another track for my portfolio.

I also was asked to present a project I did for my CS 101 class last year to the current 101 class, to give them ideas and confidence for the upcoming final project. I made this game where your cursor is a mouse and your move around collecting falling cheeses and avoiding mousetraps. Since making it, the laptop that I bring around with me has become an Ubuntu machine, and as a result, certain things I was doing in terms of graphics weren’t working anymore. So I just spent an hour or so fixing my year-old code to work on my new system, and taking a trip back in time as I did so. It’s interesting to look at my own old code and see how my practices have developed. When I finished the mouse game last April, it was throwing multiple NPEs per second as a result of some oversights I made at the time that I didn’t realize would affect performance on some systems. Clearing those up did the trick, though, and now I’ll be presenting my old work to a class of hopeful 101 students. I’m actually really excited, I love the opportunity to share knowledge (and be in a position of some power).

I think I’m going to put up the code for that old mouse game via webstart some time soon. It’s actually really addicting.

Spaceratops Update

Posted on 23rd March 2011 in Something Daily

There were a lot of false starts and many attempts to get Spaceratops up and running properly, as I was just learning how to use Java Web Start this morning. But now, it appears as though you can follow this new, semipermanent link to the launcher. Click the Launch button, open or save the file, and then wait for the download to complete. After the download is done, the game should launch automatically (and you only need to go through the lengthy download process the first time you launch). Also, here’s the slightly updated source code if you care to view it.

As it’s turned out, this project has come right down to the wire. But it appears to be pretty much complete and working right now (knock on wood)(actually that’s an exaggeration, the leaderboard is broken, but I’m working on it). Anyway, have fun playing it in a form that is much more likely to actually work for you. Thanks for reading.

Spaceratops: The Game

Posted on 21st March 2011 in Something Daily

Over the last few months, I’ve been working on a Java game entitled Spaceratops. I started it after finishing CS 101, mainly as a tool to learn object oriented programming. It eventually grew into a project that I envisioned in my head as a grand production in for which I would draw all of the sprites, compose and record the soundtrack, design and program the game engine – something that I would see through from beginning to end as my own learning project, but also something that I could hopefully come away from being at least a little proud of. So it may not be as ‘grand’ as I’d initially intended, but it is indeed finished. I took a break of about two and a half months after completing the engine, with the thought that it would never really be finished, and then, for some reason, I picked the project up again in January.

So I can definitely say that I understand object oriented programming much more than I did when I started. I also am a lot better at programming in general (which is, I suppose, what one would hope for after completing a project of some magnitude). It’s really good to finally be done, though. I don’t know how soon I want to start another one, but something tells me that it could very well be sooner than I expect.

Try playing it, let me know what you think in the comments. Here’s the link, just click “Launch”, select “open”, and the file will download and the run automatically. I’m having issues with the leaderboard right now, but gameplay is unaffected. Also, here’s my source code, which I have been staring at without much break for the past few months, and which I’m more than happy for you to look at now.

If you have any questions or comments, please make them known. And if you finish all fifty waves, I’ll buy you lunch. Seriously. If you do, tell me your score. Thanks for playing!

comments: 1 » tags: , , ,

Farted a Rainbow

Posted on 18th March 2011 in Something Daily

I’m not entirely sure of the reason, but I got back from the skatepark today and immediately felt the urge to make this.

I know what you’re thinking. You’re thinking “this guy looks like the coolest little kid that the world has ever seen. He had video game sunglasses and rainbows behind him all the time.” And if you thought that, you’d be right. About everything you’re thinking with regard to this general topic.

Being at school over spring break is totally sweet, because I have entire days to myself with no commitments whatsoever. That typically means that I’m going to code a lot, play video games for a good deal of time, and probably skateboard. Today, then, has been the quintessential spring break day (in my mind, at least). I put in a big chunk of the last week’s worth of work on Spaceratops today, waking up at 8 and basically coding straight through until noon. I started from scratch learning about applets today, because I realized that, realistically, how likely is it that anyone would play my crappy game if they have to download it? As I see it, really the only way to get anyone to play is if it works from within a browser – so that’s the idea of converting it to an applet. (actually, I think I’ll get a decent amount of people to play that way, at least compared to the results if it was a download). So this game is in the final final stages and will be linked to RIGHT HERE by Wednesday, March 23rd. I swear it. I need to be done with this project.

Speaking of, I downloaded the Unity game engine today, which I’ll be experimenting with later in the evening after a bit of decompression via Metroid Prime (which I started speedrunning last night) and Easy Mac.

Oh yeah, anyway…the transition to applet was an easy one, for the most part. It’s essentially the same as a JPanel, but runs via an automatically generated HTML form. One thing that is different, though, is that there’s a disparity between the manner in which images are printed in a frame and in an applet – which means that my applet is very much prone to flickering. It’s not unplayable by any means, but the flicker is certainly annoying. So I’ll be working on that tomorrow.

And one more thing – I don’t know if you heard, but I set a new personal record for shortest Super Mario 64 completion on Wednesday night. 2.5 hours, 58 stars. Yes, I used the stair glitch, but there comes a time in every semi-pro SM64 player’s career when not using glitches just doesn’t cut it anymore. We get bored. But yeah, my last record was three hours and four minutes, so I’m moving up in the world, clearly.

[youtube http://www.youtube.com/watch?v=Q1lwD-jFHOE&w=480&h=390]

I’m going to go shoot stuff with lasers, and you can just sit here staring at my elementary school awesomeness in all of its rainbow wonderment.

Netbeans IDE – Uncompilable Source Code exception

Posted on 12th March 2011 in Something Daily

So I’ve been working on a Java project recently, which, in terms of sheer lines of code, is pretty substantial. As such, I work on it a lot in different locations, and usually split the work between my two computers. Me being the efficiency freak that I am, I have found ways to ensure that the current version of the project is always accessible from anywhere on any system I’m using. That is, I keep the source files in the cloud (via Dropbox), so that every time I save a change in Netbeans it’s automatically uploaded, and I keep disk backups of the current files (done by a shell script every time I close a session). So basically the source directory that Netbeans looks at is just symlinked from Dropbox, while the class files are kept locally on each computer that I’m working on (apparently the Linux and Mac JVMs are different enough to require an annoying recompile if you don’t do this). But everything that I’m doing with this stuff is controlled by shell scripts.

The thing is, I started to notice that if I ever save anything in Netbeans when I’m not connected to Dropbox (that is, Dropbox fails to sync) I start getting errors about “uncompilable source code”. The identical code still runs just fine from the command line, but Netbeans can’t handle it. I finally found the answer to this issue today, though – it turns out that when Netbeans is set to compile every time the file is saved, a separate set of class files are created for debugging purposes. Certain things can cause these files to be corrupted and uncompilable, such as, I found out, a nonsyncing Dropbox containing the source files.

So to fix this, I first turned off the “compile on save” feature in Project Properties, then deleted closed Netbeans and deleted the directory “.netbeans/6.9/var/cache/index” (where the cache of extra class files is kept) and reopened. The directory is automatically recreated in a noncorrupted state when Netbeans reopens. The problem of uncompilable source code is gone now, with the one added annoyance of having to manually compile before running. Still, I’m glad my project runs.

The source of this new knowledge.

It’s Almost Done

Posted on 4th March 2011 in Something Daily

Recently I’ve been totally obsessed/preoccupied with finishing this Java game I’m working on, which is now called Spaceratops (because you’re a triceratops in space – so clever), and which I’ve been working on for a lot longer than I care to admit. But I mention it now because it’s my goal to have this be the last time I mention it here without it being finished. I mean it’s really close to being done. All the time this week that I haven’t spent in class or doing homework has mostly been spent refining the 3,000 lines of code that I’ve poured into this project.

Since the last time I talked about it, I’ve added a backstory that scrolls in star wars style, a bunch of flashy eye-candy type stuff, a leaderboard, a bunch of new enemies, enemy homing missiles, and the power for the player to shoot volleys of homing projectiles. I also made a lot of changes to the code that, among other things, improve the collision detection in all areas and increase the overall efficiency of the program (which was, before today, something that was severely lacking – major slowdown was starting to become a problem). Here are a few screenshots of what it looks like now, and what it will probably look like when it’s done, for the most part.

When it’s done, I’ll post a link to a .jar that you can download and run on your computer, no compilation required. Basically all that’s left to do is work out one or two trailing gameplay kinks, write a few more songs and add a few big boss enemies for the end of the game. Probably within two weeks it’ll be done. I’m looking forward to being able to really jump into some other project, which is why I’m just totally and completely obsessing over this one for the time being.

Preparing for Hackathon 2

Posted on 3rd March 2011 in Something Daily

Something exciting is on my mind since Tuesday: the next HackNY hackathon has been announced. I attended my first in October, but I didn’t know enough about anything that was going on there to really participate at all. I spent about five hours coding Spaceratops there, which I was in fact working on back in October. Side note: this is why I want to be done with that project. It’s taking too long. But anyway, the idea with the hackathons is that a bunch of representatives from startups come and demonstrate what their company’s API can do and then they give you a key and tell you to go nuts for the next twenty hours and hack together some sweet app from the tools that everyone’s given you. In October, this really was my first exposure to PHP, HTML (in recent years) and the idea of using API calls to build apps. So I didn’t join a team, I didn’t really meet anyone, and I didn’t build anything. I did make a lot of progress on Spaceratops that night. The experience of hanging out until all hours coding is extremely appealing to me, though (as is the prospect of free snacks, soda, and burritos all night), so I’m doing everything I can to prepare myself for the upcoming event. Whether I go by myself or with a friend, I’m going to introduce myself to some people, join their team, and help build something awesome. It’ll be awesome.

So to that end I’m going through as much of the W3Schools PHP tutorial as I think is necessary, and then I’m going to make something cool on my own. That’s the only way to learn this stuff: by actually building something. It may very well end up being something that uses Google maps or a calendar API – the choice is all mine. I just got PHP and MySQL running on my local server (for about the fourth time) and I’m tutorialing like crazy. Also Eric gave me subdirectory on his website, so I have some actual hosting. This may allow me to make Spaceratops into an applet that would be playable in a browser…that would be super rad. We’ll see.

And guess what I’m doing this weekend!? That’s right, more homework and coding. If I have my way, I’ll also finally finish Chrono Trigger. I’m at the last battle and it’s so nuts. Let’s do this.

Programming Homing Missile Behavior

Posted on 15th February 2011 in Something Daily

Once again, I thought that my Tropicana stuff was going to get here today, and of course I have nothing in the mail. I did also order that Andrew WK shirt, but that was last night, and I don’t think it would have come in less than 24 hours. Still, I’m waiting for way too much stuff in the mail.

I spent a much longer time than I should have today reacquainting myself with right triangles and the unit circle as they relate to 2D game programming. I found a tutorial that shows one how to model “homing missile” type behavior, where one object moves toward the position of another. It shows how to use trig and the Pythagorean theorem to get the same result, and while reading it, I was a little embarrassed that I wasn’t totally conversant with those already. I did go through the admittedly arduous process of figuring out for myself how to make homing missile/physically “accurate” motion over the summer using the same techniques, and it took me a while to independently come to the correct solution. I thought today was going to be a lot easier, because I started with the goal of reading this guy’s C++ and translating it to Java. It was absolutely easier than the first time I tried homing behavior, but I still had to do a lot of thinking during debugging. I guess it’s just practice that will help, though.

In case you’re wondering, I came up with this upon completion:
int dx = target_x - missile_x;
int dy = target_y - missile_y;
double sep = Math.sqrt(dx * dx + dy * dy);
double scale = length / sep;
missile_x += dx * scale;
missile_y += dy * scale;

All that said, I did succeed in my goal of modeling homing missiles in Java today. In the process, I also neglected a lot of homework. Now I have to make up for this. I’m going to go write some more code for my Data Structures class and listen to some Parliament.

NetBeans in Ubuntu – “Project file is read only”

Posted on 8th February 2011 in Something Daily

This morning, I finally managed to ruin my Ubuntu installation for real. That is, the Linux partition on my MBP; I altered the X11 config file in what was aparently the wrong way, and I couldn’t even boot into single user mode. I had to reinstall the OS. It’s ok though, there were a bunch of things that were kind of messed up about it that I couldn’t fix. I’m just glad I posted some howtos here, because I didn’t write them down anywhere else and I need to restore my Ubuntu to its former glory.

Before that catastrophic failure, though, I did successfully install Steam under Wine, as well as solving an interesting NetBeans issue about which I couldn’t find any documentation online at all. For that reason, I feel like it’s kind of important to at least mention my problem here, in case you ever have the same issue and can’t find any help online. I’d been using NetBeans under Ubuntu 10.10, and the project that opened when the proram launched was one I’d been working on for a while. Yesterday when I tried to start Netbeans, the main window would show up, frozen, along with a dialog saying that the project file was read only. Netbeans was totally frozen, and I had to force quit. Updating the default JDK from the command line had no effect, neither did uninstaling/reinstalling NetBeans. It eventually occurred to me, though, that the default project data had to be stored somewhere, and I figured that place was probably the /home/emmett/.netbeans directory. After uninstalling NetBeans, deleting that directory, and reinstalling, the default project had been reset and my problem vanished. Great success.