Code Monkey home page Code Monkey logo

cocos2d-bgfx's Introduction

cocos2d-bgfx

cocos2d-x-lite use bgfx as the rendering backend


It is deeply inspired by Dorothy-SSR. A simple and clean 2d game engine, without it I definitely could not finish this.


Currently it is not fully comaptible with cocos2d-x-lite, because some rendering node type is not implemented completely.

- The complete parts:
  - Sprite(used by System Font label atlas in CocosCreator)
  - Scale9SpriteV2(used by CocosCreator as Sprite component)
  - Label(add gradient), but need optimization heavily
  - ParticleSystem(maybe missing postStep)
  - ClippingNode(with alphaRef can be used by image stencil)
  - GraphicsNode
  - DrawNode(not completed)
  - TextureAtlas and so SpriteBatch
  - EditBox(iOS getText must be called in UI Thread, this is not fixed)
  - Spine(TwoColorBatch skeleton is not completed)

- The uncomplete parts:
  - TMXTiledMap(Layer, fast map)
  - RenderTexture
  - MotionStreak
  - Grid
  - DrawingPrimitives
  - DragonBones

- Only windows and iOS is runnable
- The platform specify code for Android is not complete, so Android is not runnable

- bgfx compatible problems
  - [stencil write mask](https://github.com/bkaradzic/bgfx/issues/1541) problem arised when using ClippingNode with more than one layer
  - [24bit rgb texture](https://github.com/bkaradzic/bgfx/issues/1554) 24bit rgb texture on DX12 is not rendered correctly, although this texture format should not be used in production

Build Guide

Clone:

git clone https://github.com/quicklyslow/cocos2d-bgfx.git
cd cocos2d-bgfx

Then update submodules(bgfx,bimg,bx)

git submodule init
git submodule update

Go to the BGFX/bgfx folder

win:..\bx\tools\bin\windows\genie.exe --with-dynamic-runtime vs2017
ios:../bx/tools/bin/darwin/genie --with-tools --xcode=ios xcode9
This will make bgfx use Runtime Library(Multi-threaded /Debug/ DLL), ease a lot of ABI problems across different versions of runtime lib

Open simulator.sln

cd tools\simulator\frameworks\runtime-src\proj.win32
and open the sln

Run

Compile shaders and copy shaders and js scripts to simulator folder can just be done
run copyres.bat on root folder.
External libs is required, whether run download-deps.py or copy from CocosCreator's cocos2d-x folder is ok

CocosCreator Compatibility

I had test across ccc from 1.6x to 1.1x, most of them is OK, when compiled the simulator, can use the folder as the Cocos2d-x engine folder in ccc.
Because the render implementation is changes since ccc 2.x, this will not comaptible with ccc 2.x

Suggestions and issues

Any suggestion will be a lot of help.

The road ahead

A lot works need to be done.
First of all is the cleanup of code, approching to the cleaness of Dorothy-SSR as much as possible.
Then the optimizations, including Label and Batch and a lot, I need some help from [korok](https://github.com/KorokEngine/Korok)

Improve Locality

Contributing to the Project

cocos2d-bgfx is licensed under the MIT License. Anyone is welcome participation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.