One hand, many games use maps as playground and some are based on a map. On the other hand, OpenLayers is a high-performance, feature-packed library for creating interactive maps on the web.
This project aims to test and add game mechanisms within Openlayers (ol).
It is by no means a complete game or complete game engine but you should find some stuff to devleopp game on a map with Openlayers.
OpenLayers makes it easy to put a dynamic map in any web page.
- It can display map tiles, vector data and markers loaded from any source.
- Leverages Canvas 2D, WebGL, and all the latest greatness from HTML5. Mobile support out of the box.
- Implements animations mecanisms and the postcompose hook allows to intervene with the OpenLayers rendering process to draw onto the canvas context. A postcompose listener is called for every rendering frame and is the perfect place to implement animations.
Just look at the Openlayers example page to see what's up.
- Render objects over the map (vector features) with styling functionnalities.
- Add interactions widgets to the map (controls, overlays) to interact with your maps.
- Actually already uses a 2D spatial index R-Tree to perform spatial queries very efficiently.
- Pixel-based hit-detection
- Exposes an API for drawing geometries and features to the output canvas
Here are some of the features I'm working on in this repository.
A hexagonal map or hex map is a game board design commonly used in wargames of all scales. The map is subdivided into a hexagonal tiling, small regular hexagons of identical size.
For more information on Hexagnol grid, I recommend this fabulous Red Blob Games article.
Sprite and Spritesheets have been used in games for a long time.
This include sprite animation and sprite collision detection.
Explosions are an integral part of games. Not that all games need explosions, but they play an important role in the game dynamics.
Pathfinding algorithms: A*
This is just a simple implementation of the HTML Audio to add sounds in a game.
ol-games is licenced under the French Opensource BSD compatible CeCILL-B FREE SOFTWARE LICENSE.
(c) 2017-2019 - Jean-Marc Viglino
Some resources (mapping services and API) used in this sofware may have a specific license.
You must check before use.
For convenience ol-games is also published under the BSD-3-Clause Licence.