GithubHelp home page GithubHelp logo

springbok's Introduction

Springbok

Springbok is a C++ library for developing full featured 2D games in a limited timeframe. It provides many helpful classes, such as a KeyframeMap for animation, a Image class for managed texture loading and Vec2 and Angle classes to be used in your calculations. Springbok is not a engine, and gives you complete freedom in how you design your games code.

Getting started

Documentation

Each subdirectory of Springbok should contain a Markdown file explaning how the component in that directory is used. However, the documentation is currently incredibly incomplete, sorry about that!

Building Springbok

In order to build Springbok you will need:

  • A C++11 compilant compiler (Modern Versions of GCC or Clang, MSVC doesn't qualify currently)
  • A recent version of CMake
  • OpenAL, OpenGL 2.1 and GLFW 3

Now you need to generate a makefile/project and invoke it, under Linux this typically look like this:

cmake .           ; Generate Makefile
make -j8          ; Compile library
make install -j8  ; Install library

This should also work just as well on Windows via MinGW, but this is currently untested.

Contributing to Springbok

Make sure you take a look at the existing code before to get a idea of what kind of coding style we are going for.

A few things to keep in mind:

  • Springbok should be a modular library, not a engine, as such try to keep new components as flexible as possible.
  • Keeping it simple is the smartest thing you can do.

springbok's People

Contributors

api-beast avatar bitbrain avatar sirjson avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

sirjson

springbok's Issues

Object Pointer overhead doesn't get freed.

I rewrote the ObjectPointer class so that it is more elegant, works better with containers and works properly with virtual classes..
However now the overhead from it never gets deleted, because we don't know when we are able to. We maybe need to add some kind of reference counting for it.

SIGSEGV on close

ObjectPointer::destroy() results in a SIGSEGV on application close. Maybe because Image tries to use a invalid texture?

Stacktrace:

#0 0x00000000000000f0 in ?? ()
#1 0x0000000000420bce in ObjectPointer<void>::destroy (this=0x7fffffffe4c0) at /home/sirjson/projects/Springbok/Springbok/Generic/ObjectPointer_Templates.hpp:90
#2 0x0000000000427f1e in ResourceManager::~ResourceManager (this=0x65a9c0, __in_chrg=<optimized out>) at /home/sirjson/projects/Springbok/Source/Resources/ResourceManager.cpp:55
#3 0x0000000000428fc2 in PointerGuard<ResourceManager>::~PointerGuard (this=0x658f60 <(anonymous namespace)::guard>, __in_chrg=<optimized out>) at /home/sirjson/projects/Springbok/Springbok/Generic/PointerGuard.h:7
#4 0x00007ffff57e9ea9 in __run_exit_handlers () from /lib/libc.so.6
#5 0x00007ffff57e9ef5 in exit () from /lib/libc.so.6
#6 0x00007ffff57d3bcc in __libc_start_main () from /lib/libc.so.6
#7 0x000000000041de59 in _start ()

String Utilities

Parsing in C++ is a feature that is frequently needed but works terribly with the Standard Library.

Configuration File Loading

Games have configuration files, we need configuration files.

I have existing code but that needs to be adapted to Springbok. Would be also nice to have some information on the system, e.g. "Where can I put my config file."

KeyframeMap class

A map with float as key that interpolates between values.

API should be similar to:

KeyframeMap<float, float> animation;

animation[0.0f].insertKeyframe(  0.0f);
animation[1.0f].insertKeyframe(100.0f);
float curVal = animation[0.5f]; // curVal should be 50.0f

It's probably best to implement this via a skiplist.

Native Platform Backends

Currently we wrap GLFW for our platform API. For the future it would be good to have a even more lightweight solution.
This is very low priority since it is not required in order for Springbok to work.

Support for multiple input devices.

The input API is designed to work in a device agnostic manner, however currently the only backend for it is GLFW which doesn't support this kind of API. We need a implementation based on raw input in order to allow this.

Debug Module

Debugging is the number one time eater for any kind of game development. Time to solve it.

Unified Conversion from and to Strings.

Currently a subclass of ConfigFile has "toInt" and "toFloat" functions.

This functionality (Object -> String -> Object conversion) should be put into a extra class and be possible with almost all classes in Springbok. This is theoretically similar to the QVariant class from Qt, though I need to think of a way to make it more flexible than that.

Food for thought: can we combine this functionality with tokenization e.g. type detection from a string? This could be very useful for writing parsers.

AASpatialList class

A container for objects with a axis aligned bounded box (or similar) which will be automatically sorted in a way that only objects that intersect on a axis will be checked for a collision.

API should be similar to this:

AASpatialList<Enemy> enemies;
Player player(234, 785);
enemies.add(new Enemy(324, 645));
enemies.add(new Enemy(230, 700));
auto collisions = enemies.getCollisions(player);

MapView class

A class to speed up look up of arbitrary keys, by storing a second order in a second container.

Example

struct X{ int A; float B; std::string C; };

[...]
SimpleMap<X, int, &X::A> map;
SimpleMapView<X, float, &X::B> bLookup(map);
SimpleMapView<X, std::string, &X::C> cLookup(map);
[... insert values ...]
cout << map[5]; // Look up by the A value
cout << bLookup[10.2f]; // Look up by the value of B
cout << cLookup["abc"]; // Look up by the value of C

Finish SkipList Implementation

The basic work is done, however currently it doesn't add any levels so the efficency is not any better than a normal list.

Conversion to independent Mini-Libraries

In it's current state Springbok is a framework with some pretty heavy design, that allows us to write some pretty nifty code, but it's not really a all that good idea if you don't have a lot of developers to make sure everything works well together, and it too makes things complexer than they should be.

So here is the plan:

  • SBL_Core.h/.cpp: Core library, the other libraries depend on this one, needs to find a good balance between weightlessness and functionality. I think we need some UTF8 decoding and some containers like Vec2 in here.
  • SBL_OpenGL.h/.cpp: A core library for loading textures and some other OpenGL related functionality.
  • SBL_SpriteRenderer.h/.cpp: A library that provides functions for batch drawing rectangles.
  • SBL_Angle.h/.cpp
  • SBL_XINI.h/.cpp
  • SBL_AudioEngine.h/.cpp

Implications:

  • We need to say goodbye to the resource manager. That just doesn't fit into this design. If there is enough functionality a extra library for path resolution might be appropriate.
  • Generally classes who's only function was to improve readability need to go.

ShootEmUpExample

  • As small as possible
  • AASpatialList for collision detection
  • 1 struct for Player, 1 struct for Enemy, 1 struct for Bullet
  • Enemies move in slowly, then acclerate expontially, then disappear when out of sight. (Should use KeyframeMap.)
  • Score counter, increased when destroying a enemy.
  • Game over when hit by an enemy.
  • Player can move & shoot.

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.