How to be stronger at your [insert creative job here]

This is the most useful thing that a manager ever did for me: he setup a standing, consistent weekly meeting with just me. The aptly-named “one on one” meeting.

 

This meeting is possibly the most powerful 30 minutes of your work week. You can know that what you say will be heard by your boss. We are all deluged with emails and passing each other in the hall while on the way to some other task. Not much chance to focus that way. Your manager has a lot to to consider when dealing with the big picture. They go to all the meetings that you consider a waste of time. They are busy people, even if they are handling a team as small as five. This recurring meeting is a block of time when you know you have each other’s undivided attention.

Software is a creative endeavor. It is also all about tradeoffs. Choosing to spend your time on the right problems, and glossing over the stuff that won’t ultimately matter. To do that, you need the big picture. The thing is, you do not have the big picture. Your manager does. How you get it is not through email threads or memos. There is only so much information that you can get from open forums with multiple people, due to politics and other factors. You get that big picture by having a conversation with your manager.

 

If you aren’t asking questions of your manager, then you probably don’t understand the situation well enough. Even if you throughly understand the project, this is time you can learn more about each other on a personal level. This will make it easier to predict each other when decisions need to be made.

 

I still struggle with this even after doing my creative job of computer software and game development for twenty years. If I wanted management, I could have it in a heartbeat. But I don’t like that it would take me from my code. As Capt. Spock said to Admiral Kirk, it would be “a waste of material” for me to take a promotion.

 

A few months ago I was put under a new manager for a new project. His suggestion was the first time I’d heard of it in my career. He tells me it became a priority after reading “Managing Humans” by Michael Lopp. I do not fear end of term reviews, or getting close to crunch time. This is because I know that my manager has told me what to expect, and I was able to tell my manager what I thought we can do about it, all long before it happened.

 

Ask for 1:1 meetings. Make use of them. You both need to know about each other’s expectations and concerns as early as possible.

Warp Shader References

Tonight I did a presentation at a Unity3d user group.
I referenced a few items in the discussion that I thought might be helpful to have direct links to.

Basic Shader
http://docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html#simpleshader

Creating Shaders – Surface Shaders, but have a lot of solid basics
http://unitygems.com/noobshader1/#prettyPhoto

Unity Sample Assets
http://blogs.unity3d.com/2014/01/17/new-sample-assets-beta/

Final Shader (with a few tweaks beyond the presentation version)
http://dwulf.com/source/Fudge%20Ripple.shader

All games are engines

Write your game code so it can be re used, and your next game benefits from it. Ideally only the things that make your game unique will not carry over to the next game.??

Here’s the setup: I spent time fixing up a chunk of code for use in our asset pipeline. However, my lead coder had his own feelings about an addition I had made. What follows is my response.

 

It appears to me that there is a fundamental difference between how you and I approach coding. Please correct me if you feel this is wrong:
– you are concerned with making changes for the sake of this project.
– I am concerned with making changes for the sake of *all* projects.

This strong typed id is a perfect example. You do not feel it is a good fit for this project. Okay, I can certainly live with that. But not every game team will necessarily make that choice. And that is the core difference.

At the same time, I do not feel that we should have custom versions of scripts and sources that are specific to particular games. This leads to maintenance nightmares. It is better to have one reusable script that has options to allow each targe team to make those decisions for themselves. Then when bugs are identified and fixed by one team, Then all teams can share the knowledge without having to import it into their custom version. It just “works”. Not to mention that additional features can be created and shared to all with minimum of fuss.

There is a limit to how much options should be available before the script is fundamentally different from the original base one. But a properly designed script or bit of code will only be doing one task, and most of the time, there is rarely more than one good way to do that task. This very fact automatically limits how many options are needed in the first place. If the task is so different that it needs a lot of extra support options then it is probably doing a completely different job and is no longer sticking to one task, and should be decomposed into multiple sources instead.

One script = one task. ??Likewise, the thrift making script does one task, and is fairly compact. I do not believe it should be split into multiple files because it already adheres to this principle. To split it would make the code harder to read, not easier.

Just because it is capable of the strong typed Ids does not mean you have to use it that way. It still processes a non typed id in the same way it did. As proven by converting the existing data set. It is improved with some other cleanups that are related.??

 

I feel that few game coders consider these kinds of issues all at once. And I think we could be making much better games if we were to simply design the basic stuff reusable. Much more of our games is basic stuff than most want to admit.

Boycott Bad Developer Tools!

I’ve been at this game coding thing a long time now. Long enough that I’ve noticed a difference in attitude of game coders who have been around as long as I have.

 

We wonder why our development tools have gotten *worse*, not better.

 

Agile and other high level methodologies are a fine thing. I make use of their ideals all the time. But that’s not what makes me productive. What makes me productive is that I’ve chosen the right tools for my job. But not the mainstream tools – because the mainstream tools have gone to the dogs.

CodeWarrior – anyone remember that superb Metrowerks development environment? That was the one reason I stayed with Macintosh computers for so long. At the time, Windows had Visual Studio. Which was an all-in-one window, covers the whole screen with wasted UI, sloppy, slow development environment.

The only IDE to surpass it was Xcode 3. Apple clearly learned a lot. And it was a superb run. Yes, they defaulted to an all-in-one interface, but they were smart enough to embed a way to break it up into the highly effective multi-window design of CodeWarrior. They knew where their bread was buttered.

 

There is an online radio show by a couple of smart guys. Apparently they are the guys behind the (most awesome) RAD game tools. I was using their stuff twenty years ago. And I’m both pleased and impressed to see they are still going strong. The Jeff and Casey Show, April 2014. They were expounding upon how they don’t care about high level tools when our low level tools have progressively gotten worse and worse over the years.

One thing they said rang so very true with me: we need to boycott these crappy development tools until the vendors realize that this is crap. Visual Studio not updating variables immediately during single steps? Two minutes to do a single run in Xcode just to install a *debug* version on an iOS device? And we won’t talk about 3 minutes for building the dSYM file. How can we possibly get anything done when we are spending so much time just waiting for our computers to do what a decade ago took half as long?

And yet we are in no real position to do anything about it besides cross our fingers and hope something changes. We have to use these tools because they are the only way to get our code past the gatekeepers. Or are we?

 

So I am productive – because I don’t use the gatekeepers. I use Unity3d, which lets me do everything in a very well designed *simulator*. (It’s a shame the MonoDevelop IDE is terrible, but it’s still faster than Xcode or anything else.)

 

Boycott these crappy development tools – and make better ones!

Embedded IDs in Network Structures

Here’s an issue I’ve been wrestling with and cannot come up with a solid solution:
Should IDs be included inside structures, or is that metadata that should be encapsulated at a higher level?

Here is a more concrete example. We are tracking the state of a given Fighter in the game. This is a stateless server environment, so we need to transfer as little information as possible, but we must still describe everything. We assume there is a larger datastore on the server that has additional constant “definition” information for each Fighter.

Here is what the definition looks like for the external metadata version. Incidentally we are using Thrift, but the issue is the same in any environment.

// current state for fighter.
struct FighterState {
1: required i32 CurHealth;
2: required i32 MaxHealth;
}

struct FighterList {
// indexing
1: required map<FighterID,FighterState> fighters;

// connects a fighter to the definition datastore.
2: required map<FighterID, string> definitionIndex;
}

Immutable information is clearly separated from mutable. However, every method that needs to operate on a Fighter requires two parameters: The FighterList and the FighterID to identify which one is involved.

So this is what the information looks like if we encapsulate it all in one location.

// current state for fighter.
struct FighterState {
// indexing. this is immutable.
1: required FighterID FighterID;
2: required string DefinitionID;

// actual state
3: required i32 CurHealth;
4: required i32 MaxHealth;
}

This produces a mixed-mutability object. This feels less than ideal. Every time I transfer the state between client and server, I repeat the DefinitionID. However, if I want to pass a Fighter to a method, I can simply pass the FighterState and have enough information.

So let’s approach this in another way. What if we use compositing?

// current state for fighter. This is mutable.
struct FighterState {
1: required i32 CurHealth;
2: required i32 MaxHealth;
}

// immutable
struct FighterInfo {
1: required FighterID FighterID;
2: required string DefinitionID;
}

// combine them for runtime use
struct Fighter {
1: required FighterState State;
2: required FighterInfo Info;
}

We have now clearly separated the mutable from the immutable. We also can pass just the one Fighter to methods. But this feels very wordy. Also, the needs of the client and the server are slightly different. The server needs the complete “view” of the fighter definition, while the client can use a trimmed down “view”.

This can be simplified by merging the FighterInfo into the Fighter. Not quite as clean of a separation, but it maintains the mutability model.


// current state for fighter. This is mutable.
struct FighterState {
1: required i32 CurHealth;
2: required i32 MaxHealth;
}

// Network view of the fighter. It includes a mutable base, but the additional fields are immutable.
// This is minimal information for sending across the network.
struct FighterNetworkView {
1: required FighterID FighterID;
2: required string DefinitionID;
3: required FighterState State;
}

// the server is now able to add additional information – the complete definition for the fighter.
// This no longer must be handled in Thrift, it can be a subclass of FighterNetworkView, which simplifies accessing.
struct FighterServerView {
1: required FighterNetworkView Network;
2: required FighterDefinition Definition; // we no longer need to look this up externally
}

Now it is implied that only the base FighterState is mutable, while preserving just one parameter to methods. Additionally, this assists unit testing because there is no longer an external dependency to grab the Definition information at each use.

This still feels slightly wrong however because we are making a FighterServerView technically “mutable” because the base class is.

On the other hand, I’m used to SQL tables where IDs are regularly included with the data rather than external, necessary for lookups.

Opinions anyone?