Object-Oriented C++ integration with SDL and OpenGL for Agent-Based Modelling (ABM) for Lost Frontiers

Professor Eugene Ch'ng (Academic Blog)

The series of C++ code linked from this page was created to support team members working in the ERC 'Lost Frontiers' Advanced Research Grant with the basics of working with C++ codes, integrating both OpenGL 3.0 and SDL 2.0. As such, the code posited within each linked folder is designed to lead any developer with a basic understanding of C++ syntax towards the foundational knowledge of designing agent-based modelling codes, using SDL at first, continuing with the basic of OpenGL, and ending with the integration of OpenGL, SDL and Object-Oriented Programming in C++.

The series of code will also be useful for developers and students intending to understand how to developed agent-based simulation, games, and etc with C++, SDL and OpenGL.

The series of code blocks within each folder are listed below. I suggest that beginners go through the sequence of code and avoid skipping folders for a more thorough understanding of how everything comes together into an ABM system

INSTALLATION

  1. Installing Basic Libraries and tools: g++ Compiler, SDL2 and OpenGL

C++ SDL FOUNDATION

    1. SDL: Setting up and compiling your first SDL application
    1. SDL: Keyboard Events
    1. SDL: Mouse Events
    1. SDL: Loading a basic bitmap
    1. SDL: Combining image and event
    1. SDL: Displaying Text (Loading Other SDL Libraries)
    1. SDL: Using the Timer Function

C++ OPENGL BASICS

    1. OpenGL: Your first OpenGL application with GLUT
    1. OpenGL: Drawing a rectangle with GLU
    1. OpenGL: Coordinate Systems, Matrix and Vectors (code view)
    1. OpenGL: Matrix transform (Positional)
    1. OpenGL: Matrix transform (Position + Rotational)
    1. OpenGL: Drawing a 3D Cube and Spinning It
    1. OpenGL: Pattern of a Simulation Loop
    1. OpenGL: Moving an OpenGL Square with SDL Events
    1. OpenGL: Moving and Rotating an OpenGL Square with SDL Events
    1. OpenGL: Realistic Movements with the Keyboard

C++ OBJECT ORIENTED PROGRAMMING BASIC INTEGRATING SDL and OPENGL

    1. C++ OOP: Class Instantiation and Functions
    1. C++ OOP: Inheritance
    1. C++ OOP: Integration with OpenGL and SDL (with grid boundary)
    1. C++ OOP: Simple Autonomous Agents (with grid boundary)
    1. C++ OOP: Multiple Autonomous Agents (with array)
    1. C++ OOP: Debug View for Agent Field Of View and Steering System
    1. C++ OOP: Simple Predator-Prey Seek and Chasing Algorithm
    1. C++ OOP: Predator eats prey eats snacks
    1. C++ OOP: Implementing a Crude Camera Class
    1. C++ OOP: 3D Plane Test and Normals - Agents on Terrain Basics
    1. C++ OOP: Simple Terrain
    1. C++ OOP: Simple Terrain with predator-prey-snacks

SYSTEMS INTEGRATION AND SCALABILITY

ACKNOWLEDGEMENTS

"This project has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme ( ERC funded project No. 670518 LOST FRONTIERS)".