Bouncing Ball Example

Bouncing Ball Example

So after seeing a few other examples of peoples entries for js13k competition, i realised i need to step it up a notch! I'm new to the whole html5 canvas, and game development in general, (I'm an App / Web developer, not a game developer!) so i started a new game.

I dont know where i am going with this, but here is POC so far, its like a bouncing ball type thing. So far I have almost nailed Newtons law (still a bit laggy!) in its most basic form and the concept of trajectory. Hopefully an idea will happen as I keep implementing things.

Heres the POC so far:
Bouncing Ball Example


  • I've now updated this to include inverted gravity logic, and also platform collision detection logic. I just need something to create with it now!! I still cant work out why it runs so slow in firefox!! In chrome, its fine


js13k game submission and general javascript rant

js13k game submission and general javascript rant

So i finally to round to finishing my 13k game, its not too fancy, just simple, but I like simple games :)

It really surprised me that I have spent many an evening working on random ideas for android games etc. (I've probably worked on over 50) and never finished one [ Except my POC Triple Triad Card List ], yet with this 13k game I managed to complete in a couple of nights! Maybe I should start playing around with html5 and javascript more, its just soooooo easy to get everything up and running, and i find debugging the code much nicer using firebug than using eclipse (for android)

And I guess knowing more and more about javascript can only be a bonus, as it seems like that's the way we are headed! Javascript is not a language i have ever officially studied, i just picked it up as I went along because i needed more functionality than html only supplied.

Classic example: today i realised that from a function, you can get all arguments passed in, but in array form by using the arguments object. I never knew this until today! Its scary how something simple like that can catch you out if you don't know a language inside out. I guess it also shows that someone can use complicated frameworks, test suites (jasmine etc.) yet not know something relatively basic. I guess you never really need to know something until you need to use it to solve a problem!!

...Guess it's time i got the textbooks out!!




Importance of good javascript convention

I've been writing my js13k submission whenever i have had chance over the last few days, and it's made me think more about the way i write javascript.

I haven't has much experience in my working life with javascript, i've dabbled here and there (moreso in my current role). I've read multiple design patterns that can be implemented using javascript, but i still tend to write javascript in an oop style, asd i just find it easier to follow. I always think separation of concern is the most important thing to start of with; I find that if you don't start separating things out at the earliest stages, the code you write becomes more and more unmanageable as you write it.

The way i like to write javascript - using IOC where possible: This is what i call a View Controller pattern, it separates the view code (if using jQuery etc.) and the controller. It makes testing of the code very easy, you only really need to assert that methods were called on the controller, then test the view separately.

I have tried to apply this pattern to my js13k game, but since I haven't had much experience with game code (I spend 99% of my time writing business logic etc.) it kind of follows, but not really strictly. Plus normally I would write test driven, thats probably where the game went wrong!!
1:  function View(){  
2:    return {  
3:      getSomeValue: function(){  
4:        return $("idOfElement").val();  
5:      },  
6:      setSomeValue: function(value){  
7:        $("idOfElement").val(value);  
8:      }  
9:    };  
10:  }  
11:  function Controller(view){  
12:    Controller.prototype = this;  
13:    Controller.prototype.view = view;  
14:  }  
15:  Controller.prototype.Initialise = function(){  
16:    //constructor code  
17:    var controller = Controller.prototype;  
18:    controller.SomeValueChanged();  
19:  }  
20:  Controller.prototype.SomeValueChanged = function(){  
21:    var view = Controller.prototype.view;  
22:    view.setSomeValue("value");  
23:  }  
24:  domReady(function(){  
25:    var view = new View();  
26:    var controller = new Controller(view);  
27:    controller.Initialise();  
28:  });  

JS 13k Html Game

This should be fun... there's a competition running at the moment (ending 13th Sept) to create a full javascript / Html5 game that is under 13k in size (minified)
http://js13kgames.com/

Since i haven't had much exposure to Html5 canvas etc. it will be a good chance to try a few things out!
I'm thinking of having some sort of strategy game. At the moment i'm just getting the Game Runner logic in place, its already proving to be not too easy, without using 3rd party code!


Here is what I have done so far: Its coming in at about 7kb Zipped. I think i should be able to make the 13k limit, I just need to learn how to draw images using lines and rects, that should save me some kb, so far i have one 100x100px png image (weighing in at 2.6kb, if i add any more its going to eat up all my code space!!)
I really like the space effect, its basically 520 random generated points on a 2d plane, I iterate through each point but also iterate a for(int i=0; i < 5; i++) then modulus the index of the point. I move each point 2 px to the left. This creates the illusion of layers of stars each layer moving at a different speed. Its pretty cool, i haven't done anything like it before!!
I just noticed the images dont load, oh well ill upload a working copy once i do some more on the game
Update - an updated version of the game so far: 20/08/2012 Not too far from completion!
Agent XIII Game

ATV2 Webserver - Lighttpd

So I've been pondering for something to do all morning on my day off work, and i came across this pretty cool article, http://www.macminivault.com/atv-webserver/

Basically it is possible to install lighttpd on the ATV2.
...Now I've already jailbroken my shiny little black box to install XBMC, so this should be a nice little project that i can run in the background that will keep running costs cheap and means i wont have to buy some web hosting. Lets just hope my ISP starts to be more reliable!

It looks like you only need to run a few commands over SSH
 - SSH in and change the root password<br />  
 - Use apt-cache and apt-get to find and install lighttpd<br />  
 - Use SFTP to upload a /etc/lighttpd.conf config file for lighttpd<br />  
 - Within /usr/sbin/ run lighttpd-angel -f /etc/lighttpd.conf to start lighttpd<br />  
 - Write a plist file in /Library/LaunchDaemons to launch lighttpd on boot  
  Hopefully i should be able to serve some content to my blog straight from my ATV!

Online Reputation

So I've been reading a lot recently about "Online Reputation" and how important it is going to be in the future, Apparently its common now for employers to do a "Google Search" and have a look at what you have achieved in online communities. I think this is a positive, I mean I do like to go onto sites like StackOverflow and help people out with programming related problems, its just the negatives... What's to stop someone posting something bad about you online? I mean everyone has a past and we all have the odd photo on Facebook we don't want potential employers to see! The thought is a little bit scary!!