LesserPanda
A module based HTML5 game engine designed to be flexible and powerful.
Features
LesserPanda has a lot of features, and the list is still growing:
- Super fast Canvas and WebGL rendering powered by PIXI.js.
- Idle and fixed game loop with customizable
FPS. - Fast and powerful physics solution.
- Super fast AABB collision detection solution.
- ECS(Entity Component System) like systems for
Timer,Gfx,PhysicsandAnime. - High level
Entityclass. - Automatically choose the best resolution based on configs.
- Tag is supported by systems.
- Mobile friendly.
- Rotate prompt for mobile devices with just a few configs.
- ES6 based scripting environment.
- CSS style can be imported by using standard ES6 module system.
- Live-reload browsers after any changes are saved.
Samples
Samples are moved to its own repo here.
Currently the samples are located inside src/game/samples folder, and each is just a simple Game focusing on one or more particular feature.
Note: Samples have not been converted to latest v1.x yet.
Document
Devlog posts what happened to LesserPanda, read them at wiki, it will be updated on each Wednesday.
Brief introduction of modules
animeprovides both common tween animation and Blender likeaction.audioprovides sound playback functions, the basic usage is included in thegame/main.gfxcontains whole PIXI.js sources. Filters and mesh is disabled by default, you can enable them by uncomment related lines inengine/pixi/index.js.polyfillcontains some ES6 polyfills (Object.assign,rAFandMath.sign).loaderbrings resource loading functionality which is used by PIXI.js and you probably don't need to use it directly.storageprovides session and persistent data storage.sessionandpersistentfrom this module is quite useful but you can also use low levelstorage.analyticsprovides some helper functions to work with Google Analytics.Camera2D camera that can follow targets, zoom, rotate and shake.coreis the core of lesser-panda, which provides the base functionalities such as "loop" and "resize".devicetells what device the game is currently running.EventEmitteris a fast EventEmitter implementation.inputprovides keyboard events and key-maps.loaderprovides assets loading functonaddAsset(path, key, settings)physicsprovides AABB based collision detection and response.resizeprovides some resize helper functions.rndis a random number generator.Gameis the main hub for your game.Timerprovides timers with callbacks. UseTimer.laterorTimer.intervalto create instances.utilsprovides utility functions and constants for array, color, math, object.Vectorprovide aVectorclass that is used everywherePIXI.Pointis also an alias of it.
Progress
There's a Trello board, from which you will see what's coming next.
Github issue and milestone maybe better for progress tracking~
ChangeLog
1.1.0
- Update behaviors for new
EntityAPI
1.0.2
This version contains some breaking change, but I won't bump it to v1.1 since all the changes
are applied to the built-in gfx module. It does not affect any public APIs.
- Merge
DisplayObjectandContainerinto one and rename it asNode. - Remove
fromImageandfromFramefunctions fromGfxelements,loadershould be used instead. - Add support to set Sprite textures using keys. (
sprite.texture = 'my_image.png')
1.0.1
- New
inputsystem support key-maps bindings, on top ofkeyboard. - Basic
CollisionMapimplementation supports AABB vs rect tile collision. - Tons of small issue fixes.
- More and better source code comments.
- Local node modules supported (you can provide a
package.jsonfile and install whatever packages)
1.0.0
- Completely re-design.
Scene->Game.Actor->Entity.- Huge refactor
gfxandphysicsmodules.
0.4.2
- Give
BackgroundMapability to repeat. - Add
width,height,widthInTileandheightInTileproperties toBackgroundMap. - Add
getTileandsetTilemethod toBackgroundMap. - Optimize
BackgroundMaprendering, by drawing the visible part only. - Force code running in strict mode.
- [CLI] Use webpack-dev-server instead of browser-sync for live-reloading, performs a little bit slower but will display error in browser console.
- Add
isStaticfield tophysics.Bodyto identify bodies don't move and response to the collisions, which also improves the performance ofCollisionMap. - Improve the design of behavior system.
- Remove listeners when stop a
Tweento prevent issues caused by object pooling.
0.4.1-1
- Fix container issue while loading a Tiled map.
0.4.1
- Optimize Tiled map converter by caching results.
- Improve Tiled map converter, which is now called
tiledToMapand convert to latestlevelformat. - Add
levelmodule that can load a level from data. - Add
Scene.getActorByNamemethod. - Tilemap huge rework, now has a way much cleaner API design.
- Fix tilemap retina display.
- Add second parameter to
core.setSceneto be able to create new instance for the next scene. - Improve scale mode support for mobile devices, especially for iOS.
- Add support of spawning actors using registered type name.
- Add
Actor.registerfunction to register custom(subclass)Actorclasses with a key. - Moved actor sub-system code into
actormodule, so scenes won't be able to spawn actors until you import theactormodule. - Improved
Bodysetup. - Deprecated
Body.anchorsince it's not supported by SAT solver. - Completely support tile collider shapes defined from Tiled editor, tilemap based workflow is hugely improved.
- Fixes collision map so that maps with holes are not properly supported.
- Add
Scene.createLayermethod to simplify layer creating. - Position, layer and settings parameters of
Scene.spawnActorare not optional. - Add
verticalandhorizontalsettings to WrapAroundScreen behavior. - Device patch is removed since resizing now works without hack.
- Canvas resizing is fixed and improved, and useless
neverresize mode is deprecated. - Fixed
Camerato be able to work without any targets. - Add
poolablemodule toutils. - Improve the
FireBulletbehavior, now it hasammosupport built-in. Behaviorno longer inherits fromEventEmitter.Actorspawn/remove behavior changed, now it's possible to maunally createActorinstance and add to any scene instead of callingspawnActor. Object pool support is included.- Change
Actor.preparetoActor.ready. - Fix some Actor component create methods.
- Add
rotate-around-pointbehavior - Add
steeringbehavior - Add
face-the-mousebehavior - Actor component factory methods now accept settings of all built-in properties.
- Add
getTexturefunction toengine.loaderto be able to get texture from string. - Add more component factory methods to Actor.
- Fix inline documents.
- Add
startfunction tocoremodule as a easy replacement ofstartWithScene. canvasquerymodule is removed.- Re-design
Actorsystem and make it more powerful yet easier to work with. - Re-design
Behaviorsystem.
0.4.0
- Add a
preparemethod toActorwhich will be called at the end ofaddTo. - Finish rectangle shaped tile collision support.
- Add simple
Tilemapsupport for both built-in format or Tiled JSON map(some custom properties are required) - Add
Timer.nowto represent time passed since game started. - Add
topandbottomproperties toCameraobject. - Add
widthandheightproperties tophysics.Body, which map toshape.widthandshape.height. - Add high level
Actor,SpriteActor,AnimatedActorandPrimitiveActorclasses. - Add
Behaviorbase class and some simple behaviors. - Emit
pauseandresumeevents fromcore. - Add resolution config, and renderer will pick the most suited resolution base on your configs.
- Add Blender/Flash like keyframe based animation.
- Add SAT based collision solver.
- Add SpatialHash based broad phase solution for collision heavy games.
- Change canvas style during resizing for some resize modes.
- Use bitwise shift to optimise SpatialHash based collision detection, change
Body.collisionAgainstto a 32bit integer number while broadPhase is SpatialHash. - Add a new
device-patchmodule to solve device specific issues. - Add rotate prompt for mobile devices.
- Save renderer resolution as
engine.resolution. - [Changes]
PIXI.extras.Animationis now renamed asPIXI.extras.AnimatedSprite. - [Changes] Huge improve of
Animationsystem(formerly calledTimeline), now the tweening of nested properties is supported. - [Changes] Deprecate
domresize mode. - [Changes] Deprecate
Texture.fromAssetmethod, useloader.resourcesinstead. - [Changes] Pass delta time to update methods in both milliseconds and seconds.
- [Changes] Upgrade PIXI to
master/3.0.11 - [Changes] Default asset key does not contain
baseURLany more.
0.3.4
- Upgrade PIXI to
master/3.0.10 - [Changes] Accept an object as third parameter of
loader.addAssetfunction
0.3.3
- Add animation support to boolean and object (instantly changes value at the end of duration, ignore its easing setting).
- Add animation support to string text (from empty to full content).
0.3.2
- Add
tagsupport toObject,TimelineandTimersub-systems, now it is possible to pause/resume any tagged components. For example you can easily pause the timelines tagged object and keep the ui when game is paused. - Emit
bootandbootedevents when engine is started. - Upgrade
Kefirand add aemitterfunction to create self emittable streams for convenience. - Create
sessionandpersistentdata manager for easier data saving without touching low-levelstorageandlocalStorage. - Add "skipFrame" setting to constantly skip render frames, which may be used to increase performance but may also sacrifice the accuracy of input.
0.3.1
- Upgrade PIXI to (dev/9d7a393)
- Upgrade resource-loader
- Rename base container of Scene to
stageinstead ofcontainer - Fixed update support. FPS now can be lock to a constant value
- Improved
PIXI.extras.Animationupdating logic - Improved Array element removing process
- Create utils module with useful functions and constants
- Better pre-defined sub-system updating order, now collision works pretty well with Timelined bodies
- New component system. The "Object", "Physics", "Timeline" and "Renderer" are just predefined sub-systems.
- Timer is also updated at fixed steps now, but act as a engine-level system instead of Scene
- Fix camera update error when it's not added to any containers
0.3.0-rc1
- Completely module based structure
0.2.1
- Add camera shake support.
- Let Scene emit input events just like what PIXI does.
0.2.0
- Add support for module imports/exports, so you do not need to expose everything to global namespaces (like
game). - Remove
Classsystem due to performance and capabilities.
0.1.0
- Update renderer to PIXI.js latest stable version (v3.0.7).
License
LesserPanda is released under the MIT License, the same
as Panda.js engine.
Special Thanks
@ekelokorpi for creating the awesome panda.js-engine
@Pixel-boy for the lovely bat(bat.png in media folder)