ashblue / canvas-prime Goto Github PK
View Code? Open in Web Editor NEWA minimal OOP HTML5 game engine that uses extendable classes for its engine and objects without any libraries.
License: MIT License
A minimal OOP HTML5 game engine that uses extendable classes for its engine and objects without any libraries.
License: MIT License
If you put the logic to kill an entity in the update function you can run into situations where the core class will try and draw an object that isn't there.
A simple function should be available to check if an entity type exists. Should return true or false.
Example:
if (entityType(name,count)) {
// do stuff
}
Need to create a basic camera capable of following a player.
For ease of use, entity and dependency files should be output via some simple PHP.
Draw and update need to be split into two separate loops. Draw should handle animation and intervals should handle the logic. Need to experiment before proceeding.
Currently garbage collection is insufficient and doesn't actually clear out everything necessary. Some kind of cleaning worker or asynchronous event might be necessary.
Consider the following method:
a = {
b: 'asdf',
c: 'fdsa'
};
Delete it as so:
delete a;
Only the a element is cleared and the remaining pieces can still be accessed as so. This could build up lots and lots of garbage over time.
a.b; // Returns proper value
a.c; // Returns proper value
Global id's not clearing from memory after kill is called. Also storage isn't emptying properly and items aren't clearing from it.
Creation of one location string instead of using multiple strings. Too messy and hard to set right now.
If animation properties aren't set it will cause an object to explode. Make it so offset, flip, and other props don't need to be set.
Game needs a basic gravity module that developers can build off of if necessary.
If we try to use multiple inputs we are only capturing one currently:
In player.js:
if (Key.press('arrowLeft') && this.x > 0)
this.x -= this.speed;
if (Key.press('arrowRight') && this.x < Game.width - this.width)
this.x += this.speed;
if (Key.press('arrowUp') && this.y > 0)
this.y -= this.speed;
if (Key.press('arrowDown') && this.y < Game.height - this.height)
this.y += this.speed;
Canvas Prime is incredibly fast. To prove it I'm going to compile a list of the most popular HTML5 game engines and run a basic stress test across all of them.
The functions all need to be documented, general concepts need to be detailed, and a proper forum should be setup for feedback.
If you run kill during a collide, it will cause the collision loop to collapse. Killed objects should be placed into a graveyard for later removal instead of running kill immediately.
Right now John Resig's JavaScript Prototypical Inheritance script works for what we need, but it suffers from some speed issues and doesn't quite meed the needs of the engine. It needs to be re-written and replaced at some point.
Include a simple debug mode capable of the following (only available in production version before compiling):
Needs to be placed beneath the game content with a slide up and down window mechanism.
Include compiler script that compresses and consolidates all JavaScript code into a single file, re-organizes assets, and removes exploitable code.
A library of math comparison functions such as distance, angle to, and more would be very useful.
Needs to be tweaked and optimized to work in the newest browsers.
Would be nice to have the orientation API available through a dependency.
Random is off by 1. Needs to use this structure instead of the current.
return Math.floor(Math.random() * (max - min + 1)) + min;
Place entity spawning in a function that occurs after the engine has loaded.
With HTML5 touch support quickly growing across mobile devices, its time to start considering how to integrate it with Canvas Prime. After the mouse library has been integrated, this feature will be further detailed.
Entities are loading asynchronously instead of one after another, needs to be changed.
It seems that init is running twice for entities due to:
spawn: function(x,y) {
if (x) this.x = x;
if (y) this.y = y;
this.init(); // removing this line will fix the issue
return this;
}
Any object you instantiate in the game.js file will be created on load. Need to make a spawn function that will control when an object is created. Ran into this issue when trying to make feather particles and I was unable to set when the objects were supposed to appear.
Engine is open source, need to place a basic license in with the core files.
The naming of press push functions in the keyboard library is a little confusing.
Press seems to be for holding the button down. Push is for a one time click.
Loads all images, sound files, and other junk via AJAX. Needs a pretty loading bar too.
When initializing an object old values of the same object will be overwritten. Need to create a solution where you take a new value in the spawn function and apply these to the newly created object.
A grid based level editor that runs in browser and includes entity interaction needs to be included in the game at some point.
Needs to at least have basic trigger integration.
Users need to be able to create timers on the fly from the engine's core. Time will be measured according to real time and not frames.
Should be a dependency file and users will create objects as so:
this.timer = new Timer(duration);
Test for timers current time as so:
// Test to see if the timer has expired
this.timer.expire() returns t or f
Decide how to handle and manage plugins.
It seems that translate is off slightly in the flip functions for images. Needs to be fixed.
Need a method to easily flip an image that will take into consideration the canvas offset.
Need to find a good way to call parent/super functions, unclear about how classes absorb parent functions.
Built in gravity or a gravity plugin would be very useful.
Right now the PHP code is kinda crappy. Could be much better written and consolidated.
When you call the function kill() on a class to remove it from the storage array, if you take a look at the DOM in firefox it will show the name spaces for all the killed files and their variables are still accessible.
Can't create more than one object without creating a completely new constructor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.