Ignoring the fact that there actually is a band named Beck. This is entirely about the anime of the same name, which I've been watching at CAINE's weekly showings. Our next showing contains the final three episodes, and this post will hopefully explain why I won't miss the series at all.
So in the beginning some kind of unimportant stuff happens where you just get to cringe at how stupid the show's main character, Yukio, is. You think it's all going to be over once you actually start hearing the name "Beck" being thrown around when people are actually talking about a band. This is also because there's a dog in the series that's named "Beck", and that's where the name of the band came from.
They play a few concerts and get their name out there. So, smooth sailing, right? Well, another stupid thing pops up. It's the same deal whenever anyone first hears of them. "Beck? That's a stupid name for a band." EVERY. FUCKING. TIME.
That's not that big of a deal though, because you thought Yukio was done being an idiot? HahahahahahaNO. Every time you think he couldn't possibly be any stupider, he breaks his previous stupidity record with flying colors.
Basically, there's this girl named Maho, and if Yukio wasn't a giant fucking retard he'd realize that she'd totally get in his pants if he wasn't a giant fucking retard. They get along so well, then without fail he always does something to screw it up. Every time. Hell, she even promises him at one point that if he wins an event in his school's swim team competition that she'll do anything he wants, and even though he wins the event, he remains completely oblivious to what she meant. Seriously.
The swim team? What the fuck does swimming have to do with an anime that's about a band? Well, there's this old guy, Mr. Saitou, who's generally a creep but is a really good swimmer and also happens to play the guitar. He provides our resident retard Yukio with guitar lessons, a guitar to use until he can buy his own, and critiques his swimming at the local pool. Honestly, you could take the swimming out of the series and it wouldn't lose anything. Mr. Saitou later gains the affections of Yukio's teacher, and all but disappears.
So eventually they get a record deal. With an American label. Who tells them that the name "Beck" is no good in the States. Rather than coming up with something else, they just let the label make up a name. Which happens to be "Mongolian Chop Squad". Add to that that the record deal doesn't give them any royalties. So even though the album does pretty well, they get no money out of it. Point, fucking where? Nowhere.
For a show that's supposed to be about a group of people who start a band and try to rise to stardom, it has quite a lot of completely unrelated shit happening. There's always setback after setback. They can't go an episode without pissing someone off, it seems. The grand motherfucker of pissing someone off comes up later on in the series when it's revealed that another character, Ryosuke, stole the guitar he plays, named Prudence, as well as the dog named Beck. The original owner of the guitar tracks him down, and has goons beat the shit out of him before taking him away in a fucking helicopter that they landed in his front yard, all to end with Ryosuke playing blues guitar with him.
Then this music festival comes up and you'd think for once Beck could get its shit together for just one story arc, but no, everything falls apart there too.
I... I don't even think it's worth mentioning anymore, to be honest. It's not a series that's really worth anyone's attention. If you want a series about people getting together and starting a band with the goal of trying to rise to stardom, just fucking watch K-On!. Even if you absolutely hate moeblob anime, it'll be more enjoyable than Beck. There's more of the "people playing music" thing and the random extra stuff is at least funny. Yui may be an idiot, but she's a fucking genius in comparison to Yukio.
Sunday, November 18, 2012
Tuesday, November 13, 2012
Logitech G930 Wireless Headset
So, the $20 Altec Lansing headset I bought at Best Buy seven years ago has been developing its fair share of issues lately, from the foam padding falling off, to the inline volume control causing static or a stereo channel dropout if nudged the wrong way, so I figured it was time for a replacement.
A friend of mine put together a computer a couple years ago and after doing so bought a Logitech G930 wireless headset, and pretty much had nothing but good stuff to say about it, so I grabbed one for myself off of Newegg.
Comfort
The G930 is large and weighs more than your average pair of headphones. Fortunately, this isn't too noticeable while wearing them, as the foam padding around the earpieces and across the headband helps keep them in the right place. The earpiece padding messes with my glasses, though, and makes me feel like they're not in the right place, which makes me constantly adjust both my glasses and the headset.
In terms of how the weight of the G930 affects practical usage, let's just say you may want to get a straw for that soda, because if you tip your head backwards there's a fairly certain chance that the headset will fall off your head.
Design
Rather than your standard headphones, which just place a speaker up against your ear directly, the G930's earpieces fully encompasses the ear. This contributes to their size, but also does a decent job of blocking out background noise.
The left earpiece is also home to the controls and the microphone boom. The microphone boom can be rotated into place, or up out of the way. When it's rotated up out of the way, it automatically mutes itself. The boom can be adjusted even further to position it properly relative to your mouth, to get less distortion or whatever the technical term is.
Controls and Software
The physical controls on the left earpiece consist of a volume dial, a mute button, the power button, a switch that I'll cover in a moment, and three programmable "G keys". The included software allows you to configure the "G keys" to control a variety of multimedia software out of the box, such as iTunes, Winamp, and Windows Media Player, and you can also download plugins to add support for whatever else you might need. I found a plugin that lets me configure them to send the Next, Previous, and Play/Pause signals from a multimedia keyboard, and thus control Foobar2000.
The switch on the left earpiece toggles the G930's 7.1 surround sound mode. If used with a regular stereo signal, it will apply some effects to it and have the sound coming from all channels, which in my experience seems to work better for music than voice. With voice, it sounds more like you're in a lecture hall, where the person talking has a microphone, and the acoustics aren't quite right so there's some reverb. Disabling the 7.1 mode puts everything back to plain old stereo.
I was worried that it would be confusing as to where everything was on the left earpiece, since it's impossible to see it without taking off the headset, but everything seems to be intuitively placed and hard to accidentally press.
The software affords a range of configuration options, from an equalizer to three different volume sliders. One volume slider is for the headphone volume, the second is for the microphone volume, and the third controls "Sidetone" volume. "Sidetone" allows you to hear what's coming in through the microphone, which I guess can be useful, but I prefer to turn it off.
The equalizer has a simple mode that has a slider for treble and a slider for bass, but you can enable the advanced mode and get more sliders for specific frequency ranges, allowing you to more finely tune the sound that comes out of the headphones. This is handy because the headphones have decent bass, but sound incredibly tinny at the same time.
There's also a surround sound mixer, that lets you fine-tune the volume level of each 7.1 surround channel. Note that if the 7.1 surround is off you will only be able to adjust the regular stereo channels. Amusingly, the volume levels go up to 11.
The software also has a few different voice morphing modes. I don't really know how much use anyone will ever get out of these in a practical setting, but they're fun to play around with.
Connectivity and Battery
The G930 comes with a USB charging cord that wraps up into a round base unit that has a USB port on it. This USB port is primarily useful for plugging in the headset's USB transceiver, so that with one USB port on your computer you can both use the headset and charge its battery simultaneously.
The battery ships with a minimal charge and takes upwards of six hours to charge initially, during which time the G930 can still be used. Once fully charged, the software claims an eight hour battery life. The included software has an option to provide notice that the battery is getting low both as an audible notice and as a system tray notice. Either or both of these can be toggled off if you so choose.
The specifications claim a usable wireless range of up to 40 feet. I would place emphasis on the "up to" in that phrase, because in my house I can barely get over 25 feet, which isn't enough to let me mill about the kitchen to get myself a snack while listening to music. I have the same issue with wireless game controllers, so it's most definitely an RF limitation and not a limitation specific to this one device.
Completely unlisted anywhere, and not configurable in the provided software, is the G930's automatic power-off feature. This serves to save the battery life by shutting off the headset when the software thinks it's not in use. Though I haven't encountered it, people across the internet have complained that it can occasionally power off while you're using it.
Also, since the headset installs as its own separate audio input/output device, independent of your sound card, if the application you're choosing allows you, you can choose to send some audio to the headphones and other audio to your speakers. One thing I'm surprised about is that the driver/software doesn't automatically swap your system's default output device back to your sound card when you unplug the USB transceiver. If this issue is OS-specific, I'm running Windows XP SP3 32-bit.
Overall
The Logitech G930 Wireless Headset is an excellent choice if you're looking for a headset. It's relatively easy to set up and use, and provides a decent range of configuration options and intuitive features. While I wish its battery life was a bit longer, it's decent enough that you can use it off and on during the day and then charge it overnight. The MSRP is $160, but if you look around the internet you can find it for around $120 instead. If you need yourself a headset, you could definitely do far worse.
A friend of mine put together a computer a couple years ago and after doing so bought a Logitech G930 wireless headset, and pretty much had nothing but good stuff to say about it, so I grabbed one for myself off of Newegg.
Comfort
The G930 is large and weighs more than your average pair of headphones. Fortunately, this isn't too noticeable while wearing them, as the foam padding around the earpieces and across the headband helps keep them in the right place. The earpiece padding messes with my glasses, though, and makes me feel like they're not in the right place, which makes me constantly adjust both my glasses and the headset.
In terms of how the weight of the G930 affects practical usage, let's just say you may want to get a straw for that soda, because if you tip your head backwards there's a fairly certain chance that the headset will fall off your head.
Design
Rather than your standard headphones, which just place a speaker up against your ear directly, the G930's earpieces fully encompasses the ear. This contributes to their size, but also does a decent job of blocking out background noise.
The left earpiece is also home to the controls and the microphone boom. The microphone boom can be rotated into place, or up out of the way. When it's rotated up out of the way, it automatically mutes itself. The boom can be adjusted even further to position it properly relative to your mouth, to get less distortion or whatever the technical term is.
Controls and Software
The physical controls on the left earpiece consist of a volume dial, a mute button, the power button, a switch that I'll cover in a moment, and three programmable "G keys". The included software allows you to configure the "G keys" to control a variety of multimedia software out of the box, such as iTunes, Winamp, and Windows Media Player, and you can also download plugins to add support for whatever else you might need. I found a plugin that lets me configure them to send the Next, Previous, and Play/Pause signals from a multimedia keyboard, and thus control Foobar2000.
The switch on the left earpiece toggles the G930's 7.1 surround sound mode. If used with a regular stereo signal, it will apply some effects to it and have the sound coming from all channels, which in my experience seems to work better for music than voice. With voice, it sounds more like you're in a lecture hall, where the person talking has a microphone, and the acoustics aren't quite right so there's some reverb. Disabling the 7.1 mode puts everything back to plain old stereo.
I was worried that it would be confusing as to where everything was on the left earpiece, since it's impossible to see it without taking off the headset, but everything seems to be intuitively placed and hard to accidentally press.
The software affords a range of configuration options, from an equalizer to three different volume sliders. One volume slider is for the headphone volume, the second is for the microphone volume, and the third controls "Sidetone" volume. "Sidetone" allows you to hear what's coming in through the microphone, which I guess can be useful, but I prefer to turn it off.
The equalizer has a simple mode that has a slider for treble and a slider for bass, but you can enable the advanced mode and get more sliders for specific frequency ranges, allowing you to more finely tune the sound that comes out of the headphones. This is handy because the headphones have decent bass, but sound incredibly tinny at the same time.
There's also a surround sound mixer, that lets you fine-tune the volume level of each 7.1 surround channel. Note that if the 7.1 surround is off you will only be able to adjust the regular stereo channels. Amusingly, the volume levels go up to 11.
The software also has a few different voice morphing modes. I don't really know how much use anyone will ever get out of these in a practical setting, but they're fun to play around with.
Connectivity and Battery
The G930 comes with a USB charging cord that wraps up into a round base unit that has a USB port on it. This USB port is primarily useful for plugging in the headset's USB transceiver, so that with one USB port on your computer you can both use the headset and charge its battery simultaneously.
The battery ships with a minimal charge and takes upwards of six hours to charge initially, during which time the G930 can still be used. Once fully charged, the software claims an eight hour battery life. The included software has an option to provide notice that the battery is getting low both as an audible notice and as a system tray notice. Either or both of these can be toggled off if you so choose.
The specifications claim a usable wireless range of up to 40 feet. I would place emphasis on the "up to" in that phrase, because in my house I can barely get over 25 feet, which isn't enough to let me mill about the kitchen to get myself a snack while listening to music. I have the same issue with wireless game controllers, so it's most definitely an RF limitation and not a limitation specific to this one device.
Completely unlisted anywhere, and not configurable in the provided software, is the G930's automatic power-off feature. This serves to save the battery life by shutting off the headset when the software thinks it's not in use. Though I haven't encountered it, people across the internet have complained that it can occasionally power off while you're using it.
Also, since the headset installs as its own separate audio input/output device, independent of your sound card, if the application you're choosing allows you, you can choose to send some audio to the headphones and other audio to your speakers. One thing I'm surprised about is that the driver/software doesn't automatically swap your system's default output device back to your sound card when you unplug the USB transceiver. If this issue is OS-specific, I'm running Windows XP SP3 32-bit.
Overall
The Logitech G930 Wireless Headset is an excellent choice if you're looking for a headset. It's relatively easy to set up and use, and provides a decent range of configuration options and intuitive features. While I wish its battery life was a bit longer, it's decent enough that you can use it off and on during the day and then charge it overnight. The MSRP is $160, but if you look around the internet you can find it for around $120 instead. If you need yourself a headset, you could definitely do far worse.
Tuesday, November 6, 2012
Monday, October 29, 2012
Random Steam Demos
Periodically I remember to browse the demos section on Steam and see what's available. Here's a post listing a few games I've tried, my thoughts on them, and perhaps the most important question answered: do I feel it's worth the purchase price?
Castle Crashers
The ultra-popular XBLA game made its debut on Steam recently, and since The Behemoth was kind enough to provide a demo, I gave it a try.
Just on the off-chance that you've been living under a rock and haven't heard of Castle Crashers, it's a medieval-themed 2D sidescrolling beat-em-up for up to four players where you beat the bad guys to rescue the princesses, and then in multiplayer you fight each other for their affection. It sports a lot of available weapons and four stat tracks to spend those precious level-up points in. The only down-side to the demo is that it ends halfway through the boss fight at the end of the second stage. It doesn't even have the decency to let you finish it and then say "that's it for the demo!"...
This is a case of a game that I've already played a bunch of over at friends' places and thus already know it's good. From what I've seen in the demo, the PC version seems to be a pretty solid port, with nothing notably different in the available content. It also has the Pink Knight and Blacksmith DLCs available for $0.99 each. Worth the $14.99 on Steam? Ehhhh... I'll wait for a sale.
Fairy Bloom Freesia
Essentially a 3D sidescrolling beat-em-up, it stars a fairy named Freesia who is trying to defend her forest from monsters and humans that want to obtain the spirit stones that provide life energy to the forest. The demo is a quick five stages, really just enough to get your feet wet. You learn the basics, have the opportunity to play with buying moves and stat upgrades, learn the mechanics, etc., and it ends with a boss battle. After the boss battle, the demo ends. It sports a mechanic that anyone who's played Contra will be used to, namely down+jump to drop down from a platform. It also borrows a fair number of mechanics from 2D fighters, like double jumping, air dashing, recoveries, and just defense.
Overall, the music is decent, the graphics are great, and the gameplay is solid. The demo crashed on me a bit as I was trying to set it up (configuring resolution options), but once everything was set I had no stability issues. Worth the $7.99 on Steam? Sure.
Hell Yeah! Wrath of the Dead Rabbit
This is a crazy 2D action platformer starring Ash, a devil rabbit who is also the prince of Hell. Apparently someone posted "secret intimate photos" of him on the Hell-ternet, and now he's pissed. All the premise anyone really needs for a platformer where you go around killing everything. Along the way you build up an arsenal of weapons. Unfortunately, the demo ends abruptly just before the boss fight in the first area.
The music works quite well, the graphics are great, and the controls are solid. The game does crash if you try to force it to run a display resolution it doesn't present to you in the graphics settings, though. I was trying to get it to run at 1440x900, which it doesn't provide an option for. Set it via the config file, and it re-sets itself to 1280x800 on startup. So I exited, changed it back, and then made the file read-only, only to have it crash. Oh well. The game has two DLCs on Steam, a skin pack for $2.99 and a pack of extra missions for $5.49. The game itself is $14.99 on Steam. Worth it? Just like with Castle Crashers, I'll wait for a sale.
Bang Bang Racing
This is a 3D top-down racing game. From the looks of things there's a decent variety of cars and tracks to choose from. The demo limits you to Free Play mode, which is fine, but then it gives you the whole "buy the full version!" marketing spiel after every race. I'd be fine if it just did it on exit, but after every race? Anyway.
Aside from the sounds being a bit loud by default, and the all-too-apparent presence of rubberbanding, there isn't much to gripe about. The game's description mentions "technical driving skills" as one of its focuses, but with the rubberbanding in place, it doesn't matter how bad you screw up, all the AI cars will be waiting for you a little bit down the road.
As far as gameplay goes, it's on the full arcade side of things. Akin to F-Zero, you simply need to make a quick pass through the pit lane to repair your car and refill your nitro. You can drift a bit by pressing the brakes while turning with the accelerator pressed, but I found that the tighter corners were a lot easier to handle if I did the regular "slow down, take the corner, acclerate out" thing. Again, due to the rubberbanding, I was never able to open a commanding lead and have a buffer for the occasional messed up corner, the AI is always right there as soon as you screw up.
Aside from rubberbanding complaints, the game supports up to 4 human players and you can turn off the AI cars, so there's hope in that form. However, you really shouldn't have to do that just to get around the rubberbanding. There should be a toggle for the rubberbanding. The game itself is pretty fun, there are hazards to avoid like oil barrels, water buckets, and more. It could use an option to turn the hazards off, as a good number of them are placed directly on the racing line.
Overall, it's fun, and the graphics are good, but it's plagued with issues that make me not really want the full game. Definitely not worth the $9.99 on Steam.
Seriously though, is it really that hard to make a good non-sim racing game?
Castle Crashers
The ultra-popular XBLA game made its debut on Steam recently, and since The Behemoth was kind enough to provide a demo, I gave it a try.
Just on the off-chance that you've been living under a rock and haven't heard of Castle Crashers, it's a medieval-themed 2D sidescrolling beat-em-up for up to four players where you beat the bad guys to rescue the princesses, and then in multiplayer you fight each other for their affection. It sports a lot of available weapons and four stat tracks to spend those precious level-up points in. The only down-side to the demo is that it ends halfway through the boss fight at the end of the second stage. It doesn't even have the decency to let you finish it and then say "that's it for the demo!"...
This is a case of a game that I've already played a bunch of over at friends' places and thus already know it's good. From what I've seen in the demo, the PC version seems to be a pretty solid port, with nothing notably different in the available content. It also has the Pink Knight and Blacksmith DLCs available for $0.99 each. Worth the $14.99 on Steam? Ehhhh... I'll wait for a sale.
Fairy Bloom Freesia
Essentially a 3D sidescrolling beat-em-up, it stars a fairy named Freesia who is trying to defend her forest from monsters and humans that want to obtain the spirit stones that provide life energy to the forest. The demo is a quick five stages, really just enough to get your feet wet. You learn the basics, have the opportunity to play with buying moves and stat upgrades, learn the mechanics, etc., and it ends with a boss battle. After the boss battle, the demo ends. It sports a mechanic that anyone who's played Contra will be used to, namely down+jump to drop down from a platform. It also borrows a fair number of mechanics from 2D fighters, like double jumping, air dashing, recoveries, and just defense.
Overall, the music is decent, the graphics are great, and the gameplay is solid. The demo crashed on me a bit as I was trying to set it up (configuring resolution options), but once everything was set I had no stability issues. Worth the $7.99 on Steam? Sure.
Hell Yeah! Wrath of the Dead Rabbit
This is a crazy 2D action platformer starring Ash, a devil rabbit who is also the prince of Hell. Apparently someone posted "secret intimate photos" of him on the Hell-ternet, and now he's pissed. All the premise anyone really needs for a platformer where you go around killing everything. Along the way you build up an arsenal of weapons. Unfortunately, the demo ends abruptly just before the boss fight in the first area.
The music works quite well, the graphics are great, and the controls are solid. The game does crash if you try to force it to run a display resolution it doesn't present to you in the graphics settings, though. I was trying to get it to run at 1440x900, which it doesn't provide an option for. Set it via the config file, and it re-sets itself to 1280x800 on startup. So I exited, changed it back, and then made the file read-only, only to have it crash. Oh well. The game has two DLCs on Steam, a skin pack for $2.99 and a pack of extra missions for $5.49. The game itself is $14.99 on Steam. Worth it? Just like with Castle Crashers, I'll wait for a sale.
Bang Bang Racing
This is a 3D top-down racing game. From the looks of things there's a decent variety of cars and tracks to choose from. The demo limits you to Free Play mode, which is fine, but then it gives you the whole "buy the full version!" marketing spiel after every race. I'd be fine if it just did it on exit, but after every race? Anyway.
Aside from the sounds being a bit loud by default, and the all-too-apparent presence of rubberbanding, there isn't much to gripe about. The game's description mentions "technical driving skills" as one of its focuses, but with the rubberbanding in place, it doesn't matter how bad you screw up, all the AI cars will be waiting for you a little bit down the road.
As far as gameplay goes, it's on the full arcade side of things. Akin to F-Zero, you simply need to make a quick pass through the pit lane to repair your car and refill your nitro. You can drift a bit by pressing the brakes while turning with the accelerator pressed, but I found that the tighter corners were a lot easier to handle if I did the regular "slow down, take the corner, acclerate out" thing. Again, due to the rubberbanding, I was never able to open a commanding lead and have a buffer for the occasional messed up corner, the AI is always right there as soon as you screw up.
Aside from rubberbanding complaints, the game supports up to 4 human players and you can turn off the AI cars, so there's hope in that form. However, you really shouldn't have to do that just to get around the rubberbanding. There should be a toggle for the rubberbanding. The game itself is pretty fun, there are hazards to avoid like oil barrels, water buckets, and more. It could use an option to turn the hazards off, as a good number of them are placed directly on the racing line.
Overall, it's fun, and the graphics are good, but it's plagued with issues that make me not really want the full game. Definitely not worth the $9.99 on Steam.
Seriously though, is it really that hard to make a good non-sim racing game?
Saturday, October 27, 2012
Friday, October 19, 2012
Minecraft Server Stuff
A friend of mine expressed desire for me to start up my Minecraft server again, so I generated a fresh (seeded) world on 1.3.2 and it's up once more.
I like to make little PHP scripts to output information about the server, like whether it's up or down, who's whitelisted, and various server options. I figured this time around I'd implement a "last seen" feature that would tell you if someone on the whitelist had ever been on the server, when they last logged off, or if they're currently on.
I sat down with PHP and victory was had, but not without some shell script shenanigans with PHP's shell_exec() function.
Basically, the core of "last seen" functionality involves reading the server log looking for the most recent connection and disconnection notices for a given player, and comparing the timestamps to see if they're currently online. In bash shell script, this is balls easy to do:
However, I'm working with PHP, not bash shell script. Originally, I tried to dynamically generate a shell command to pass to shell_exec(), but a) it never worked right, and b) it ended up being more complex than I originally thought. I was originally just getting each user's last logoff time, neglecting the fact that they could be presently on the server.
The "solution" was to copy/paste my shell script I was trying to shell_exec() into an external file and chmod +x the fucker. Then my shell_exec() call became simply running that shell script with the name of the player on the command line. It works, but using shell_exec()... yeah...
However, the functionality for grep (preg_grep()) and what I'm using sed for (preg_replace()) basically already exists in PHP. While I'm a fan of writing things in the languages that make them the easiest to write, the result looks rather cobbled together and tends to break when you think about portability. All PHP really needs is a native implementation of tail -n and we're good.
Which it doesn't have. My next step was to sift through Google search results and see if anything of use popped up.
Initially, all I could find were tail -f implementations. That allows live monitoring of a log file, which admittedly can be useful, but wasn't what I needed. I just need one stinkin' line out of the file. After sifting through the results, I noticed that one of them was indeed an implementation of tail -n. However, it didn't operate in the way I needed it to. Instead of taking in data and returning the last few lines of it, it required the data to be in a file. Being that I'm passing the file through grep first, it wouldn't work.
Then I derped and realized that it's way easier than I thought. If you read in the complete file with the file() function, you get an array of strings where every string is a single line of the file. preg_grep() operates on an array. So, basically, all I needed to do was this:
So if you need a PHP tail -n implementation and you're reading a file in via file(), just use array_slice() to get the lines you need.
All in all, I ended up with this:
Also, yes, technically speaking, the mystery case can be triggered. The user's logon time has to be equal to their logoff time. That's fairly difficult to achieve with Minecraft, since the server considers you logged in before you're even able to bring up the menu and hit disconnect. Hence why I'm not actually bothering to write code to handle it.
I like to make little PHP scripts to output information about the server, like whether it's up or down, who's whitelisted, and various server options. I figured this time around I'd implement a "last seen" feature that would tell you if someone on the whitelist had ever been on the server, when they last logged off, or if they're currently on.
I sat down with PHP and victory was had, but not without some shell script shenanigans with PHP's shell_exec() function.
Basically, the core of "last seen" functionality involves reading the server log looking for the most recent connection and disconnection notices for a given player, and comparing the timestamps to see if they're currently online. In bash shell script, this is balls easy to do:
#!/bin/bash MINECRAFT_SERVER_LOG="/path/to/minecraft/server.log" LOGOFF_TIME=`grep -Pi "^.{19} \[INFO\] $1 lost connection" "$MINECRAFT_SERVER_LOG" | tail -n1 | sed -r 's/^(.{19}).*$/\1/'` LOGON_TIME=`grep -Pi "^.{19} \[INFO\] $1\[/[^]]+\] logged in" "$MINECRAFT_SERVER_LOG" | tail -n1 | sed -r 's/^(.{19}).*$/\1/'` if [ "$LOGON_TIME" = "" ]; then echo "Never" else if [ "$LOGON_TIME" '>' "$LOGOFF_TIME" ]; then echo "Online now" else echo "$LOGOFF_TIME" fi fiUsage, if you save it as lastseen.sh, would be ./lastseen.sh PLAYER_NAME
However, I'm working with PHP, not bash shell script. Originally, I tried to dynamically generate a shell command to pass to shell_exec(), but a) it never worked right, and b) it ended up being more complex than I originally thought. I was originally just getting each user's last logoff time, neglecting the fact that they could be presently on the server.
The "solution" was to copy/paste my shell script I was trying to shell_exec() into an external file and chmod +x the fucker. Then my shell_exec() call became simply running that shell script with the name of the player on the command line. It works, but using shell_exec()... yeah...
However, the functionality for grep (preg_grep()) and what I'm using sed for (preg_replace()) basically already exists in PHP. While I'm a fan of writing things in the languages that make them the easiest to write, the result looks rather cobbled together and tends to break when you think about portability. All PHP really needs is a native implementation of tail -n and we're good.
Which it doesn't have. My next step was to sift through Google search results and see if anything of use popped up.
Initially, all I could find were tail -f implementations. That allows live monitoring of a log file, which admittedly can be useful, but wasn't what I needed. I just need one stinkin' line out of the file. After sifting through the results, I noticed that one of them was indeed an implementation of tail -n. However, it didn't operate in the way I needed it to. Instead of taking in data and returning the last few lines of it, it required the data to be in a file. Being that I'm passing the file through grep first, it wouldn't work.
Then I derped and realized that it's way easier than I thought. If you read in the complete file with the file() function, you get an array of strings where every string is a single line of the file. preg_grep() operates on an array. So, basically, all I needed to do was this:
function tail( $data, $lines = 10 ) {return array_slice( $data, count( $data ) - $lines, $lines ); }*nix tail defaults to returning 10 lines, so that's why the $lines parameter has a default value. Even though I only need it to return one line. The solution could actually get simpler still, but I'm leaving it this way. preg_grep() leaves the array indices the way they were, but array_slice() renumbers them and makes dealing with the result a lot easier.
So if you need a PHP tail -n implementation and you're reading a file in via file(), just use array_slice() to get the lines you need.
All in all, I ended up with this:
function tail( $data, $lines = 10 ) {return array_slice( $data, count( $data ) - $lines, $lines ); } // getting the timestamp of the most recent line in the server.log that matches a given regex // $BASE_DIRECTORY is the absolute path of directory containing minecraft-server.jar, slash-terminated // $SERVER_LOG is the Minecraft server log, read in via file() // Reading the server log only once per request makes a lot more sense than reading it once for every person on the whitelist. function get_timestamp( $regex ) {global $BASE_DIRECTORY, $SERVER_LOG; $ret = preg_replace( "/^(.{19}).*$/", "$1", tail( preg_grep( $regex, file( $BASE_DIRECTORY . 'server.log' ) ), 1 ) ); return @$ret[0]; } function get_last_seen( $username ) {$logoff_time = get_timestamp( "/^.{19} \[INFO\] " . $username . " lost connection/i" ); $logon_time = get_timestamp( "/^.{19} \[INFO\] " . $username . "\[\/[^]]+\] logged in/i" ); if ( $logon_time == '' ) // user has never logged on return 'Never'; else {$cmp = strcmp( $logoff_time, $logon_time ); if ( $cmp < 0 ) // logon time is greater than logoff time (user is on now) return 'Online now'; elseif( $cmp > 0 ) // logoff time is greater than logon time (user has logged off) return $logoff_time; else // mystery case return 'Mystery case!'; } }Two things: First, the reason that calling strcmp() on the two timestamps actually works to see which one is more recent is entirely due to the timestamp format that the Minecraft server uses. It orders the fields from least-updated to most-updated, which means that to strcmp(), a more recent date is always going to be "bigger". Second, that line in get_timestamp(), return @$ret[0];... The @ is a PHP operator that suppresses error output. PHP bitches about that line, saying "invalid index", yet, all of my debug output shows a one-element array with the sole element having an index of 0, and if the error output is suppressed, it works properly. I'm not sure exactly what PHP has stuck up its ass, but it needs to remove it.
Also, yes, technically speaking, the mystery case can be triggered. The user's logon time has to be equal to their logoff time. That's fairly difficult to achieve with Minecraft, since the server considers you logged in before you're even able to bring up the menu and hit disconnect. Hence why I'm not actually bothering to write code to handle it.
Friday, October 5, 2012
Black Mesa
This is the Source mod that everyone's been spooging about lately. It's basically a fan-made recreation of Half-Life 1 in the Source engine. When I heard of it, the first thing that came to my mind was "don't we already have Half-Life: Source?"
I'm still confused as to why Black Mesa needs to exist, but regardless, it does, and I've played a bit of it. It's not a huge priority since I've beaten Half-Life 1, but... yeah.
There are two things that I welcome over Half-Life 1's engine: you can jump while running downhill now, and there's a "quick weapon swap" setting in the options. 'Bout fuckin' time. No more having to click to select a weapon, just scroll to it or press the key just like any other FPS ever.
Using the Source engine carries a fairly hefty hard drive footprint, which means I probably won't keep it around forever. I'll probably keep it until it's actually downloadable through Steam. Also, you get the HEV suit zoom feature that Half-Life 2 has, which is cool.
Unfortunately, ammo and health are scarce, and it seems like you can't use the Source engine physics to your advantage. I got to a part where in HL1 I had to push a few crates into the water to jump on them, but in Black Mesa all the crates in the area are destructible and don't hold up very well. Barring that, I tried to use the barnacles on the ceiling to get out of the water and continue on, but that proved to be impossible. So basically I'm stuck in the water, unable to get out on either side. So there are definitely some level design issues.
And that's all I've played of it. Via the Source engine it does fix some of my gripes from HL1, but... while it's good, I don't really see the need to get all hyped about it.
I'm still confused as to why Black Mesa needs to exist, but regardless, it does, and I've played a bit of it. It's not a huge priority since I've beaten Half-Life 1, but... yeah.
There are two things that I welcome over Half-Life 1's engine: you can jump while running downhill now, and there's a "quick weapon swap" setting in the options. 'Bout fuckin' time. No more having to click to select a weapon, just scroll to it or press the key just like any other FPS ever.
Using the Source engine carries a fairly hefty hard drive footprint, which means I probably won't keep it around forever. I'll probably keep it until it's actually downloadable through Steam. Also, you get the HEV suit zoom feature that Half-Life 2 has, which is cool.
Unfortunately, ammo and health are scarce, and it seems like you can't use the Source engine physics to your advantage. I got to a part where in HL1 I had to push a few crates into the water to jump on them, but in Black Mesa all the crates in the area are destructible and don't hold up very well. Barring that, I tried to use the barnacles on the ceiling to get out of the water and continue on, but that proved to be impossible. So basically I'm stuck in the water, unable to get out on either side. So there are definitely some level design issues.
And that's all I've played of it. Via the Source engine it does fix some of my gripes from HL1, but... while it's good, I don't really see the need to get all hyped about it.
Subscribe to:
Comments (Atom)





