CS 3 (Spring 2024) Project 03: Scenes (Physics Engine)

In this project, you will generalize and create a ‘scene’ abstraction for all your future demos.

Code Correctness

Physics Engine

One of the facets of architecture we haven’t discussed yet is testability. The idea is that certain interfaces lend themselves better (or worse!) to being tested. Because we want all the physics engines to be compatible, we will ask you to converge on a particular architecture which will definitely be testable. The first step of this was the list interface you implemented last week

This week, we will continue this with the incorporation of two interfaces:

This week you will also need to make changes to polygon.c and list.c, please refer the polygon.h and list.h.

You may not remove or edit signatures of functions in the interfaces in body.h or scene.h!!!!

The “body” and “scene” abstractions should incorporate most of the redundant code from the previous two weeks (e.g., the main game loop is now in sdl_render_scene). To do this, we also introduce the idea of a scene “tick” during which state gets updated. This is basically a wrapper around the dt idea we’ve been using. Next week, we will extend the body, scene, and tick abstractions to support forces and impulses acting on the bodies over time in the scene. For now, we will set the positions directly.

Testing

We provide tests for the physics engine files. All provided tests must pass in order to receive full credit.