Nov 1 2014

Three kids, a job, a life, and a dream

 

shutterstock_187403054_res

Way back in 1998 me and a few friends started something that changed all our lives. I was 24 at the time, just finished with computer science studies at the university in Bergen, and had moved to Oslo to start working in a company that reviewed and sold games. The company was going to build a gaming network and I was hired to help them. Here I met Claus and Bjørn Tore who had the idea for an mmo called Darkfall.

I had been nurturing a dream of making games since I was a kid, and hearing about Darkfall made me want to turn that dream into reality. From the autumn of 1998 we started getting all the pieces into place, and after a couple of false starts we founded Razorwax in May 2000, and had seed funding secured by July that same year.

Fast forward to April 2002. Our original investor told us we weren’t going to receive any more money from them, but since our offices were in the investors building they would let us stay there a while longer so we could try a last-ditch effort to get proper funding. Continue reading


Jun 29 2013

Maturing as a programmer – How to supercharge your career

From the age of 11 one thing that was absolutely certain to me was that I was going to be a programmer. That was the age when I got my Commodore 64 and started to program in BASIC. I loved programming so much, that after a while I was programming more than I was playing games. There is something so sweet and pure about programming that nothing else in real life really can match it. Even with the bugs, time constraints and frustrations a modern programmer deals with, programming is still a sweet deal! Continue reading


Mar 6 2013

How to avoid Play Framework killing performance

 

Note: This article is about Play Framework 1.2.x and might not apply to Play 2.x projects.

The other day I had to convert some code from C to Java. This code runs some pretty simple calculations, using a few classes as data-holders, and running a few thousand iterations. I had to get this working as part of the backend for a Play Framework web application.

In C the code would run blindingly fast, and return the results within 10-20 milliseconds. All good!

After a couple of hours of converting the code and fixing the pointer/reference/initialization oddities between Java and C, I got the code running. Well, more like walking, or lazily sauntering along. The Java code took 4 seconds to run. I know Java is perceived to be slow, but my experience with it was telling me that there is no way it should be so slow.

I had a look at the Java code. Lots of Math.Pow(), Math.sqrt() calls, a lot of calculations with doubles and a few BigIntegers. Nothing very scary, and nothing that stood out as being super-slow-inducing code.

So, resisting the initial urge to optimize the code and start fiddling with data types, I fired up VisualVM to have a look at the code when it was running. I run the calculation and *bam*. Many thousands of calls to PropertiesEnhancer.FieldAccessor.invokeReadProperty() and .FieldAccessor.invokeWriteProperty() methods, and they were taking 90% of the CPU-time. My initial thought was: “WTF!”

After looking some more I decided to try to run the code as a standalone Java program, just invoking the calculations with the same parameters as it would be using through the Play framework. The calculation took 30ms. Now I was thinking: “W00000T.THE.FsCK!!”. I was super happy that it wasn’t Java, as I initially expected, but needed to find out what the hell Play Framework was doing to my code.

My research (Google search) indicated the problem: Play Framework intercepts every access to a public field in any class that is run under Play Framework. My translated C-code was full of public variables as a side-effect from converting structs to data-classes. I used  my IDE to encapsulate all the public fields in getters and setters, and ran the code again. Runtime now, with getters and setters in Play Framework: 30 ms! Mission complete! The calculation was accessing public fields thousands of times per calculation, and Play was intercepting every single access so it could redirect to Play’s own auto-generated getter-setter code! That is what killed performance, and luckily the solution was pretty simple.

There is more information about the internals of Play’s PropertiesEnhancer class and other Play Framework internals in this great set of slides.

The reason I am writing about this is to help myself remember this crazy Play Framework issue. I like that fact that it auto generates getters and setters, but it can make the code run extremely slow under certain conditions.

Even though it is good practice in general to use getters and setters, I would love for Play Framework to add an option to turn off auto-generation of getters and setters for certain classes. Another fine addition would be to detect and give a warning if the FieldAccessor methods are being spammed.

The conclusion: If your code is running unnaturally slow with Play Framework, check if it could be massive use of public variables.

 

 


Feb 11 2013

Hibernate, just stop it!

In 2001 Hibernate was created to ease development for the hordes of unhappy developers fighting with Java’s poor EJB implementation. EJB was so confusing and over-engineered that Hibernate’s simpler approach seemed like pure heaven in contrast.

Eventually hibernate inspired Java’s JPA and became a certified implementation of JPA.

History lesson is over.

Lets look at the status today. Right now Hibernate is a very popular ORM java library, maybe the most popular of them all. And I can’t understand what is wrong with people. Continue reading


Nov 1 2012

Dragons’ Den – Into the mouth of madness

This year Bergen had its first Game Development Festival, arranged by Linn Søvig, JoinGame and the Norwegian Game Developers Guild. The festival was named Konsoll, the Norwegian word for Console (read: Xbox, Ps3, Wii and the likes).

Disclaimer: I am on the board of the Game Developers Guild, but was not involved with the workgroup that was responsible for arranging Konsoll.

Dragons’ Den is based on a TV show. The concept goes like this:

A hopeful entrepreneur has a set time to present his great idea to a panel of experts, and then the panel has a set time to critique the idea. When I say critique, I mean tear apart, as dragons do.

At Konsoll the Dragons’ Den was set up so that the entrepreneurs had 5 minutes to present their ideas, and the panel had 10 minutes to give feedback. After the feedback each panelist would have a fictional 10 million Nok (around  $1 300 000) to distribute to the participants. The panel was Alex Trowers from Boss Alien Ltd, Bjørn Alsterberg from BTO, James Portnow from Rainmaker Games and Tor Ole Rognaldsen from Fuzz.

Continue reading


Jul 16 2011

Pragmatic OOP

In my last blog post I talked about people pushing a process as the magic bullet when it is the people that matter. Having the wrong people on a team can cause havoc and kill a project. Sometimes these wrong people are cargo cult programmers.

According to Wikipedia: ‘Object-oriented programming (OOP) is a programming paradigm using “objects” – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs.’

OOP is supposed to be a practical way to organize a program into hierarchies of objects where similar objects can inherit behavior from each other and override that behavior when necessary. Objects can also contain other objects and that is a technique called composition. Certain programmers pick up OOP and fall in love with the rule-set without fully understanding it, or they over-apply the principles. These people are cargo cult programmers. Continue reading


Jul 6 2011

F*ck the process, embrace the team!

Agile seems to be losing some of its shiny newness at last. This is great! It means we can start talking about agile without fanboys eagerly interrupting to spurt out some repeat-hyperbole from an Agile Evangelist meeting of some sort.

It also means that I can  tell you this dirty little secret without too many people choking on their agile-conference-coffee:

TDD, XP, Scrum, Kanban (and the rest) are all processes and tools. All their proponents claim you *have* to follow the process, no matter what. If Agile fails for you, then it is because you are not following the process!

The Manifesto for Agile Software Development tells us that we should value “Individuals and interactions over processes and tools”.  How is it that the Agile community has accepted the rigorous following of strict processes? I think it is because there is a market for selling processes. And those in the game of selling processes won’t tell you that sometimes the process just doesn’t work. The same way Toyota won’t tell you that sometimes their cars unintentionally accelerate and can kill you.

The real secret is that it’s the people that matter, not the process! Process is good. Formalizing development methods is good. But if you have the wrong people you will fail, no matter what process you use. Conversely, if you have the right people it doesn’t really matter what process you follow. You will most likely succeed.

It is time we stopped selling processes as the magic bullet. Agile is great, and methodologies like Scrum, TDD and XP can be good facilitators for getting from concept to release. But they do not solve the fundamental problem that   a bad team fails no matter what process it uses.

Programming is a human activity, as described in the classic book ‘The Psychology of Computer Programming” by Gerald Weinberg. Therefore the human and psychological aspect needs to be considered when forming a team.

The fact is: Some people don’t work well together no matter how well their skill sets match. Some people are useless within certain processes. And there are also people in the programming field that could be of more use doing something completely different.

We should strive to create the perfect team, not the perfect process.

 

 

 


Mar 2 2011

Darkfall 2 year anniversary!

Darkfall was released a little over 2 years ago, on the 25th of February 2009.

Having been one of the original members of the team and one of the founders, I felt the urge to tell the story of the making of Darkfall.

This my personal account, but I have tried to tell the story as accurately as possible. There are enough details to fill a book, so I have selected the parts that are important to me in order to fit this into a readable post.

Click here to read ‘The making of Darkfall – One developers perspective’


Feb 6 2011

Don’t optimize!

Actually you should optimize, but not at the wrong places, or for the wrong reasons. But I’ll get back to that in a minute.

I recently released a small XNA-based game together with my friends at Badgerpunch Games, and have been following the indie game development community through forums and twitter. Game developers are very concerned about performance, mostly for good reason. No one wants a game with choppy framerate. Because of all this worrying about performance, there is an array of optimization tips and articles that get passed around to alleviate the problem. The majority of the tips and articles are informative and useful, but hardly any of these articles touch on the main issue of optimization: When not to optimize and why not.

Continue reading


Jan 24 2011

Game developer, and then what?

Wow, it’s been almost two years since Darkfall (Online) was released!

I was involved from the very beginning, in 1999 when we were a bunch of young inexperienced guys with a a dream of making “the best game evah” ™. We started a company here in Norway in 2000, moved to Greece in 2003 and released Darkfall, a badass full-loot player versus player  mmo, on the 25th of February 2009. That pretty much amounts to 10 years making one single game. Continue reading