Back

RPG Prototype

This prototype was made from me and a few friends messing around with the idea of making an RPG. I did all the programming and some of the art while my friends did some art and ideas as well.

This project with programmed in C++ with OpenGL, SDL and FreeType. Scripting was done in Lua.

Whenever I am working on a prototype like this I like to try some new ways of doing stuff and seeing how it goes. Some things I learned while working on this project:

  1. Entity-Component System. I set up a system similar to an ECS.
  2. Integrating Lua scripts.
  3. Various graphics-related stuff like hacky lighting and nine-tile UI.
  4. Basic level editor.
  5. In-game console.

Here is the script for the player, as an example of how I used Lua:

LEVEL_DESTINATION_ID = 0;
PLAYER_DESTINATION_X = 3;
PLAYER_DESTINATION_Y = 3;

function init(id)
  entity_id = id;
end

function update()

end

function on_trigger()
  freeze();
  set_anim(entity_id, "open");
  wait_for_loop(entity_id, 1);
  change_level(LEVEL_DESTINATION_ID);
  player_goto_tile(PLAYER_DESTINATION_X, PLAYER_DESTINATION_Y);
  unfreeze();
  set_anim(entity_id, "closed");
end

init is called when the entity is created, update is called on each frame and on_trigger is called if the entity has a TriggerComponent and the player interacts with it, however that may be.

Gallery

RPG overworld

Battle scene

Tile editor

Collision editor

Entity editor

Back