I talked about this a little on SAX, but I've written a script in Javascript called GameBox that allows you easily create web applications.
The way it works is simple:
you set the callbacks gameBox.postInitCallback and gameBox.updateCallback to your init and game update routines and then call gameBox.init().
The gamebox handles calling the update at the users selected frequency (default is 1), checking keystates (accessible with gbKeyDown() and gbKeyUp()), and manages the displaying of objects such as sprites, text, buttons, checkboxes/radios, textfields, etc.
Once added to gameBox.object[] with gbAddObject(), any component can be moved with gbMoveObject() or removed with gbRemoveObject().
There are alot of other functions too that allow you to manipulate the properties of objects such as changing the source file of a sprite or changing text color.
I've also managed to create a simple 3d ortho renderer that runs at a fairy decent speed. I'm hoping with just a little more effort that I can create an FPS example such as Doom.

Ive currently written 3 examples, the first was a full-fledged Pong game that took me only 30min to write. It feature player movement with the up/down keys, score keeping, and AI to play against.
The second was a Zelda movement test that uses gfx from ZeldaOOA and was made mainly out of my own curiousity as to how difficult it would be to animate as moving character (real Q, would it be possible to make a 2d game engine.)
The last one was the afore-mentioned 3d ortho-cube test. it works by creating a 50x50 grid of 2x2 sprites (2500 sprites) which all use the same fully transparent 2x2 image. A var called screen[] keeps track of screen data and the screen is rendered by re-assigning the background colors of all the pixels, a method which proved to be hundreds of times faster than swapping the src images of all the pixels.
Despite displaying 2500 images at the same time, the gamebox was able to run fast enough for very smooth animation and the process in the task manager showed it only used about 8kb (internet explorer)

Im on 3DS right now, so I can't posts the scripts yet, but the next time I get to go to Ingles I'll be sure to post them for your amusement. My hope is that some of you may use your brains to help improve it.
I'm not familiar with Javascript or web development in general, but that sounds pretty cool Smile could you show some example code of it in use, such as some code ripped from your Pong game?
Alright, got it uploaded!

Here's the script with 3 examples:

* A full finished Pong game with AI

* A Zelda animation test

* A Ortho3D cube
I tried it earlier today, it looked very nice Smile and pretty fast, too! The code for the different demos seemed short as well, so it seems to be a viable framework for easy webgame development. Kudos, great job! Smile
Thanks Smile

A couple of things could use some fixing up though, like my line drawing routine in the Ortho3D example. It used division and multiplication and would probably be better if it used Bresenham's method.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement