Bold Pixel’s Namespaces and Interfaces

After much thought and discussion by myself or at the FGL chat I made some decisions about how to make Bold Pixel more modular in order to simplify my own work. Since we are still on top of contracts, I couldn’t give enough attention to this but my brain was dealing with it in the background.

Inheritance Spaghetti

The problem presented was somewhat simple. My early coding of the blit engine got tangled in the dreadful inheritance headaches. My solution to it was to create one class per major responsibility. It worked fine until the time I decided to expand one of the classes to do something it wasn’t designed to do. So on one hand I solved the inheritance problems but on the other I lost modularity. At this time I had a OOP doubt that I expressed in the FGL forums and the discussion that started there really helped me to move in a different direction, one that I had never considered.

More over I said that I would not support requests that didn’t deal with deal with real problems we had in our own development. And while I stick to that, I couldn’t help but to think: what if Bold Pixel could help someone but it missed one little tiny feature? While this was puzzling me, there was real problem, one with impact in our development that was taunting me…

The case of Blit vs Physics

So Bold Pixel has a blit engine and it will wrap a physics engine (more about the physics engine this later this month) so the question that was on top of the table was: considering there is a blit entity and a physics entity, which one should access the other? Whatever the answer was, modularity was lost in the sense I imagine it. I don’t want blit to know physics and I don’t want physics to know blit!

After a nice chat with Antriel at FGL (thanks mate!) I got to know the Strategy Pattern and all my problems were solved. In simple terms, I will be defining interfaces for all interchangeable objects but the implementations of the interfaces can exist anywhere. In the case presented, a blit entity will have its spatial properties (rotation, x, y and scale) defined by a spatial interface. By default it will be a simple class and it’s needed since the properties of the spatial interface are needed to render bitmapdata. A physics entity will be a implementation of  the spatial interface, so if I want to use physics on a blit entity, I simply write: myBlitEntity.position = myPhysicsEntity;

Visibility and Access Issues

This brought another problem. Bold Pixel has always kept its inner “stuff” hidden. The objective was this was to keep the auto-completion short and the use easy preventing mistakes. In order to implement interfaces I would have to make a lot of code public.

The answer to this would be abstract classes, but ActionScript3 does not support it. That will be addressed with simple naming and convention over configuration. Any class in any namespace in Bold Pixel that starts with Abstract will only have the simplest shortest implementation needed for something to work. For instance, if I want a blit entity that draws pixels I will have to extend a AbstractBlitEntity class (I guess that will be the name) but that brings another problem…

So ActionScript does not support abstract classes… convention will say that Abstract defines an abstract class.

Namespaces (to wrap this up!)

To have a better code organization I will need more packages and to have more packages I will need to provide access to classes in different packages. This will be done with namespaces. The only thing that annoys me is that Flash Develop in the current version (3.2.2) does not support code-completion with custom namespaces, but what matters is that using custom namespaces solves two problems. First I can have a bunch of private functionality like I like, but second, any coder can with a simple namespace use extend Bold Pixel to his own needs in a full modular way.

While I reckon that this is all just in my head and that a lot of work will have to be done and even considering that probably this will make Bold Pixel a little bit more complicated to the average coder, I feel it sorts a lot of questions, so: Namespaces and Interfaces FTW!

Posted: September 1st, 2010
at 1:46am by Vlad

Tagged with , , ,


Categories: The code of VGS

Comments: No comments


Packt Publishing and Book Reviews

Hi everyone

I really like books. My biggest flaw is not owning a e-reader, but it will arrive mid-September, don’t worry! While I read some non-technical books occasionally, like most of you (our dear friends and blog readers) I mostly read technical books. One of the issues with technical books is to find those that match your needs. Like me, I bet that you will not buy a book that doesn’t pack the the promise of growing your knowledge considerably. I also bet that you, again, like me, have bought a book or more that was less than what you expected.

On occasion I’ve read books that seem awesome and has time goes by prove themselves wrong… so is life…

The best books I bought were through word of mouth. People I trust having a opinion on a specific book that would meet my needs. Reviews help also, naturally. Bringing the two of them together on our blog sounds fantastic to me!

Packt Publishing released two new books that sound amazingly interesting for todays flash market space. Flash Multiplayer Virtual Worlds and Flash 10 Multiplayer Game Essentials. The book titles are self-explanatory are they not?

I’ll read the books in the near future and review their content from flash developer to flash developer. All that is left is to say thank you to Packt Publishing wish them a lot of success and hope for more books that are interesting for the flash gamedev community.

Posted: August 30th, 2010
at 1:45am by Vlad

Tagged with ,


Categories: Caught our Attention

Comments: No comments


Bold Pixel Engine v1 Post Mortem

I guess it’s pretty strange to have a post mortem of something that is not a game, but Bold Pixel Engine, in its first version was a fantastic learning experience, but it had a overwhelming amount of failures also. To sort my thoughts I checked the tag of the engine in our blog and read some of the stuff that happened as time passed. This led me to write this post mortem, on one hand to know exactly what is right about it, on the other hand to learn from our own mistakes.

A bit of historical perspective

Bold Pixel Engine started with our first flash game because of a simple music management class. Back then, both me and Diogo were coding and I remember (and I admit I deeply miss) our discussions about code standards and organization. I’m a bit of a dictator when it comes to have stuff organized, credits to Marco that has used the word “dictator” more than once and with a large amount of reason and giggles.

Soon our bunch of classes were our own internal library and I even posted some of my own experience while organizing that library. Some of the most important definitions of Bold Pixel where then starting to emerge. July 27th 2009 we announced Bold Pixel Engine was alive.

I was quite excited about it!

The turning page from internal library to public engine was the blit engine. We had so much help from many amazing developers that we would not keep it for ourselves. We wanted to share, we wanted to hear what others had to say and that’s what we did. After two games under his belt and a lot of opinions, the engine was publicly available and his version 1 life was pretty much that until the version 2 turning point a couple of months ago… but I’ll get to that eventually.

What went right! :)

The learning process was amazing code wise. After Diogo left I really had to raise my standards and get to work and the engine allowed that. Coding such a piece of technology made me contradict myself several times and pushed me forward. I’m absolutely convinced that I am a much better ActionScript programmer now than I was before and I feel I learnt little from the games but a lot from the engine because I forced myself to respect the principles I wanted to see applied to it.

And speaking of principles, these stay true from the first line of code until today and are something that really went right. And these are:

Convention over configuration: Bold Pixel Engine is written assuming some conventions. For example, if the programmer tells the Scene Manager to create a new scene, the previous one and all dialogs will be removed, which makes a lot of sense but maybe it makes less sense to say that all scenes have their pivot point at 0,0. This means that scenes and dialogs are simply added to the display list and that’s it, nothing to configure since there is a convention.

Ease of Use: This goes hand in hand with convention over configuration. If there’s something that really makes my head hurt is to look at the code needed to make something happen in libraries like Flixel and Box2D. I appreciate the effort put in these libraries and the flexibility and power provided but I believe that if we have to configure every single tiny detail the code becomes cryptic and extremely difficult to debug. I don’t mind loosing flexibility because I will create more mechanisms that will help me achieve my goals as time goes by.

Modularity: There is only one dependency in Bold Pixel Engine, which is the Manager class. If you want a single loop or to manage scenes and dialogs, you need to start it up. Apart from that Bold Pixel Engine started modular and will stay modular. The reasoning behind this were two questions I made once:

1. What if I don’t want to use the blit engine?
2. What if I want to add something that will wreck dependencies?

The answer to that was that I wanted it to be flexible, meaning, I can use whatever I want with only one dependency and that’s it. I don’t want the engine to behave like an engine. I want it to be a toolkit at my disposal. I even had a laugh about this.

What went wrong… :(

First and worst aspect of thing that went wrong was that I did too much stuff that we didn’t need that was requested and I didn’t do it with the same dedication I did the rest. That will never happen again. I’m convinced I got carried away by the kindness of a lot of devs, but we can’t have the engine restricted to the needs of others, which was something I said it wouldn’t happen from start. But what it really makes me feel bad about it was that other devs got involved in the project and this collided with either our work or their work making it a bad solution for everyone.

The second thing that went wrong was that I overcomplicated somethings because I felt it made sense. For instance there is a Scene Manager and a Input Manager and a Manager. All of these managers depend of a Display Object and/or its stage. While it sounds easier to manage code and it looks more tidy and clean, having a gazilion classes doesn’t make it easier to code with. I found myself looking through the classes to find what I wanted… that doesn’t sound like a good thing, right? I mean, I coded it!

And last but not least, I think I really rushed things. The idea behind the public releases of the engine were that we would make two games between each release, which we actually did with v1, but as soon as I had the mechanics ready and all the engine’s juicy code was on a actual project, I went head over heels with it. It lacked documentation, it lacked cross-testing (so, just because I did two games, I should have tried against the two games again) and most important it lacked a critical look and a some honest and critical analysis.

Conclusions

Great experience and I really appreciate all the kind words that I got from developers. I think the really cool thing that most developers got from it was the ease of use, probably the YouTube channel with some nice overview on it. I could’ve written a post trying to sell the idea that we are overwhelmed with joy and l33tness, but I would be failing to be honest. I truly believe that BPE v1 is a great piece of software, but I was naive in the approach and maybe over-friendly in the “pleasing my fellow devs” department.

We have a game going with v2 and I think I sorted my doubts about what is going to happen with the engine. Many things that were wrong with v1 are already gone and there is a lot of stuff that isn’t even started, like moving the Music class which started all this into the current version.

There’s a lot to be said about v2, but this is a hell of a long post mortem and I’ll write about that soon.

Posted: August 12th, 2010
at 11:53am by Vlad

Tagged with , , ,


Categories: Postmortems

Comments: No comments


Game Design Perspectives

I have several motivations to write this blog post. I knew I wanted to call it game design perspectives because it is about game design and perspectives about it but I didn’t really know how to put it. So I decided to put up an image and made a search on my favorite free image plugin. I searched for “perspective” and found this one: perfect.

When I coded my first game I had no idea what game design was. Some years ago, right before starting up Vortix with Marco and Diogo I had no coding knowledge whatsoever so I focused on game design. Problem with game design back then was that everyone wanted to be a game designer… it was the game designer wanabe boom period.

Back then (and it wasn’t that long ago) every guy that played games and wrote two paragraphs of a Tolkien ripoff considered himself a game designer, me included. Many of them didn’t make it up to the professional stage. Looking back, the only ones I know that got into the game development industry are either artists or engineers. The only game design wanabe that managed to pull it was me… and I’m more a programmer than a designer nowadays.

The perspective back then, the passion, was about the game. We all steped our of the dream and learnt that game design is about decision making, getting feedback and more decision making. All game designers, wanabe or not, had only one goal: the game! Like the two crossed railway lines, game design is all about crossing left and right sides of the brain. See the whole while addressing the details. Be able to analyse data and crunch numbers while being able to… well… feel…

It is sad to observe that on a market such as the flash game space the perspective is that a designer’s objective is to make a game that is sponsorable. I find this not only sad, but wrong.

Squize commented on a blog post of his that:

(…) it’s all about the creative process now, so I’d rather push myself and fall short than work to someone else’s design. (…)

Julian from LongAnimalGames mentioned today in the FGL Chat that he considered more interesting the psychology of players than game development itself.

It is a trend I find in many high profile developers. They care about business and particulary money when hiring, when selling, when paying, when discussing deals. Money doesn’t get in the way of design and they have other interests… the creativity, the psychology, the technical expertise and others. It is interesting that these are the ones that make the great, memorable and amazingly sponsorable games. I know one exception… that simply confirms the rule.

Like them we are not against the commercial or business side of all this and we take it very seriously, but game design is about the decisions, the rules, the player, the big shiny paradigms. Production, marketing, whatever, that’s the business part, our job as designers is to reach as many players as possible. We might argue that the bottom-line, that’s what will make the game sponsorable, but it is not the motivation when making game design decisions. Money is a unnecessary distraction while designing.

Posted: August 10th, 2010
at 12:46am by Vlad

Tagged with , , , ,


Categories: Caught our Attention

Comments: 1 comment


Business Model Activity: Conclusions

So after all the walls of text I just put up, what does this all mean? Let me start by saying that Vortix was not born to be a flash game development studio. It was born to be a game development studio. For the last two years we have focused on flash the same way we may focus on some other technology. We do what we have to do to develop games. That is what we want to do. But to be successful we need to be able to monetize it. It is pointless to create a commercial project if it isn’t to be commercial and no, you don’t have to sell your soul to do it.

To be successful we have made decisions. We developed our own activities:

1. Sponsorship and licensing because it is our current form of monetizing our core business and our core business is creating games.
2.  Collaboration projects as an low-risk extension of #1.
3. Contracts as a very-low-risk activity that would allow us quick and steady monetization.

Everything we did, was done with a purpose. There are a bunch of things you can do as a flash or game developer. Some devs operate portals, some devs create software that helps other devs, some devs have a day job, all is fair game, but doing things with a purpose allowed us to set goals and each goal that is achieved is a step forward into that purpose.

It boils down to this:

Do whatever you have to do to be able to do whatever you want to do.

Less than that it’s either a hobby or a bad model. What you need to ask yourself is:

1. What do you do best? Capitalize on that.
2. What do you want to do? Improve on that.

Never stop moving, choose what you have to do and choose what you want to. Be smart, create value, raise the bar, raise your worth.

To finish, keep in mind that you, like us, are probably small fish in a world of sharks. Here’s something worth reading: The Bootstrapper’s Bible. That should put it in a wonderful, motivating new perspective.

Posted: August 5th, 2010
at 10:55pm by Vlad

Tagged with , , , , , ,


Categories: Business

Comments: No comments


« Older Entries