Coder Social home page Coder Social logo

game_engine_sr's Introduction

Game engine with software renderer

Linear video buffer implementation

The idea of using abstract linear addressed video buffer was taken from the book of Andre LaMothe. In my implementation the linear video buffer is an abstraction consisting of an array in the system memory with a step of 4 bytes to store the pixel color in the format ARGB (byte-ordered). Usually buffer has size is evaluated as window_width x widnow_height x bytes_per_pixel.

Hope this code helps someone to get basic knowledge before to dive into game engines. I tried to make code as simple as can without over abstraction and optimizations. Even using STL and not using memory management at all we can achive good FPS amount.

Game engine examples

Directory examples contains examples based on the game engine. Currently there are games: 3d space shooter (which is my implementation of the game originally written by Andre LaMothe), game Mountain race and FPS game.

Libraries used in game engine

math - mathematical library, which I start to implement just now

window - performs to create window, toggle fullscreen, grab keybord events and mouse events

draw - draw functions, which may be used with drawing surface, given by window library

audio - is a wrapper to BASS and BASS_FX audio libraries

system - useful system stuffs, such as timer

data - data manipulation classes

physics - very simple physics calulations

extras - addons to draw lib, such as terrains, nature, birds and other

Install

Check dependicies:

Following packages should be installed (example given under Ubuntu 17.10):

 $ sudo apt install mesa-common-dev
 $ sudo apt install mesa-utils
 $ sudo apt install libxrandr-dev
 $ sudo apt install libglu1-mesa-dev

Install libbass.so audio libraries (for audio module):

  $ wget http://us.un4seen.com/files/bass24-linux.zip
  $ unzip bass24-linux.zip -d tmp/
  $ sudo cp tmp/x64/libbass.so /usr/local/lib/  # for 32-bit - tmp/libbass.so
  $ sudo chmod a+rx /usr/local/lib/libbass.so
  $ sudo ldconfig
  $ rm -rf tmp/ bass24-linux.zip

Install libbass_fx.so - is the same as above (http://www.un4seen.com/files/z/0/bass_fx24-linux.zip)

P.S.: if something goes wrong while downloading bass audio library, then the best way is to use direct link for downloading library

Finish the installation:

  $ git clone https://github.com/ans-hub/game_console

Notes:

Note about installation under cygwin:

This packages should be installed to work with video modes:

  • cygutils-x11
  • libGLU1
  • xrandr
  • randrproto
  • libxcb-randr0

Also is necessary to add path to environment variable PATH:

  $ export PATH=/usr/local/lib:$PATH

Installation of bass audio library is similar, but in the case of cygwin we should download windows libraries (bass.dll and bass_fx.dll) and place it in /usr/local/lib/

Note about disable FPS limiting to 60 fps

When start any example, use vblank_mode=0 ./some_example

Note about fullscreen on Wayland

If you use wayland, you mas switch to old X mode to use fullscreen (i.e., in Ubuntu you may do this by choose login session called "Gnome on xorg")

game_engine_sr's People

Contributors

ans-hub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.