h1

.NET Named String Literals

March 23, 2009

I must be missing something really obvious here; I want to name a set of string literals so that I can refer to them by name subsequently. In Ye Olde Days of C it would probably have been with a 

#define LINK_BASE_URL “http://www.kfs.org/”

And then in C++

namespace Links
{
  static const char* baseUrl = "http://www.kfs.org/" ;
  ...
}

Right now I’m experimenting with Managed C++ (yes, that is the right choice for this scenario) but I can’t seem to find a painless way of simply naming a string literal. I don’t want the same string constant repeated over and over.

h1

Database “stuff”

March 17, 2009

Amongst the many internal changes to 1.30 is a fairly radical overhaul of how players get from an account to logged in with a set of privileges and access rights on a server. It used to be a wholly personal experience – a table with every individual user’s access permission-set with each individual permission.

Two of the downfalls of this approach were (1) that it was frakking insane, (2) that you couldn’t tell why this player had ALL_SPAWN.

Read the rest of this entry »

h1

RC4212

March 13, 2009

.\src\Playgate.rc(286) : error RC4212: Codepage not integer:  utf-8)

That’s right. It should be

#pragma code_page(65001)

And that’s what it was before Visual Studio inexplicably changed it to

#pragma code_page(utf-8)
There doesn’t appear to be any documentation on this error. Just change it to 65001.
h1

FakeVector

March 12, 2009

Martini’s benchmarking seemed to be pointing a big hairy performance finger at some std::vector operations putting us in the need for a trivial array-based reference implementation of the vector to play with. Martini was set to go rewrite the surrounding code but I persuaded him to give me 3 minutes to rustle up a FakeVector template he could sub in for the STL version… Et voila…

Read the rest of this entry »

h1

Look and Feel

March 5, 2009

I’ve recently made brief return forays into 3 games’ Free Trials: EQ1, EQ2 and WoW. WoW has certainly changed in ways I wouldn’t have expected – there is a little more substance to levelling up but the divides between expansions are jagged and harsh; at level 58 player lore is “dump every frickin’ quest you have and go to Outland (Burning Crusade), and then repeat at 68 when you can go to Northrend (Lich King)”. EverQuest 1 was unrecognizable to me while EQ2 just didn’t quite look the way I remembered it.

What surprised me was which game I chose to play, and my gut tells me it came down to one simple thing: Looks.

Read the rest of this entry »

h1

Boost: Something for everyone to hate

March 5, 2009

Time was I knew what Boost was. Now it’s big and messy. It comes with its own installer and builder (bjam)??? It seems they have decided to compromise on making it equally painful to install everywhere.

I needed to build the Regex library as a Universal static .lib (so I could link against it without injecting a dylib dependency, cause I know nothing about dylibs).

For anyone wanting to do likewise (imagine one of your colleagues has decided not to use the Lua or JavaScript regex libraries already available to them and drop the entire of Boost into the project instead… Until another of your other colleagues yelled at him in his German accent and then the first colleague pulled Boost back out of the project without removing the dependency)…

Build/install bjam (it comes with Boost) and then execute the following command:

tools/jam/src/bin.macos*/bjam -a \
  --toolset=darwin \
  --with-regex \
  --architecture=combined \
   variant=release \
   link=static \
   architecture=combined \
  stage

Your libboost_regex-xgcc40-mt-1_38.a file will be prepared in ./stage/lib.

I wanted the static version so that we don’t then have to install boost on our player’s machines.

h1

Pointers: not just for xmas

February 13, 2009

File this under the category of “handy coding hints”…

With the disparity between CPU performance, the benefits of CPU-cache memory and system RAM, it’s not always best to retain large caches of relatively trivial generatable data – a histogram of the last 3-4 entries might be all you need especially if you can very cheaply keep them ordered so that if 1 in 3 calls produces the same result, that result will be handy.

On the other hand, a cache might be useful if you have a comparatively small result set but a lot of users of the same results. You could then give out pointers to the result sets so that when the data changes you only have to update the cache and everyone’s effective data changes immediately. That could be quite the saving.

Just keep in mind that you gave out pointers a few minutes later when you write code that periodically expires said data. And more important still, if a few minutes later you write some code that periodically clears out the cache and rebuilds it, don’t act all surprised when the data you were pointing to seems to keep going away…

Boy do I feel like an idiot :) At least my brain caught up with me before I ever tried to actually run the thing :)

h1

Mmm, when a good class comes together

February 11, 2009

I’m so not a DBA. We’re currently working on a bunch of stuff that relates to the way the game understands permissions and subscriptions; a neccessity for work we’ve wanted to do for a while and for our Chinese partners. The database portion has been a pain because I’ve been overly focused on how performance will translate to China.

Read the rest of this entry »

h1

How not to be seen

February 11, 2009

;)

h1

Keyboards.

February 10, 2009

When Playnet gave me a Mac, I instantly fell in love with the Apple keyboard – which is basically a laptop keyboard; that sort of “Spectrum” softness (without being squishy) to the keys that really doesn’t require you “push” the keys so much as make contact with them. Lovely.

Trouble is, for 10+ years I used Microsoft ergonomic keyboards; I think my favorites were those old “natural elites” with the divide down the center of the keyboard.

With an ergo-keyboard there is a good, tactile frame of reference. With the Mac keyboard it’s real easy to lose your fingering.

So what I really want is one of these with Apple’s/laptop soft keys…