Category Archives: Programming

Asteroids in JavaScript

Enjoy this classic game written in JavaScript, the most foul language I’ve ever had the displeasure of learning. Half way through, I wanted to quit, but I put aside my hate to give it a chance. It’s not that it’s hard to learn. This game only took a couple hours, including the time it took to learn JavaScript. The problem is that it has so many serious (and well documented) design flaws. That said, the source code is in plain text for your viewing pleasure, courtesy of JavaScript. Suffice to say, this is my first and last JavaScript game.

Click on the game then press space bar to play. Use the space bar to shoot, and the arrow keys to move. The goal is to make the rocks dead, while keeping the triangle alive. That’s right, you are a triangle. At least I didn’t make you a square. Who wants to be a square?

Asteroids



 

I always had a sketchy feeling about JavaScript thus I never bothered to learn it. It looked stupid. After having learned enough to make this game, I realize that I was right. It is stupid. Too bad the whole internet is built on it. JavaScript is like a rotten, termite infested wooden frame holding up a giant mansion full of cat pictures and porn.

It’s OK though, I’ll just write my own language. I’ll call it: BLEM. Best Language Ever Made. Don’t worry I took a class on this, therefor I MUST know how to write it right, right? Wrong, I dropped that class. Good thing you don’t actually need school to know how to do stuff that matters. Hate me yet? It’s alright, hate just means there’s room for understanding. Hate me even more now?  Good, that means it’s working!

Seriously. I’m going to write a right (coincidentally, using my right to write – it say I can in the constitution).

Coding Standards

Just like writing a readable piece of text, code should be written with the intention that it will be read later (and work).

When writing English, it helps readers when words are spelled in a consistent manner, certain words are capitalized, and punctuation is inserted into a reasonable place. When it’s not like that, people will often interpret the text as trash and invalid, even if the underlying material is actually valuable.

Code is the same way.

I don’t know if people don’t realize they’re doing it, are doing it on purpose, learned the wrong stuff, or just don’t care, but C/C++ code is some of the most horrid stuff to look at sometimes. Even in some well know libraries, applications, and operating systems – there is some ugly code out there.

I highly recommend anyone writing a C/C++ application to adhere to a very strict style to ensure that it will be understandable and maintainable in the future.

I agree almost 100% with everything in the Google C++ Style Guide.

Please read it.

GPU List Class for C#

I was doing some GPU compute testing and I realized that it was quite painful to actually get data on to the GPU. I ended up spending most of the time just trying to copy some data over. So, I finally broke and wrote up a C# IList<T> implementation that is fully GPU backed. It fully implements the interface, and makes it very easy to get data on and off the GPU.

It’s easier to explain what I mean by just looking at some usage code. This is a basic GPU particle system, with all the data transfer totally encapsulated inside the GPUList.

It is not implemented to be super fast, rather super convenient. So if you ever want to do a GPU compute test using SlimDX, but don’t feel like dealing with the hassle of data management, this class could be useful for you.

You can get the Visual Studio project and source here: Download GPUList Project

You’ll need Visual Studio 2010, and the latest release of SlimDX.

Gemini Physics Development 0: Getting Started

I was going to release the library used in the Gemini Physics Test Bed demo, but I’ve decided to go further than that.

I’m going to start a new engine based around all that I’ve learned over the years, and make it the go-to solution for 2D physics simulation.

Why?

Firstly, I just flat out love this stuff. Secondly, indie and mobile games are quickly becoming a very large part of the games market. I’m convinced that the mobile market in particular is going to really soar in the coming years. This means that people are going to want to start making high quality games. Due to interface and hardware limitations, the primary types of games created here are going to be 2D, at least for a while.

People could use one of the many great physics engines out there right now today. But, if I were developing the next hit game, I would want features that simply are not available in any of the current solutions. This is the problem the I want to solve with the introduction of Gemini Physics.

I have already started development, and it’s looking promising. I will post eye candy as I add features to the engine, all the way up to its first release.

Space Invaders Clone in 300 Lines

I was digging through some old stuff from high-school and I found one of the first java games I ever made!

Launch the Applet

I was very efficient back then. The entire game fits in 300 lines of java code!

That said, you can download the source code. I don’t feel like deciphering my previously cryptic ways so there are no comments, but maybe it will be helpful to someone.

G’day mates.

Gemini Library

So, I’ve been getting various emails and posts regarding the library / source code for the Gemini Demo.

My plan is to make a separate page / website for Gemini, where I’ll put up the static library for various platforms. I don’t want to release the source code publicly, but I will release it privately with some negotiable licencing terms.

In addition, I will be reviving an old project called GMPhysics. It was a library for a program called GameMaker. The last version of GMPhysics was based off of PhysX (then NovodeX) now owned by NVidia. The upcoming release will be based off of Gemini.

GMPhysics got very popular before I had to leave it to deal with some other life stuff. If you’re interested, here is the original forum post. I almost can’t believe how long ago that was, and how popular the topic has gotten (2,600 replies and 600,000 views)!

I also googled it, and it seems there are even a few youtube videos about it. It’s quite flattering…

I’ll post more (pictures / videos / demos) on the old GMPhysics library soon, and I’ll keep everyone up to date on Gemini.