Categories
fixing your desktop

“but Gmail said I don’t have to do anything”

(Google just made a major change to Gmail accounts in the UK, now that they’ve settled a trademark case brought against them. This is great – it will simplify mailing list management for a lot of people, and everyone in the world can (legally) be “@gmail.com”)

However … I’ve now had two friends write the above (“it said I didn’t have to do anything”) when asking for help with the changeover. Hmm. When the message came up for me first time, I got that impression too, but looking at it more closely, it doesn’t explicitly say that:

gmail changeover screenshot instructions

Anway, two friends in quick succession is a suggestion that I’m going to have to answer this question a few times. Instead, from now on I’ll just send them a link to this blog post :). Copy/paste of my original response:

Sorry, Google’s instructions aren’t very clear. You need to click the “more info/FAQ” link to get the “true” instructions, which include this gem:

“Mailing Lists: If you have signed up to send mail to mailing lists on behalf of your @googlemail.com address, you might need to re-register for the group using your @gmail.com address. Google Groups will automatically accept your new address.”

…although Google is being disingenuous when they say “might need to” – they know that *most* mailing lists will require you to manually change address, re-signup, or ask the admins to change your address :).

I like the visual approach that Google took here – the page is simple, clearly formatted, etc – but it’s tragic that it fails to include the critical information. “Breaking every mailing list you are on” should not be relegated to “Have questions? Not sure you want to switch?” – it should be right there on the main screen with a big red warning sign. I’m intrigued as to how the page was designed: it’s hard to believe that the usability people missed something as obvious as this. Are mailing lists not used that much by Gmail users? Even harder to believe. Have mailing lists fixed the gmail/googlemail problem? Possibly, but none of the ones I administer have (mostly for orgs that are using mainstream “free” list managers).

Categories
games industry recruiting

More “interesting MMO/online games jobs”

Here we have Zynga recruiting for a CTO in SF:

(see also the last post, on UK online games jobs)

Categories
massively multiplayer recruiting

UK games companies are hiring (2010)…

UPDATE: I’ll add other roles in as/when I get the OK from the relevant people; not all of these are public yet.

Despite the heavy rash of studio closures (well documented by Nicholas Lovell), it seems there’s a lot of exciting online/social games hiring going on right now – I’m getting lots of requests from friends, ex-colleagues etc.

  • Head of Mini Games at Mind Candy (London-based social games startup; runs a successful kids MMO – Moshi Monsters)
  • Financial Manager / Social Gaming Economy Modeller and Virtual Goods Data Analysis at Lockwood (Nottingham-based online / virtual world startup; built most of the cool stuff in PlayStation Home, now building their own MMOs) – *entry level

There’s also some interesting roles in publishing, and some in startup online games companies.

If you’re UK-based, you’ve worked in MMO / social games / etc, and you’re looking for a job, feel free to email me. No CV’s, just tell me who you are and what you’re looking for in 4 sentences or less.

Or, if you see an entry-level job here you want to apply for, ditto and I’ll put you in touch (or just follow the links to the company directly).

Categories
recruiting

Google, your attitude sucks

Dear Eric … here’s my problem:

Somehow that didn’t feel right for Google. We wanted something much more transparent and open” (Eric Schmidt, Chairman/CEO Google, writing in the Harvard Business Review this month)

How, exactly, would you reconcile that with the fact that I had to serve Google with a legal document (here’s how to use the Data Protection Act of 1998) to get the feedback that your employees admitted they already had?

How do you explain the difference between the 10 seconds of feedback I received from your in-house recruiter, and the 12 pages (yes, *pages*) of feedback I received after I served the legal notice. Is this transparent? Is it open?

I’ve met many Googlers, and a lot of them are excellent salespeople for the company. If I truly believed that Google lived up to it’s claimed principles, I would go to great lengths to work there. Why devote my time, the precious days of finite life, to any other kind of organization? Before the interview process, I *did* believe, thanks to the testimonies of friends and ex-colleagues.

But the reality is clearly – “transparently”, to use your terminology – different. And it’s only thanks to the insightful and diligent work of UK lawmakers that I got anything out of Google at all. Amusingly, you didn’t even pay my travel expenses! Ironically, at the same office, when I went to the London Open House party, many years ago, I provided less … and received more … than when *you* asked *me* to come to an interview for a job. Surely that’s the wrong way around?

(I’ve still got my Google Open House t-shirt, and I got free food and drinks at the event. Thanks! That’s more than I got from the interviews…)

Personally, I have huge respect for people. I believe it’s the most important thing *for me* in any business. There are industries where individuals don’t really matter – I actively choose not to work in those industries. As experienced first-hand, my values wouldn’t allow me to work at a corporation like Google.

Why is it acceptable to those of you who work there now?

Footnote…

So, Google doesn’t live up to the hype? Shrug. My reaction: I’m building my own company that does. I’m not going to sit around waiting for someone else to make it for me.

Also … about that 12 pages of feedback… I checked with Google whether they’re OK with me publishing it (me, I really do strive for transparency ;)) – they said something very close to “it’s your data – do you what you want”. I’ve already sent it to a wide array of friends and ex-colleagues – people who know me well enough, both good and bad, to read between the lines and second-guess the context.

But it’s hugely context-dependent (i.e. you had to have been there to understand what’s going on), and there’s some extreme statements in there. It would be very easy to misinterpret, sometimes making Google look much worse than it should, sometimes making me look much worse than it should. I’m conflicted on how to publish it; transparency is great, but … you have to consider your personal responsibility too.

Categories
amusing programming

“Not satisfied with the number of deaths and permanent maimings from that invention he invents C and Unix.”

Beautiful, and disturbingly accurate.

Categories
entity systems games design massively multiplayer programming

Entity System 1: Java/Android

Please note: the design described in this blog post has been much improved and updated and put up – with full source – on http://entity-systems.wikidot.com/.

On the wiki linked above, there is now a wholly new Entity System design, based on this one, but much improved. There’s a brief post about it here, recommended instead of this ES design: http://t-machine.org/index.php/2011/08/22/entity-system-rdbms-beta-a-new-example-with-source/.

I’ve been writing about Entity Systems sporadically for the last few years. Recently, I finally had the time and the excuse to build one of my own (i.e. not owned by an employer). If you haven’t read the main series of ES posts, you should do that first. There are many things in the world masquerading under the Entity/Component banner – and even more that just coincidentally share the name, but describe something else completely. It’s worth understanding which variant I’m talking about before you read about what I’ve done :).

Why build an Entity System?

At a generic level, this is covered in the other posts. But it’s taken years for me to have the time/inclination to write a new one from scratch outside of my day-job. What happened?

  1. I left my iPhone in America, and it took 2 months to get it back
  2. Google gave me a free Nexus One, in the hope I’d write something for it (ha! Their cunning plan worked…)
  3. The Android marketplace is such a miserable morasss of third-rate crap that eventually I was compelled to write my own Android game … just so that I would have something to play (there are very few games on the Android store that are even worth the time it takes to download them)

I’ve been making games for a long time. I know how much effort will go into it, how much time, and how much slog there is before it becomes worth it. Writing a game on your own often means putting in 90% of the effort to get 10% of the reward.

Enter … the Entity System. If I were to pick a game-design that mostly used data-driven game features, I could implement it around an ES, and massively reduce the amount of planning needed to get the game running. I could maybe have a working game after a mere 20% of the effort. Hmm…

Building the ES for Android

Android runs something that’s *almost* Java (although more on that later – Android’s version of Java is very slow at some of the core libraries, and it really shouldn’t be). Technically, Android supports all the core data structures from Java (Collections), and the templating system (Generics).

If I were writing an ES in C++, I’d do it using templates without pausing to think; I wondered how well the same might work with Generics, given that Generics is *not* a complete templating system, although it provides quite a lot.

Getting started: early ES decisions

How to design/implement this thing? Well, we know one thing for sure:

Entities have a single name/label/global-ID. Entities MUST NOT contain ANY DATA: these are NOT objects, this is NOT OOP!

There you go, the Entity class wrote itself:
[java]
public class Entity
{
public int id;
}
[/java]
This immediately raised some concerns for me, being the seasoned coder I am (ha!). How the heck was I going to write any code that dealt with these things if I didn’t have references to them? Obviously, sometimes you do have references, but other times you expect to follow refs from within the objects you have, to get to the objects you need. That wouldn’t be happening here, since there are no inter-object refs.

[java]
public class BaseEntitySystem implements EntitySystem
{
/** I’m too lazy to write a "safe" method to get a globally-unique ID; for now,
I just return 1 the first time I’m called, 2 the second time, etc… */
protected int getNextAvailableID();

/** Whenever you create an entity, you’d better invoke this method too!*/
public void registerEntity( Entity e );

/** The method to solve my fears above */
public Entity getEntity( int id )

/**
* Merely removes the entity from the store. It becomes a GC candidate
* almost immediately (since all other refs are transient)
*/
public void killEntity( Entity e )
}
[/java]

…but, again, being a Veteran coder, the survivor of many painful battles on the field of programming … I didn’t trust myself in the slightest to “always remember” to invoke registerEntity. Quick trick: give the Entity class a static reference to a default EntitySystem, and have each EntitySystem check if that reference is null when starting; if so, set itself as the “default”.

[java]
public class Entity
{

public static EntitySystem defaultEntitySystem;

public Entity( int i )
{
id = i;

if( defaultEntitySystem == null )
throw new IllegalArgumentException( "There is no global EntitySystem; create a new EntitySystem before creating Entity’s" );

defaultEntitySystem.registerEntity( this );
}

}

public class BaseEntitySystem implements EntitySystem
{

public BaseEntitySystem()
{
if( Entity.defaultEntitySystem == null )
{
slog( "Setting myself as default entity system (Entity.default… is currently null) self = " + this );
Entity.defaultEntitySystem = this;
}
}

}
[/java]

W00t! I can create Entity’s, and I can find them later on. Awesome. What about those Components, then?

Getting started: Components in Java

I’ve done ES in C++ before, with real templates, so I wasn’t really thinking at this point … I just ran with what seemed natural based on prior experience. The thought process (had there been one) would have been something like this:

  1. This is java, I use Eclipse: I absolutely *must* have the IDE know what data/fields exist in each component so that Content-Assist/Autocomplete works 100%. Otherwise I will gouge my own eyes out having to remember, and doubly so each time the app compiles but dies at runtime because of a typo in a field-name.
    • Requirement: each unique Component must be defined as a java Class, with each of the fields being a public member of that class
    • Requirement: to access a Component of a given Entity, you must invoke a method which returns something that is typed (as in language typing) to the correct Class

I made a Component class, and had all Components extend it; there is a particular reason for this, but it doesn’t matter right now – essentially, it lets you define shared behaviour for all Component subclasses, and just saves you time on typing.

My first real Component:

(NB: I defined this *inside* another class, because I couldn’t be bothered having N source files for the (large number of) N Components I was bound to create. Hence the “static”):
[java]
public class MyEntitySystemExperiment
{

static class Position extends Component
{
float x, y;
int width, height;
float rotationDegrees;

@Override public String toString()
{
return "("+super.toString()+" @ ("+x+","+y+") * rot."+rotationDegrees+")";
}
}

}
[/java]

Great. I have a component. Now comes the largest single piece of work in the entire implementation of the ES: writing the methods to:

  1. Add a component to an Entity
  2. Fetch a component from an Entity
  3. Remove a component from an Entity

Fetching a Component from an Entity

This is the win/lose point: if this works well, our ES will be nice and easy to use. The other two methods (add and remove) are simply twiddling bits of data. This one is the challenge: can you make it *easy* to write code that uses the ES, and for that code to be clearly *understandable*?

[java]
public class EntitySystemSimple extends BaseEntitySystem
{
HashMap<Class, HashMap<Entity, ? extends Component>> componentStores;

public <T> T getComponent( Entity e, Class<T> exampleClass )
{
HashMap<Entity, ? extends Component> store = componentStores.get( exampleClass );

T result = (T) store.get( e );
if( result == null )
throw new IllegalArgumentException( "GET FAIL: "+e+" does not
possess Component of class\n missing: "+exampleClass );

return result;
}

}
[/java]

Boom! It works.

Let’s just stop briefly and I’ll explain why. Reading Java generics code from cold (just like reading C++ templates) often takes a lot of hard thinking.

Looking at the “result” of this method, we want it to be (enforced by the compiler):

  1. “an instance of a class that extends Component”
  2. “an instance of the particular class/Component that we requested – not just any old subclass”

[java]
/** based on comments at end of blog post, think this is correct,
but not checked */
public <T extends Component> T getComponent( Entity e, Class<T> exampleClass )
[/java]

It causes you to write application code that looks something like this:

[java]
public void doSomethingWithAnEntity( int globalId )
{
// remember, we NEVER hold refs to Entity objects for long
Entity e = entitySystem.get( globalId );

Position position = entitySystem.getComponent( e, Position.class );
position.x = 5;
}
[/java]

…and what’s important is that the “type” of the “Position position = …” line is already hard-typed to “Position”. So, the content-assist will *auto-complete* anything put after a dot on the end of that line, e.g.:

[java]
entitySystem.getComponent( e, Position.class ).AUTO_COMPLETE
[/java]

…so you can instead write your method much quicker, and yet very clearly, as:

[java]
public void doSomethingWithAnEntity( int globalId )
{
// remember, we NEVER hold refs to Entity objects for long
Entity e = entitySystem.get( globalId );

entitySystem.getComponent( e, Position.class ).x = 5;
entitySystem.getComponent( e, Damage.class ).hitpoints = 145;
entitySystem.getComponent( e, Renderable.class ).foregroundColour = Color.red;
}
[/java]

Time-out: HashMap

HashMap is the “correct” class to use in Java for this setup: it’s the exact equivalent of Hashtable / Dictionary / etc in other languages. We need to map (somewhere, somehow) from one thing (an entity) to another thing (a component).

NB: this does not mean that you have to use HashMap as your data-store for the ES; I positively encourage you to consider other options. I used it here as the most obvious, simplest possible structure that would do the job. If you think back to my posts on Entity Systems for MMO development, I’ve often suggested that the data store could *and should* be any of many different things. In particular, SQL databases make for an excellent data-store (and remember you can get in-memory SQL implementations that do away with all the expensive write-to-disk stuff).

Unfortunately … Android seems to only partially support HashMap. You can use the class, but it runs an order of magnitude slower than you expect for a normal JVM (compared to the speed with which it runs other methods). It seems to have problems with the hashcode methods, but also even with basic iteration over the Map contents. Odd. Later on, I had to do some tricks to speed up the ES, just because of this problem.

Fetching a Component from an Entity: Redux

The examples I gave above for accessing components were lean and clear on the right hand side (thanks to autocomplete and strong typing), but terrible on the left-hand-side. By the magic of OOP, I’m going to clean up the LHS. BUT (and this is a big “but”) … make sure you fully understand what I’m doing here. With what I’m about to do, it would be very easy to fall into one of the traps of ES development: slipping back into OOP techniques.

Looking at the example:

[java]
entitySystem.getComponent( e, Position.class ).x = 5;
entitySystem.getComponent( e, Damage.class ).hitpoints = 145;
entitySystem.getComponent( e, Renderable.class ).foregroundColour = Color.red;
[/java]

… applying OOP mindset, we see that the first argument is redundant; the Entity already knows about the EntitySystem to which it’s registered.

Also, we know that the Entity class will never have any methods or data other than the ID. If that’s the case, the only thing we’d ever “get” from an Entity is a Component. So, we can add this to Entity:

[java]
public class Entity
{

/** Gets a filtered view of the entity’s data, only returning the subset that
* corresponds to a particular one of its components */
public <T extends Component> T getAs( Class<T> type )
{
return source.getComponent( this, type );
}

}
[/java]

…which converts our usage example to:

[java]
e.getAs( Position.class ).x = 5;
e.getAs( Damage.class ).hitpoints = 145;
e.getAs( Renderable.class ).foregroundColour = Color.red;
[/java]

Using the ES with Systems

Recap: right now, we can:

  1. Create entities
  2. Add components to entities
  3. Read/Write the data inside each component, on a per-entity basis
  4. Fetch entities by globally unique ID

One last thing is needed before the ES can work: we need a way to fetch Entities “by component”.

e.g.:

[java]
public class MyEntitySystemExperiment
{

public void runLoop()
{
while( true )
{
// move all the entities
positionSystem.move( MOVEABLE_ENTITIES );

// check for collisions
collisionDetectionSystem.process( MOVEABLE_ENTITIES );

// render all the visible entities
renderingSystem.render( RENDERABLE_ENTITIES );
}
}

}
[/java]

We need a way to provide the arguments that are capitalized above. We know that these should be plain-old lists of entities. We know they have to come from the EntitySystem. Finally, we know that the only defining characteristic of these lists is that everything in the list has *at least* a particular Component.

(respectively, in the example above, the lists contain: “all entities that are moveable”, “all entities that are moveable AND all entities that are barriers to movement (e.g. solid walls)”, and “all entities that should be displayed on-screen”)

So, one more method for the EntitySystem interface:

[java]
public interface EntitySystem
{

public List<Entity> getAllEntitiesPossessing( Class… requiredComponents );

}
[/java]

“Class…” is just a convenience; in many cases, you’ll be insisting on a single Component. In many other cases, you’ll be insisting on a set of components. Java varargs provide the minor convenience of doing both of those in one method, while retaining type-safety.

The implementation of this method is obvious: it iterates over every entity that’s been registered, and checks it against ALL the required components. If it possesses all of them, it goes into the output list.

Finis

That’s it. So easy! Obviously, there’s more to it – the other methods you need to create should be mostly self-evident – but this should be enough to get you started.

Now, I’m not sure where to go from here. I’ve got a working Java ES. I’ve got some performance improvements and feature improvements. But … in practice, hardly anyone writes games in Java (except Android programmers, and there aren’t many of those), so … is it worth it?

Alternatively, I might just run through some of the practical pros and cons I encountered when actually using the ES in writing the game-logic. There’s some interesting things that came up which most people encounter sooner or later when doing their first ES, and which might be worth looking at in more detail.

One last thought…

Did it work? Did this ES allow me to write a decent Android game?

Yep. I wrote a space-invaders / bullet-hell game with it. It worked fine on Android phones for a hundred-odd enemies and bullets on screen. On Android, thanks to the crappy JVM, it started to chug after that (dropped below 30 FPS), so I had to make some substantial performance improvements, and now it’s happily rendering 300 things all flying around at 20-30 FPS. The game is far from finished, but it’s playable and fun for a minute or so – a definite achievement considering how little of it I’ve written so far.

many-entities-at-10-fps

NB: it’s got some way to go before I’ll be happy releasing it. But, given a few more spare evenings, I hope to get this up on the Android Market as a free download in the near future.

I’m pleasantly surprised that the Android phones can handle something as high-level as an ES, in a pure, unoptimized “simplest possible” implementation.

Did this post help you?

You can say “thank you” by giving me your email address, and letting me contact you next time I make a game of my own:

[smlsubform emailtxt=”” showname=” mailinglist=”pif-entity-systems”]
Categories
recruiting

Exposing the Weak Recruitment Agencies: 2 more

Two more firms have proven their mettle this week (i.e.: think twice before engaging them).

As always, it’s nothing personal. If a recruitment agent is doing a job that I and others think weak, but managed to persuade an employer to pay them to do it – and to accept that standard – then all power to them; they’re just making a living. No employer is ever “required” to use an agent, and they have many to choose from; they have no excuse for not insisting on high standards. Shame on the employers for screwing-up their own employee-base like this.

See here for more examples:

  1. Lorien
  2. Aardvark Swift

Ravello/Enigma

First up, we have Ravello/Enigma, with two big faux pas.

1. You didn’t even bother to read my profile before you approached me. Hmm.

I double-checked. Yep, it’s still there, in black and white (and caps lock):

“NOTE CAREFULLY! * I only add people I actually know.”

2. You cold-contacted me with a job, and then refused to tell me what the job is. Or who it’s for. Or, in fact, *ANY REASON* I might be interested.

Recruitment Agent:
“I have the following role for you:
Job type/s: 2 roles. 6 months fixed term contract or 1 year perm.
Salary: Wide open but depends on experience really.”

Me:
“What’s the actual role? I’m guessing this is iPhone related? My standard rate for iPhone development and consulting is X”

Recruitment Agent:
“The project details are top secret as my client advised me but it is an Iphone/Ipad related role. As stated before, salary depends on experience.”

WTF? What is this – MI6? The CIA?

I tried to think of an intelligent response. I failed. Maybe I’m supposed to be “intrigued” and start begging the Agent to give me some information? “Artificial scarcity” and all that?

Frankly, I have no idea. Just too weird.

Unique Selection

Second, we have Unique Selection, asking me to do their job for them gratis (the job that they get paid to do…).

1. How many times do you have to ask me to sell-out my network to you (which – as noted above – if you bothered to read my profile you’d see I’m not going to do) .. before you get the hint?
  1. “Also, could we connect on LinkedIn?”
  2. “In the meantime if we could connect on LInkedIn that would be great”

On the third attempt I relented and pointed the agent at my profile. The one they should have read to start with.

2. Why would I do your job for you? And, even if you were paying me to find you candidates, why on earth would I not hire those people myself?

Agent:
“I wasn’t sure if you could help me but my client is looking for an perm iPhone/iPad App developer to join their team”

Me:
“I run an iPhone development team”

(basically: I couldn’t believe they were really that cheeky / dumb as to ask me to do their recruiting for them.)

Agent:
“If you were to go perm, what would roughly be the base you would look for?”

Me:
“I’m probably not interested.”

Agent:
“please feel free to pass my details to anyone you think could be interested.

Ah, yes, because those of us who actually “make things” have nothing better to do than offer ourselves up to be exploited so that recruitment agents can get a pay-cheque. Social security, eat your heart out…

Categories
social networking

John Say: Please **** your network on Ushi

I’m getting messages every day from John Say (of Say Design) pushing me to join his network on Ushi.

Ignoring them had no effect; I’m now routinely forwarding these to google’s spam box.

I’m amazed that in 2010 people would send out an “invitiation” to their business contacts without bothering to provide the recipient with ANY REASON why they’d want to say yes. Cluetrain, guys?

(Also: John, and everyone else, please stop. This shitty service doesn’t even include an email address for me to ask you directly)

Categories
amusing social networking

When Google SEO goes unmaintained too long…

Interesting search result for “O2 Facebook”:

facebook mobile o2 myspace

…IIRC that started off as a service for MySpace, then MySpace/Facebook. Apparently now it’s all about Facebook (only). The only mention of MySpace is a navbar link to something about broadband – seemingly unrelated.

PS: Entity System post coming soon, for those that look for such things. I’ve just written one for Android. I just have to take the time to write the damn thing up!