Cross-platform 2D Game Engine in pure Swift
This project originated as cocos2d-objc rewrite to Swift. As I stopped commiting to the repo since June, because Obj-C is dead for me.
This is still in a very alpha state, but you already can build some games with it, even though it may be unpleasant process as I change API almost every day. The project served as
.dylib(
.soon
Linux/
Android) that builds by Swift Package Manager. It requires some project config in order to use it, but you can experiment with the demo provided in the repo. Generally the project should be considered unstable and most of the API is likely to be changed.
We worked hard before starting this project and it relies on several self-made libs we made: * SwiftMath (@s1ddok, @stuartcarnie) * SwiftBGFX (@stuartcarnie)
Thanks to them we currently have: * Ultra fast cross-platform math lib, that works with
SIMDon
Darwinplatforms and has self-implemnted algorithms to run on
Glibcbased environment. Not speaking of zero ARC impact and modern swifty syntax features. * Modern agnostic renderer, which works with following list of backends out of the box: * Direct3D 9, 11, 12 * Metal * OpenGL 2.1, 3.1+, ES 2, ES 3.1 * WebGL 1.0, 2.0
Currently this repo only contains demos for
Linux,
Android,
iOSand
macOS.
macOSdemo can use both
MetalKitand
SDL.
iOSdemo only supports
MetalKitfor now and can be easily ported to
tvOS.
Linuxand
Androiddemos can only be compiled with
SDL, hence only
GLrendering backend is available.
You can get the idea from this GIF:
My goals for the near future are (order means nothing):
Windows
UI components(Button, Slider, Label)
Particle systems
contentScaleand use
one set of assetsfor all screen resolutions
.jpgto
.pvr
We have a trello which I will try to maintain soon.
$ git clone --recursive https://github.com/s1ddok/Fiber2D.git
cd external/SwiftBGFX/3rdparty/bgfx make osx-debug64
cd ../../../../ make xcodeproj-macos
bgfxfor
iOS
make xcodeproj-ios
Fiber2D-iOS.xcodeprojsomewhere in
System/iOSgroup (just for reasonable structure).
Project Settings->
Fiber2D-demo-iOS Target settings. Add all frameworks from
Fiber2D-iOSto
Embedded binaries:
Target dependenciessection of
Build Phases.
You can reach me on twitter (@s1ddok) or by e-mail in my profile.
All parts in this package (Fiber2D, SwiftMath, SwiftBGFX and bgfx itself) use the same license.
Copyright 2016 Andrey Volodin. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.