Category Archives: Website

Diablo II Mods and Code Stuff

Hello all. My apologies for not updating this website more.  My life has become complicated lately, and in these uncertain times I find it difficult to want to write about it.  A shame really, as the site has never been more popular.  Seems like every time a new game comes out lacking multi-monitor support, I get hundreds of new visitors and users for Cursor Lock; a few weeks ago, it was Cites: Skylines.  And today with the announcement of another new Deus Ex game, my version of the soundtrack is hotter than ever.  It does make me feel good to know that I can produce things that people need, even if it’s only for video games.

Speaking of video game content, I spent a lot of time a few months ago working on a new class for Diablo II.  Well, it’s not really a completely new class, more like a subclass since I only changed one skill tree for the Amazon.  It just really bugged me how the Amazon felt so lame compared to the Diablo 3 Demon Hunter.  It’s really difficult to keep the monsters from swarming the Amazon, so I designed some Demon Hunter-inspired skills to help remedy the problem, such as caltrops, turrets, and smokescreens.  You can see these skills in action in the video below.

I also just wanted to fulfill my desire to do some really hardcore modding for Diablo II.  The game has a rather awkward system for making modifications.  If it were made today, we’d probably have XML files and LUA scripts to work with.  But since it was made 15 years ago, we instead have to settle for massive CSV files.  You can find the Demon Hunter mod on my Diablo II mod page.  And massive props to the Phrozen Keep for continuing to support D2’s modders.

Another thing that bothered me about Diablo II for so long is that when you die your corpse keeps all your equipment on it, and you respawn basically naked and unarmed.  Your only options are to run in, snatch everything off your corpse, and teleport back to town, or rage quit and hope that your corpse returns to town like it’s supposed to.  Obviously, this is almost always zero fun and is why no games handle death like this anymore.

Unfortunately, there’s no way to change this in the game’s CSV tables.  But I didn’t let that stop me.  Every now and then, a problem comes along which must be solved through assembler hacking, and this was one of those times.  But I didn’t really have a clue which function was involved in character death.  So, I just put breakpoints on every function in IDA and attached to the running process.  It took a while of breaking, disabling breakpoints, and resuming, but I eventually narrowed it down to several dozen functions involved in death.  Some functions did death animations, some saved character data, but then I found a suspicious bit of code that would loop 14 times—the number of equipment slots.  This was the code where the game looped through each equipment slot and moved the item from the player to the player’s dead body.  And then there was nothing left to do but some trial and error to figure out where I could safely jump over the offending code and re-enter.  Now the only problem is that this mod will have to be updated every time there’s a Diablo II patch. 😥

Here we see the fateful jump operation to bypass the character equipment being removed.

Here we see the fateful jump operation to bypass the character equipment being removed.

Since then, I’ve been turning back to more PHP/HTML/CSS/JS coding.  I’m working on a project that I can’t disclose at this time but which quite possibly could be my most epic work yet.  Wish me luck in completing it.

Recently, I’ve also been using PHP as my go to scripting language for everyday projects.  A couple days ago, I wanted to be able to pull all GPS image data from a directory and display it in Google Earth.  PHP has file IO, EXIF, and XML libraries, so it was real convenient to bash out a script using that.  Then I realized I had created an account on Github recently to comment on some projects and thought why not just put this code on there.  So I did.  Maybe I’ll add more small projects like this in the future.

Posted in Modding, Programming, Website | Tagged , , , , , | 2 Comments

Cursor Lock and Steam Widgets

I just did a quick update to Cursor Lock to fix a painfully obvious bug that I somehow overlooked.  Thanks to the person that googled “cursor lock strict mode does not create shortcut” today! 😉

Steam Widget

Also, I noticed you noticed my Steam widget.  I just added it over the weekend and people are already clicking through on the game links.  I did the widget based on my code for Sitewide Recent Images (more about that on my work blog), so it supports the same caching and template options, which the other two Steam widgets on wordpress.org failed at.  I hope to release it over the weekend.

Posted in Programming, Website | Tagged , , | Leave a comment

New Website for SnakeByte Studios

SnakeByte Studios 2012

Heeeey…I have a new website.  It’s very much a work in progress, but I needed to make it live now because it’d probably have been another year before I finished completely.  As I mentioned a couple posts ago, the new site is powered by WordPress.  However, I mostly scrapped the theme I was working on in favor of a heavily modified Twenty-Ten and Nivo Slider for a homepage header.  The theme is not too unlike an idea I’ve been playing around with on my work blog, which itself was inspired by another theme called Dusk to Dawn.

Besides the other reasons I gave for switching to WordPress in the aforementioned post, which in summary were:

  1. Visitor commenting
  2. Full-featured backend
  3. Familiarity from using at work

I also just don’t have time to code my own site from scratch anymore.  And this is fine—I get enough coding websites at work—and will allow me to focus more on posting and other projects.  Speaking of other projects, I finished another map for Company of Heroes over winter break.  It’s a remake of a map from the original Red Orchestra.  It’s also on FileFront.

Posted in Modding, Website | Tagged , , | Leave a comment

Deus Ex and such

I just finished my second playthrough of the new Deus Ex game, Human Revolution. It has a few bugs but is generally the best game I’ve played in a while. Though, I must say that the original Deus Ex is still a smidge better. So far I haven’t given a full review, but if I did so it’d be on Metacritic where I’ve been doing my other reviews.

Also, in my last playthrough of DX:HR, I took a bunch of screenshots of the weapon mods and Praxis Kits that I found and then gave descriptions of where they’re located. With Steam’s nifty new screenshot management, I was able to easily upload them all to my Steam page for your reference. It’s probably the beginnings of a new DX guide.

So I’m still doing a ton of gaming since I started working full-time and less of being productive. However, one thing I’ve been contemplating is converting my site to WordPress for a few reasons. It would add commenting features for all my posts and other content, and I’m hoping that getting more feedback would be a good motivator for me. Also, having a slick backend should help me post more often. Plus I’ve been using WP a lot at work lately and I’m pretty comfortable developing for it now so it shouldn’t be much trouble to extend it to my needs.

The only thing I’m stumbling on is the design of the new WordPress site. I’ve been toying with a mockup for the last month but I’m not sure I like any of it. I’ve been trying to keep some of the colors and graphics of the current site’s style. Maybe I need to start over from scratch on this.

Posted in Gaming, Website | Tagged , , | Leave a comment

Work Grinder

Obviously, I haven’t blogged in a while. It’s been so much longer than my usual lapse that one may have even feared the worst. Well, it’s close enough–I became employed. Indeed, forty hours a week (plus twenty more in support of it), I work at my alma mater’s library handling anything decidedly too technical for my 25 coworkers. I enjoy the tasks of my job; they stay pretty varied, so I never get bored. I’ve been working with WordPress, PHP, streaming video (both Flash and Apple’s Darwin streaming servers), Apache, JavaScript and HTML DOM, plenty of graphics editing, and of course the usual HTML editing. Sometimes, I even have fun doing work. The people are all rather nice, too, albeit I have a difficult time connecting to most of them personally (considering the demographics of your typical librarian).

However, I resent all the hours that I have to put into my job and how it drains me physically and mentally such that I have no time for personal projects (i.e. everything on this site). On some weekdays, I’m too tired to even enjoy video gaming. And on the weekends, playing video games is all I can seem to do. Clearly, anyone counting on me to work on any of my mods or programs, should lose most of their hope now. Though, whenever I get contacted by users, it is enough to motivate some work. My only solace is that I don’t have to stay with this job forever.

But having money is pretty cool. 😉 I’ve never had more than a few hundred dollar in my whole life before I started working. Only two months into the job, I couldn’t stand it anymore and had to buy the parts for my new computer, Serpent 3 (hopefully, more on this in a future post soon). Also, it’s even more convenient buying and downloading games on Steam than it is to pirate them from Bittorrent. And it doesn’t hurt that I can afford to buy my girlfriend nice things now. Ah, money…I love you.

Posted in Website | Tagged | Leave a comment

We have explosive.

(i.e. Lightboxes)

I’ve been really into web development lately, especially anything requiring a lot of JavaScript control of the DOM and CSS control over layout and style. I’ve spent a solid week (at least) working on adding lightboxes to replace some of my lighter scripts: image viewing and downloads. I’ve been pretty fascinated by lightboxes ever since I saw them on addons.mozilla.org. The idea to actually employ one on this site didn’t come to me until I was doing the remake of the content system and thought it would be awesome to combine a lightbox with the ability to preview the contents of archives (rar and zip files).

Although there are tens if not hundreds of lightbox implementations, I felt like creating my own to avoid all the code bloat and because I’m that much of a control freak. The first hurdle was figuring out how the hell these other lightboxes could be triggered on the click of a link without navigating to the link URL immediately after the script finishes. Googling didn’t turn up any leads, but I eventually found out the answer by just reading the code comments of another lightbox. It’s simple and makes sense but isn’t obvious: the onclick function must return false. It kinda works like a message chain in Windows.

From there, I just kept chugging out JavaScript. On DOM readiness, the script adds onclick events to trigger the lightbox to any existing links to image or download pages. On click, the script does the appropriate HTTP request (AJAX) for the content to fill the lightbox. On request received, it puts the HTML into a lightbox container that automatically enlarges to fit content. Meanwhile, the script is fading in the obligatory black overlay; I chose to fade it in not only because it looks awesome but it also helps your eyes to adjust to change in light. It’s all a delicate ballet of scripting, but surprisingly IE performs quite well with it and only minimal hassles (e.g. filter: alpha(opacity=#); instead of opacity: #.#; for overlay opacity in CSS).

It didn’t stop with lightboxes, though. I’ve also been wanting for a while to have a display of the most recent uploaded images on the front page but was underwhelmed by the prospect of cramming only a few images on there. Then I got to thinking about how I might make a scrolling marquee for the images and realized it wasn’t too hard to code. You simply need an inner container for the images with position: relative and an outer container with overflow-x: hidden and on button script events move the inner container’s style.left property by negative the amount to scroll. Then, obviously, you have to do some code to detect the beginning and end of the marquee to keep it within bounds among other things. Quite snazzy.

I also made another slight change to front page (beyond adding the latest blogs). I was a little displeased by my method of finding the most popular content given that it merely sorts the database by the total downloads. Thus, it’s not at all responsive to changing trends. For example, if file A gets 1000 downloads over five years but not much recently, and file B has only 300 downloads over a couple months but gets several hits a day, then file B is obviously more popular than file A. The best solution to calculate what’s more popular would be to log all the hits for a day for every file and calculate popularity trends often, but that’s a logistical nightmare and too much hassle for this small site. However, I came up with a simple solution that requires only one new field in the database (last_dl_count) and a monthly cron job to do UPDATE `content` SET `last_dl_count`=`dl_count`;. Finally, I switched the front page popular query to the following:

SELECT `id`, `title`, `sshots`, `dl_count`, (`dl_count`-`last_dl_count`) as `delta_count` FROM `content` WHERE `type` = '$type' ORDER BY `delta_count` DESC, `dl_count` DESC LIMIT 2;

It works fairly well, except at the beginning of the next period after the update cron runs. Since all the deltas are 0, you get only the all-time popular again until someone downloads something.

Well, I think that’s enough web developer theory for now. However, I’d like to point out three academic columns I recently added. There’s one from Fortran Programming class with all my source code and most of my documentation. The second is on the Parallel Programming with PVM project I did last year, including a Flash slideshow (first mentioned here), presentation notes, and source code. The last is a paper I wrote on the Aspects of Overpopulation, a subject that greatly concerns me; too bad the class it was for was completely worthless.

Posted in Academics, Programming, Website | Tagged , , , | Leave a comment