Friday, December 14, 2012

TCPRelay 0.3 beta


TCPRelay 0.3 beta is now available! Download the 32-bit or 64-bit version. You may also need to install the Microsoft .NET Framework 4.

What's new in this version:
  • GUI
    • NEW: the last Target URI and Listen Port values are now saved to the Windows Registry under the key:

              HKEY_CURRENT_USER\Software\StrikerX3\TCPRelay

      Now every time you restart TCPRelay the last used server and listen port should be automatically set.
Check out the official topic on XSplit's forums and see for yourself all the great feedback people gave me.

Friday, November 30, 2012

State of TCPRelay, and Natural Selection 2

It's been a while since my last update here. If you're wondering why I haven't been updating TCPRelay lately, it's mostly because there was no demand for improvements or fixes for it. Also, I work as a systems analyst and that involves a lot of programming, so it's also a matter of being burned out too.
Anyway, here's a few ideas for the next versions of TCPRelay I have written down:
  • Stream delay: I'm not entirely sure this is possible without inspecting the stream data, but this is definitely worth checking out.
  • A way to fetch server lists from other services (own3d.tv, YouTube, ustream, ...). Also enable users to add their own lists, keep them between sessions and share with others.
  • Improve localization support and allow users to translate TCPRelay to other languages.
  • Fork into TCPProbe -- basically TCPRelay with packet inspection and manipulation capabilities through .NET plugins. Could be useful for network development.
If you have any suggestions, please feel free to comment.

On another note, I've been looking for a strong, competitive FPS that's reminded me of the old, but fun formula of Unreal Tournament and Quake: fast-paced action with insane movement skills and pinpoint aiming accuracy required. Unfortunately, since 2007 (when UT3 was released), there was not a single memorable FPS that followed the formula and caught my interest, turning me off from the genre. I went on to other games, including World of Warcraft, Starcraft 2, Borderlands 2 and several casual and indie games. That is, until last month.

Natural Selection 2 was developed by Unknown Worlds Entertainment and released on October 30th. I haven't heard much about the game until then, but instantly got addicted the moment I got into a multiplayer game. It's an amazing blend of RTS and FPS with a surprisingly friendly community -- the complete opposite of most popular games such as Dota 2, LoL and Starcraft 2. People in NS2 actually help each other out, newbies ask questions and learn tricks and tactics from veterans (there's even some pro players giving out "classes" for free on their servers! See here and here); there's no split between the n00bz and the pros. Teamwork and coordination are absolutely required to get somewhere. Trying to Leeroy Jenkins your way into the enemy base *will* get you killed, unless you happen to be an Onos fighting against a bunch of rookie marines (and even then, if they know how to press the fire button and move their mouse to follow a giant suicidal gorilla-rhino-thing around, you *will* go down).

I highly recommend NS2 to anyone who has been yearning for something other than the generic "realistic" war shooter #235 with killstreaks and "realistic" gunfights, or anyone who enjoys either the FPS or RTS genres at all. It may not be as popular as LoL or Dota or SC2, but it's definitely competitive and interesting to watch. Refer to this topic on the UWE forums for a list of streams/YouTube channels/whatnot on NS2 competitive play. Oh, and it's cheap on Steam -- just 25 bucks.

Wednesday, October 3, 2012

Reminder: TCPRelay 0.3 alpha 3 released!

For those people who follow my blog/Twitter: TCPRelay 0.3 alpha 3 is now available! Check out the original post for version 0.3 and download the 32-bit or 64-bit version. You may also need to install the Microsoft .NET Framework 4. Keep in mind that this is an alpha version; some features may not behave correctly.
There were two changes to the GUI:
  • NEW: [alpha 3] application now has an icon (thanks to Fryderyk "Ziel" Dachowski!)
  • FIXED: [alpha 3] tooltips for speed buttons were incorrectly referring to "as slow as possible".

Thursday, September 27, 2012

Simplify ternary operators

One of my pet peeves in Java/C/C++/C# programming is the use of the ternary operator ?: with boolean values. It's almost always redundant, makes code harder to read and can be easily replaced by a simpler boolean expression that also has the advantage of being "branch-free" in some languages, that is, do not require the CPU to select a path of execution based on a condition, which can be very expensive. The best compilers will optimize them away in a manner similar to what I describe below, but they still don't improve code readability.

From this point onward I'll be using the Java/C/C++/C# code syntax. A boolean expression is any valid expression that results in a boolean value. This may be anything from the constants true and false all the way to complex expressions such as x == 1 && (y > 3 || z <= 1.25) && !checkSomething(x, y, z) (assuming checkSomething(...) returns a boolean).

Say you have the condition c and the boolean expressions p and q. The following table contains all possible conversions from a ternary expression to an equivalent boolean expression:

#Ternary Expressionif-then-else ExpressionEquivalent to
1c ? p : qif (c) p else q(c && p) || (!c && q)
2c ? p : trueif (c) p else true!c || p
3c ? p : falseif (c) p else falsec && p
4c ? true : pif (c) true else pc || p
5c ? false : pif (c) false else p!c && p
6c ? true : falseif (c) true else falsec
7c ? false : trueif (c) false else true!c
8c ? true : trueif (c) true else truetrue
9c ? false : falseif (c) false else falsefalse

Note that #1 may or may not result in more readable code; it is probably better to use the ternary operator in that case. #6 through #9 are poor coding practices and should be replaced as soon as possible by their equivalent boolean expressions. #2 through #5 require attention and almost certainly will result in better, cleaner code.

Also note that c ? p : q is equivalent to if (c) b=p else b=q. In other words, if any boolean variables are assigned a value that depends on the condition of an if-then-else clause, then that value can be simplified according to the equivalence table above, as long as there are no unintended side-effects.

Let's try this with an example:

boolean b = i > 5 ? j == 3 : false

or, as an if-then-else clause:

boolean b;
if (i > 5) b = j == 3; else b = false;

Looking at the above table, this matches expression #3, with:

c = i > 5
p = j == 3

The equivalent expression would be:

boolean b = i > 5 && j == 3

which is slightly shorter and certainly less confusing than the above ternary or if-then-else statements.

Friday, September 21, 2012

Now Playing: Borderlands 2

This is going to be my first gaming-related post (yay!). I had a blast playing the first Borderlands game a while ago. Picked Mordecai, grabbed sniper rifles and pistols and chose a set of skills with emphasis on sniping. Cleared the whole game, including all DLCs. Leveled to 61 (before the cap was raised to 69). Then I got bored and hacked my character to make the most insanely powerful equipment out there -- 1.2k x4 damage pistols with near-perfect accuracy and very fast firing rates (and the ability to crash the game once in a while), "god mode" shields (which displayed as negative 2 billion and never drained), insanely fast sniper rifles and even some overpowered Eridian guns, and maxed out all skills in all trees just because. I remember doing a critical hit for the maximum possible damage of 99999 with a melee attack once. Needless to say, the poor victim exploded in a shower of gibs.

Back then I didn't have a computer powerful enough to record my gaming, nor did I have an YouTube channel or a stream, so unfortunately I got (almost) nothing to show you. :(

When the sequel was announced I was pumped. I watched every trailer and every bit of gameplay and just had to play it now (er...  then). Borderlands 2 was released three days ago (September 18th), but I had to wait two more days as the game would only release on September 20th here in Brazil.

The wait was over, and I had to stream it. Unfortunately, my microphone is really bad, so I couldn't comment on the stream itself.

Here goes my personal opinions on the game:
  • Borderlands 2 has an amazing sense of humor. Claptrap's lines are among the funniest, as are Handsome Jack's and pretty much every other non-srs-bsns characters'. If my microphone was working, you'd hear me laughing about every 10 seconds or so.
  • The guns are much better polished, and each brand feels unique -- an addition I liked a lot. I quite enjoy Jakobs pistols - they let me fire as fast as I can pull the trigger, which is to say, really fast. Tediore weapons are fun; you throw these cheap pieces of garbage away when reloading and a new gun materializes in your hands while the discarded gun proceeds to explode. I also like how Bandits can't spell their weapons properly.
  • Enemies are much smarter now too, and they also feel more "natural", more "realistic". Bandits will actually look for cover or just put their faces straight into your gun, and they also seem to work as a team now. They also have better environmental awareness and try to avoid/use explosives to their advantage (at least that's how it feels to me).
  • The world is HUGE. I've partially explored three major areas and this makes about 5% of the in-game world map. Each individual area is much larger than the previous iteration's areas. You also get a bunch of side-quests right at the beginning (OK, not too early) and there's always something to do or explore everywhere. Not to mention the vistas are amazing!
  • The new UI has a bunch of improvements, but the inventory feels a little clunky and not much of an improvement from the first game. Comparing items was made easier, but equipping items isn't as simple as before. To switch a weapon, you have to go to the backpack column, click on a weapon, then click on the weapon slot you want to switch. Switching shields, mods and stuff for some reason requires the same steps as above, even though there is only one slot for each. Buying and selling items, however, is much better than before.
And now, a bit of gameplay! The video quality should improve after YouTube decides to process the videos. Oh, and sorry about some videos being cut before the actual end. You're better off watching the videos from my stream channel anyway.






You can also watch the videos on my stream channel in 1080p: 1 2 3 4 5 6 7-1 7-2 7-3 8 9 10 11-1 11-2 11-3

Also, watch me live here!

Sunday, September 16, 2012

TCPRelay 0.3 alpha 3

TCPRelay 0.3 alpha 3 is now available! Download the 32-bit or 64-bit version. You may also need to install the Microsoft .NET Framework 4. Keep in mind that this is an alpha version; some features may not behave correctly.

What's new in this version:
  • General
    • NEW: localization support for:
      • [en-US] English (United States)
      • [pt-BR] Portuguese (Brazil)
    • Send me an e-mail if you wish to add your language.
    • NOTE: only the GUI version has support for localization for now.
  • Console
    • FIXED: application no longer crashes when a connection is closed. The fix never got into 0.2.2.3 for some reason.
  • GUI
    • NEW: Localization support, as above. By default the application will use the default language set in your operating system. You can override this by passing the language code as an argument to TCPRelay.exe. The supported language codes are listed between brackets above.
    • NEW: [alpha 3] application now has an icon (thanks to Fryderyk "Ziel" Dachowski!)
    • FIXED: [alpha 2] localization should now work properly on all parts of the GUI.
    • FIXED: [alpha 3] tooltips for speed buttons were incorrectly referring to "as slow as possible".
TCPRelay finally has its own icon, thanks to Fryderyk "Ziel" Dachowski! I appreciate your work :)

Check out the official topic on XSplit's forums and see for yourself all the great feedback people gave me.