Anthony's Blog

January 8, 2010

PHP Oddities

Filed under: PHP — Anthony Iacono @ 9:06 pm

A few days ago, zero asked if there was a way to convert data from WCS to War3Source. “Of course,” I replied. This morning I made a simple PHP script which simply iterated through the existing entries a few times to convert this data. I wanted to ignore bot data, since if I was to ever actually add bot data it wouldn’t be saved, but rather randomized depending on current server conditions. Anyway, to achieve this I found the PHP function strpos() which simply finds a substring inside a string and returns the position, if none is found FALSE is returned. However, since FALSE evaluates to 0, if the string was found at position 0 then my if-statement was going to fail. Turns out, from the PHP documentation:

This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE, such as 0 or "". Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.

I find this kind of odd. Why not just return -1 for not found? Who knows, but according to KnyghtMare of the #php channel: “[I]t seems the functions in the php core are meant to show off the [PHP] type juggling.”

I agree, this seems quite odd to me though, I still believe that an integer comparison to -1 is quicker than checking type and value, but I suppose it doesn’t matter much.

January 4, 2010

War3Source Design Focus

Filed under: SourceMod, War3Source — Anthony Iacono @ 3:15 am

War3Source has come a long way since its initial development in 2007. I spent a lot of time trying as I might making sure that the design was dynamic, yet constrained. It was very important to me that there were some static elements, such as the amount of skills per race. This, in my opinion, was the biggest problem in the design of WCS, which is an EventScripts derivative to my original Wc3 Source 2.0.

The only people using this plug-in were those that seemed to enjoy running a server with hundreds of races, all of which had extremely identical behavior, and most of which were privatized and over-powered. I don’t ever want this for War3Source, I have nothing against lots of races as long as they are unique and balanced to an extent. I feel as if this was completely overlooked in the design of WCS, and personally I feel it will lead to it’s downfall.

Once I had released Wc3: Source 2.0, I began doing a lot of thinking. It was slow and buggy, which is something that will always haunt EventScript’s based design. Don’t get me wrong, the software is neat there are hundreds of design flaws that won’t go away any time soon. Even the WCS: Python seems to be plagued with dependencies and over-complicated documentation.

SourceMod runs plug-ins that are written in SourcePawn, and this language supports native functions. These are neat because it allowed me to design a very extensive  interface (which even though has decent documentation, could use some more exposure.) For example, instead of defining each race in a keyvalue structure, which is the same behavior that WCS has, races are plug-ins that call War3_CreateRace, and items are coded in the same fashion. Using this interface, I am able to allow for multi-game compatibility (War3_GetGame) as well as make minor changes to the functions without breaking any compatibility with races and items.

At times I think that War3Source may have been better off as a C++ SourceMM plugin that exposed natives the same was as it does currently, and who knows, at some time this is a possibility. However in the past, as well as now I feel the advantages of cross-platform and multi-game compatible binaries outweigh this overhaul.

Kind of a “blah blah blah” post, sorry.

January 3, 2010

Impulsive

Filed under: About Me, Linux, Operating Systems, Windows — Anthony Iacono @ 8:50 pm

I tend to be a bit impulsive, whether it be for the worse or the better. For example, the time from me deciding I wanted to start back on War3Source, and me purchasing the domain was less than 5 minutes (Really, it was.)

The other night, I was trying to find a file on my computer. In Windows XP, this was very easy. The search tool was straight forward, select the directory to look in, input queries, search hidden and system folders? However, ever since Windows Search Tool, which seems to have integrated itself into the Windows 7 GUI, it has been terrible. Half the time files don’t show up, which Windows blames on me “not indexing them.” In XP, I don’t even remember ever seeing the term search indexing. Don’t get me wrong, it makes things go faster, but I personally feel like it should be a transparent operation when searching. Whether you want to index or not is your responsibility.

I’ll get to the main point. I split my partition in half like a judo chop, and installed Ubuntu 9.04 onto the additional partition. I have always been a fan of Ubuntu, my mother and brother Nicholas use them as primary operating systems on their PCs. I have never had a virus issue with these computers, and they are ANYTHING but complicated. People always make Linux out to be this “hacker uber complicating operating system,” but I mean, really, take a look.

After getting past some driver issues with my graphics card, (Hint: ATI has pretty poor linux driver support,) I was able to get to playing around. Of course there are some things that bug me, but for the most part they haven’t proven to be large issues:

  • I can’t get my existing SVN private key to authenticate, it is possible that I am either adding it incorrectly or that I can’t use the same one I use for Windows in Linux?
  • I have yet to find a simple text-editor like PSPad, everyone says to use vim but I am a GUI kind of a guy.
  • Games. There are a few solutions, Wine and VMware were considered but I ended up settling on temporarily hi-jacking my father’s laptop and installing Steam on it.

If anyone has any suggestions here, I would greatly appreciate it.

January 2, 2010

A Lifestyle Revision

Filed under: About Me — Anthony Iacono @ 7:05 am

Four months ago, I quit smoking pot. This was mostly because my father, who was and still is a pothead, had guilted me into it. At this point in time, I couldn’t thank him more. Sure, he is a hypocritical, lying asshole, but that isn’t really the point.

When I was a pothead, I really lost interest in computers. Not only that, my appetite was terrible and I was eating hardly anything, breakfast would almost make me throw up. I started programming when I was 9 years old, you could often find me in the Yahoo! chat rooms helping people with HTML/Javascript stuff, of course all being very basic, however this starting a chain reaction.

I was very intrigued with game design, by the time I turned 10 I was learning GML, Game Maker Language, which was fun because you could design a game with little to no programming knowledge. What it actually required was logical thinking, which was good because I like figuring out answers through logic, even if that may sound cliche or redundant.

I have been very fortunate in life, my mother suffered two strokes when I was age 10 and she survived, making a miraculous recovery. I began smoking pot around age 15 when my parents became involved in a nasty separation. While I do not really have anything against the health effects of smoking weed, one thing that I could not deny was that I was slowly moving away from something I had an extreme love for, computers, and more importantly software design.

I went about a year without even using my computer, and this frightened me, which in turn made me indulge smoking even more. This brings me back to the beginning of my story, when my father guilted me into quitting. I won’t go into the specific details of how he did it, but I quit absolutely cold turkey that day. The next day, I logged onto my favorite community, SourceMod. I slowly became in touch with my brain again, and about three months in I was back to my main project, War3Source.

I was more productive than I had ever been, and with the help of everyone that has supported me the project is now at stable release. Even though every once in a while I wish I could smoke to relieve some stress, I have filled this gap with my first love, Programming :)

Powered by WordPress