Filed under: free game engine

What's new : How the fonts in Laboratory2D work

Laboratory2D uses the simple to use, but extremely powerful bitmap font generator from AngelCode. You can download the generator and see what I mean, the packing options and per channel settings are really handy.

http://www.angelcode.com/products/bmfont/

Let's make a font

I have a font from Font Squirrel called Capture It , and I have opened up BMFont and I have selected only the characters I want to use in this example.

 

 

Then, I set the options like this below, 

 

 

Then I went ahead and made sure it suited my memory needs (no more than 512x512 in this case), using the handy Visualise option in BMFont, don't worry about that black background, its the alpha mask and won't show up in the font itself.

 

 

Then I opened up an image editing program and I made some detailed changes to the font. Added a bevel and some shadowing, some thing like this : 

 

 

And finally, i opened up Notepad++ (my favorite editor at the moment) and I added some code to test my new font in Laboratory2D.

 

 

And then I pressed Run ( Ctrl - Numpad 0 for me ) and I can see the following. 

 

 

Another interesting note

Because text comes back as a geometry object, you can actually assign the geometry to a sprite, and use the benefits sprites have (like moveto, pulse, fade, etc). Take a look at this video for an example.

 

That's all for today.

Though there are more feature posts coming this week - keep an eye out. Still have 2/3 posts on features in depth and more like this.

 

What's new : Laboratory2D Beta 2 on the horizon

Hello again! This is where I spam about all the cool things I have been doing. To reward your visit, here is one of the earlier designs I had worked through when coming up with the logo for the engine.

The huge refactor

It has been a long and crazy time with the most recent additions to Laboratory2D. I started tearing out the insides of the code to try and decouple the scripting from the core C++ engine so that I could start binding spider monkey. It took a really long time, somehow over the last 8 months i had managed to litter v8 into the core components of the engine. Not in a terrible way, i managed to remove 99% of it over some simple copy pasting - but the event system and the whole sub script system were heavily bound to v8. This had to be fixed.

The escalation

Well as always, while shifting around some code I found some other ugly code. I refactored it. I found some interesting bugs, fixed and refactored. I changed all the layouts of code to be uniform again, I cleaned out all the random code that had yet to be finished or tested and stuck it in another branch. I finally got around to cleaning up the interfaces and systems and I am proud to be at the end of this stretch with a much cleaner code base on the c++ side, a lot less hackish code that i did about a year ago when learning the systems involved - and most of all - a clear and driving direction for the core itself.

The new features

Again a crazy list I won't post here. I finalised the font support for full bitmap font support, with normal scaling, rotation and coloring. Camera systems got large improvements like being draggable and zoomable with a single flag, sprites got a whole new set of handy features, a few more examples were polished and a couple other useful modules have been included in the core (like a handy edit box, with selection, a history and custom properties). I also finalised the networking support for scripting so that a handful of lines of code later, you can have a chat going over the internet.

What about this Beta 2

Well, beta 2 will be the first mostly public release of the engine. Hopefully it will be soon but work and life and other things tend to get in between - so i won't say a time. Just soon. As of now, Beta 2 is almost 100% complete according to my original goals it is merely a matter of getting the documentation and the examples in line with the monolithic changes I have made over the last month or two. That gives me the next short while to finalise the android, iPhone and browser embedding features that I have been working on in the mean time. As with the post mentioning the way I am doing releases - Beta 2 phase will be fixing all the issues reported by the beta users as well as making even better examples and demos. Sometimes, i can't help myself so I jump ahead and get started on the demos to keep me motivated. Expect to see a lot of interesting things as beta 2 rolls out! 

The original reason for Laboratory2D is still alive

As a matter of interest, the project that started Lab2D is actually in progress again. Now that the core is stable and the scripting is mature it is a totally different world to work with - we are moving forward at a rapid pace again which is exciting. The scripting opens up opportunities for team members to help even more than before and to really get involved where the C++ before had just isolated me from having the game i wanted. As I roll out releases for this game, keep an eye out on other forums and indie gaming channels for trailers and gameplay teasers and most likely a playable release. For those who are not aware of it, it is an uplink style game (inspired by) and it is something i have wanted to make for many years. 

 

How to obtain the beta now

Its free, It's javascript driven, its fun (and portable).

email fuzzy at owned.co.za

tweet @FuzzYspo0N

Comment below

 

Part 1/3 A look at the Lab2D features in detail

In the next 3 posts about Laboratory2D i will be covering some of the things I have been working on in Lab2D for my game, and how they benefit you as a user.

Networking.

Networking in Laboratory2D makes use of the small, lightweight and fast library called ENet. http://enet.bespin.org/ ENet is described as "a relatively thin, simple and robust networking communication layer on top of UDP". So, think TCP but over UDP. What this means in non-technical speak is that you can get reliable, in order delivery of packets. For example, a card game. The packets that are sent over the network are critical for the functionality of the card game to make sense. If player one has made a move that is not yet noted on player two side, the game cannot continue. ENet allows packets to be sent and internally it will order them, and ensure delivery for you. If a message gets lost along the way, it will resend if it needs to.

Now on the Lab2D side we have another lightweight wrapper. More specifically, the technology inside the C++ core is exposed directly as functionality in the script language side. Lab2D supports P2P, as well as 'master server' style networking. One client calls net.host(), and another can simply call net.join() and they can play. All the networking is managed by the scripting, and exploits the dynamic nature of the events and language features of javascript so your networking code will be easy to integrate. And, as it is just online networking it is possible that clients can play cross platform too. An iPhone client can connect to a PC client and be connected via P2P or a server. The details of this are up to the game to implement how it will work - but it is a possibility.

 

 Filesystem.

The file system in Lab2D was built to be as secure as possible. Not that it is possible to eliminate security holes, but to allow better control over what the client program can change. All files packed into the database use a two way system of encryption and compression. Data like textures, images, font files, and scripts - are all packed into the database. On their way in, they are compressed using LZMA (7-zip) compression, and optionally they can be encrypted using a public/private key pair encryption that is tamper proof. What it means - is that if the client or something else has changed the data in the file system at all - it will not be able to unpack the file. This ensures that the clients are playing fair, and that their client has some sort of integrity checking. 

Once your files are packed in, the file system tools will allow you to make a shipping package (like a zip file) and your code wll work as expected. There is nothing special required to load a file from the file system, as it maps itself onto the folders for you. To the average user of your game, your assets and scripts will be secure to an extent, to help distribution on digital portals.

The last interesting feature of the file system is that it is possible to do in place updates of files from a remote server. For example - let's say I had written a client script that fixed some issues in the pause menu. I can run a small dedicated server version of Lab2D with a flag that tells it to be able to serve the files to my game's clients. Instead of needing everyone to redownload everything Lab2D will listen for clients who start up. If a client has chosen to update their game, it will automatically update all the latest changes since the last time they updated by version number. It is almost like a 'push' or a commit to version control. You update the server code with a new minor version and whenever the client starts up, if it can access the server, it will notify them of the updates and allow them to update the game quickly and easily.

 

 That wraps up the first of three posts! While all of the features and systems are written in some form or other, certain parts of the above are still being wrapped up in the script engines. They should be in the beta within the next short while. 

 

UDK: "Free" is a magic word. Read closely.

One thing i love is when reality is smacked on top of a buzzword, and a current OMG moment. I really appreciate such a nice breakdown, especially for indies/beginners. Thanks Brett! http://www.torquepowered.com/community/blogs/view/18741 Go ahead, indulge yourself. Im making this post about the UDK license and the REALITY behind their move to make the engine free. Torque3D kicks ass, btw. Check out the demo on the www.torquepowered.com website - and read the development blogs.
Media_httpfarm4static_wjopq
Posterous theme by Cory Watilo | Mod by FuzzYspo0N