Agent-Based Modelling Chapter One: C++ integration with OpenGL and SDL
Author: Eugene Ch'ng Academic Blog
Purpose: Prepared for the ERC Advanced Research Grant 'Lost Frontiers' Scalable Agent-Based Modelling Team Training.
Audience: For students and researchers needing a quick approach to learning agent-based modelling foundation for C++ and OpenGL
The series of C++ code in this repository was created as a result of a need to equip 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 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.
- Installing Basic Libraries and tools: g++ Compiler, SDL2 and OpenGL
-
- SDL: Setting up and compiling your first SDL application
-
- SDL: Keyboard Events
-
- SDL: Mouse Events
-
- SDL: Loading a basic bitmap
-
- SDL: Combining image and event
-
- SDL: Displaying Text (Loading Other SDL Libraries)
-
- SDL: Using the Timer Function
-
- OpenGL: Your first OpenGL application with GLUT
-
- OpenGL: Drawing a rectangle with GLU
-
- OpenGL: Coordinate Systems, Matrix and Vectors (code view)
-
- OpenGL: Matrix transform (Positional)
-
- OpenGL: Matrix transform (Position + Rotational)
-
- OpenGL: Drawing a 3D Cube and Spinning It
-
- OpenGL: Pattern of a Simulation Loop
-
- OpenGL: Moving an OpenGL Square with SDL Events
-
- OpenGL: Moving and Rotating an OpenGL Square with SDL Events
-
- OpenGL: Realistic Movements with the Keyboard
-
- C++ OOP: Class Instantiation and Functions
-
- C++ OOP: Inheritance
-
- C++ OOP: Integration with OpenGL and SDL (with grid boundary)
-
- C++ OOP: Simple Autonomous Agents (with grid boundary)
-
- C++ OOP: Multiple Autonomous Agents (with array)
-
- C++ OOP: Debug View for Agent Field Of View and Steering System
-
- C++ OOP: Simple Predator-Prey Seek and Chasing Algorithm
-
- C++ OOP: Predator eats prey eats snacks
-
- C++ OOP: Implementing a Crude Camera Class
-
- C++ OOP: 3D Plane Test and Normals - Agents on Terrain Basics
-
- C++ OOP: Simple Terrain
-
- C++ OOP: Simple Terrain with predator-prey-snacks
- Quadtree Terrain
- Quadtree Agent-Interaction
- GPU Accelerated Interaction Processing with CUDA (to be developed)
“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)”