Skip to content

tyt2y3/F.core

Repository files navigation

Architecture

F.core is not a game engine. F.core is a set of conceptual and functional components that can be used to build an engine. so it is not a hard decision like Windows vs Mac when choose to use F.core. you find the parts you are interested, pull it out and use it in your game.

F.core employs requirejs dependency management, and you should too, if you care to build games that has more than 1000 lines of code. requirejs can be clumsy to set up than <script src="">, but when a project grows it will pay off.

F.core components can be categorized into:

sprites

[sprite](#sprite) and [animator](#animator)

keyboard controller system

[controller](#controller), [combodec](#combodec) (combo detector) with [control_recorder](#controller-recorder) and [control_player](#controller-recorder).

math

some [collision](#collision) detection and [math](#math) functions and javascript [util](#util)

world for 3d to 2d projection

system programming

[states](#states) oriented programming in hierarchical state machines

entities management

[effect_pool](#effect_pool) for managing effects and [graph](#effect_pool) for hashing objects

web application

[css](#css) for loading and optimizing css files and [support](#support) to check for browser support

resourcemap to map resource name to resource url

Components and features

sprite

  • display and control sprites on page using <div> and <img> tag
  • multiple images for one sprite
  • not using canvas for sprite animations
  • support style left/top and CSS transform, depending on browser support

animator

  • animate sprites
  • support multiple animation sequence on the same image

controller

  • controllers for multiple players on the same keyboard
  • maintains a table of key states
  • generate key events for child controllers
  • buffered mode: buffer inputs and fetch only once a loop
  • never drops keys

combodec

  • listen key events and detect combo from a controller
  • maintains a clean sequence of pressed keys and fire events when combo is detected
  • LF2, KOF style combos
  • eliminating auto-repeated keys

controller-recorder

  • record and playback activity of a controller
  • useful in game demo and testing

states

  • nested state transition system, a Hierarchical State Machine ( HSM )
  • intuitive state machine definition syntax
  • simple (not UML compatible) yet powerful enough for interactive gaming
  • reduces logical bugs if used as a programming paradigm

effect_pool

  • manages a pool of effect instances using a circular array
  • particularly useful in creating game effects, like explosions, flame or sound effects

graph

  • mapping(hashing) objects in finite 2d space into a 2d array

math

  • some useful vector operations

collision

  • performing rectangle-rectangle, triangle-triangle, circle-circle, line-line intersect tests and point in rectangle test

web development practices

  • use requirejs for dependency management
  • compile-time optimization

Sample usages

Project F

F.core is the programming library that powered [Project F games](http:https://project--f.blogspot.com/2013/02/games.html).

License

Generally have complete freedom except commercial use. For exact terms see license.

About

A programming library for building HTML5 game engines.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages