Archive for July, 2006

In the USA we pay 60% taxes

Monday, July 31st, 2006

Thinking of taxes, I’m reminded of certain civilization style games where you can tax your civilizations between 0 and 100%. It depended on the game. Most games leveled off between 20% and 50% at which point the civilizations would be so unproductive and unhappy it didn’t make sense to go higher.

Did you know our own tax rate in the USA is about 60%? It’s just that most of it is hidden.

Suppose you go to get a job and you negotiate 80K with your employer. You actually negotiated 100K, it’s just that you only get 80K of that. The other 20K, which your employer pays, goes to taxes.

Of course you don’t actually get 80K. About 25% of that is taxed – social security, medicare, medicaid, straight up taxes, and various other things. So now, instead of 80K, you take home 60K.

Just having 60K doesn’t do you much good. You buy things with that 60K. A lot of that is subject to a sales tax (8.5% around here). If about half of what you buy is subject to a sales tax, that knocks us down to roughly 57K. That’s not bad. Now you have to pay the business, property, and employee taxes of those you buy from. Not directly, but they pass the charge on to you. Taxes account for about 20% of the cost of a good or service. So it brings our purchasing power down to 45K.

Do you own a house? Do you pay property taxes? Mello-Roos? That’s another 10K of taxes you pay.

So in the end, without a house a person actually earning 100K a year has a purchasing power of 45K. With a house, it’s 35K.

On average that’s a 60% tax rate.

Goverment =? mob

Monday, July 31st, 2006

I got a letter from Irvine today demanding $50 for a business license renewal and threatening various additional fees if I don’t pay up.

The federal government wants a piece of the pie too. Fork over their 30% cut or else they’ll come in with guns and shut you down.

Can anyone tell me how this differs from protection money for the mob?

How to randomize a list in order

Friday, July 28th, 2006

I don’t remember the link but there was a gambling site a while back that published their randomization algorithm in an attempt to show how fair they were. It went as follows:

for each element in list
pick position in the entire list to put this element in the list.
swap elements with the current and picked position

The problem with that is that items at the front of the list will be moved more times on average than items at the end of this list. This is because items which are moved earlier (items at the front of the list) have more chance to be moved past the current index into the list, thus being picked to be moved again. This distorts the randomization curve such that items at the end of the list are more likely to stay there.

As a result, they got hacked.

Here’s the proper way to randomly sort a list in place:


void SystemAddressList::RandomizeOrder(void)
{
unsigned index, size, randIndex;
PlayerID temp;
size = systemList.Size();
for (index=0; index < size; index++) { randIndex=index + (randomMT() % (size-index)); if (randIndex!=index) { temp=systemList[index]; systemList[index]=systemList[randIndex]; systemList[randIndex]=temp; } } }

Optimizing Sofware in C++

Thursday, July 27th, 2006

Awesome article
Optimizing Software in C++

Connection graph subgraph capability added

Wednesday, July 26th, 2006

I have a connection graph which is generated by adding all immediate connections to a graph and sending that to all immediate connections. They in turn will add all their connections, and if any are added, will broadcast that in turn.

A problem that has been bugging me for a while is how to do subgraphs. Suppose you have a ring topology where each node on the ring is a server to a large number of clients. You want all clients to know about each other on the graph and the parent server to know about all its clients. However, you don’t want a particular server to know about the clients of a different server. Limiting which groups know about whom is pretty essentially for very large networks.

The way I did it was to modify the nodes in the graph to also contain a group id. Each node then subscribes to one or more group ids. For each node / edge in the graph, if that new node’s group id is not in your list of subscribed group ids, you ignore it.

It was a design decision to not forward connections which you ignore. This means that systems that are not chained in the graph won’t know about each other but without it you wouldn’t get the bandwidth savings.

Wrote a worker thread class

Tuesday, July 25th, 2006

Pretty useful and easy to use. You can cancel inputs before they are processed as well.


#include "WorkerThreads.h"
#include "RakSleep.h"
#include
#include

void *func(void *input)
{
char *val = (char*) input;

printf("%s\n", val);
RakSleep(2000);
return (void*)(val[strlen(val)-1]);
}

void main(void)
{
char *strings[9] =
{"String 1",
"String 2",
"String 3",
"String 4",
"String 5",
"String 6",
"String 7",
"String 8",
"String 9"};

WorkerThreads workerThreads;
workerThreads.StartThreads(2, 0);
for (int i=0; i < 9; i++) { workerThreads.AddInput(func, strings[i]); } printf("Input sends done\n"); void *out; while(!kbhit()) { out=workerThreads.GetOutput(); if (out) { printf("Got output %i\n", (int) out); } } workerThreads.EndThreads(); }

RakNet slowly improving

Monday, July 24th, 2006

Now that I released the “LightweightDatabase” class for RakNet I have only the load balancer to do before actively starting my MMOG. The load balancer is trivially easy. Then I will spend a few days rewriting all the documentation in wiki format so I don’t have to spend as much time maintaining it. RakNet 3.0 will mostly be just a bunch of renames, rather than new features as I planned, since I put all those features into RakNet 2.x anyway.

I’m excited to finally (nearly) start working on the MMOG. It will be a real test of my system and I’m sure I’ll find a lot of bugs at the same time.

RakNet today is making me 10X more money than it did a few years ago, although that still amounts to almost nothing. What I’m happy about is not the small money I get but that 10X more people feel it’s worth paying for than before. At any time there are several people in the forum and some posts have numerous answers before I look at them. More importantly than number of users is I can clearly see an acceleration in the number of new and retained users over time. Part of this is that I’ve been more contentious about not releasing broken builds, part is a nearly complete feature set, and part is a more active attempt on my part to give better answers in the forum.

What’s the big deal about Las Vegas?

Monday, July 17th, 2006

I hear people talk excitedly about Las Vegas and have to wonder what the big deal is.

  • Hot
  • Dry
  • An enviromental nightmare
  • Smokey everywhere, including the restaurants
  • Certain things are hugely overpriced

The first and last time I went there

  • I tried gambling on the slot machines. My wife and I put in $20 on the quarter machines and won about $2. Is that supposed to be fun?
  • A photographer charged $60, got a $20 tip, and only took 5 pictures which were so half-assed (off-center, misframed, no technique) it was obvious he was incompetent even to someone such as myself with no experience or training
  • My wife had her hair done. The hairdresser charged $200, used some cheap spray that gave her a rash, put rubber bands in her hair rather than proper hair bands, accidently took wife’s glasses, and was extremely reluctant to return them. I had to offer a bribe to get them back (I didn’t pay though).
  • I couldn’t eat at the restaurants because it was so smokey I had to hold my breath the entire time.

Titan quest is an example of graphics over gamplay

Monday, July 17th, 2006

The problem with the growth of the game industry is that every new AAA game needs to outspend every AAA game that came before it. By outspend I mean better graphics, more sounds, more models, bigger worlds, real physics, voice acting for every character, and so on. However, game sales per game are relatively the same as they always were and games cost about the same too.

What this means is that each game is a bigger risk to publishers. There are more failures each of which cost more. So publishers need to stick to licenses and sequels because they can cost less to make (Madden 2004 vs. Madden 2005) and are more likely to sell due to an installed fanbase.

Titan Quest is a good example of how this has gone wrong. It comes on 5 CDs. The world is huge, with detailed models, voice acting for all the characters, and handcrafted levels. The problem is that the game itself is boring. Although the world is huge, the gameplay is the same the last 40 hours as it is the first hour. You don’t notice the detail on the models because you will always play with the camera zoomed out. You don’t listen to the voice acting because the voice acting is boring and too slow. Plus all the usual complaints apply: The characters are unbalanced, the game doesn’t ramp up in difficulty, the story is background filler, etc.

Diablo 2, which is what Titan Quest copied, I would guess has an equal sized or roughly smaller world. Yet it is far more fun and interesting, despite being a 2D game and coming on fewer CDs.

How many games have you seen with the latest physics which have no relevance on the gameplay at all? Other than Half Life 2 that would be all of them for me. How many older games do you know of, with 10% worse graphics that are far more fun than a more recent game?

A game is not just a contract to develop thousands of models, huge worlds, the latest physics, and special shaders. It’s an artform and iterative process to make something that is fun and interesting. Judging by recent games, very few developers seem to iteratively playtest their games these days.

Fog shader

Saturday, July 15th, 2006

This is a shader I wrote, with help, that determines the amount of fog between the top of the fog layer and the ground beneath using the z-buffer. It then applies alpha to the fog based on that amount. The shader also supports fog holes where you can use a heighfield that will reduce the fog based on the image. It uses parallax mapping to give the appearance of a 3D fog basin.

Fog

The fog is less nearer the bottom of the screen because of the camera angle. It is also less around the rocks because it is closer to the ground there.

The fog does not clip the rocks because of this technique.