C++ with Cocos2D engine

Unity workflow in c++

  • by Logane Ramez
  • Février, 2021


This thumbnail was perhaps.. clickbait. Let me explain. We had two C++ projects at my university. The first one was to have some sort of C++ introduction. The goal was to make a small game within 5 days. No engine, just pure C++ and bash graphics. The second project was just to add graphics to the first project basically. But the hiccup was that the second part had to be done in team, and you can't keep everybody's code, and on top of that, the skill gap can be quite big. So what happened is that, at first, we (group of three) took my code from the first project to add graphics onto. The problem with that is that my code was deemed "too complex" and was totally discarded for a... non-modulable-over-simplified-hard-coded one.


So here I'm gonna show you what the game looked like with graphics :

So, it doesn't look bad at all, but like said, everything was hard coded. The enemies, the rooms layout, the doors, the chest, everything. I won't show the code as it is not really interesting.


Instead, I'm gonna delve into my non-graphical version of the same game :


You can see the dungeon, the player stats, the logs, and your action options. In that version of the game, there technically was the enemies in the code, but I didn't make the combat system.



How the game works?

Basically you just move around the dungeon, across different types of room.

  • The red # are rooms filled with enemies
  • The yellow # are treasure rooms, with more loot
  • The white # are normal rooms
  • And grey # are undiscovered rooms

Whenever you enter a room, you can press "R" to rummage it in order to find new items. The risk is you might find enemies doing so. You can see the rummaging percentage visualized by the red bar, screen above. Whenever you find an item you can equip it. There's no end to the game, no exit.



Programming

My main goal in that project was to try and mimic Unity's basic Gameobject/Component workflow. So I did. Here below you can see the GameObject.h



You can see the components! That class enabled me to make such modular code, that it was even pleasant to code without any engine and just a console as a renderer. If you want to see my whole code, don't hesitate to check out the github repo. There are only 20 ish files

Tag:

Other projects

Perlin Noise
Restart... and brand new different world!
2D platformer in 4 days
4 Days to get it done!
PiouPiou
Waoo.. like, you can play with friends?