0
\$\begingroup\$

I've been trying to make a barebones engine/game in VS C++ with OpenGL.

So far it's worked well, I've managed to render two green triangles on the screen and can accelerate one using WASD input.

Both triangles have an "object" class from which I control their transform, could control mesh/shader, etc.

Today I tried to add an object reference to the transform component (so that I could get the Object from the Transform class, IE reference the parent from the child) and everything broke.

How are components of a "gameobject" class typically handled? Or what is a good suggestion to handle them? Is my current tactic of create object classes of the various components of my Object (gameobject) class wise? I also considered using derived class for the components, such as an abstract Component from which Transform/Mesh/Shader could inherit.

Thanks

\$\endgroup\$
4
  • \$\begingroup\$ I what specific way did everything break? The symptoms of the calamity can be useful in identifying the cause and solution. ;) \$\endgroup\$ Commented Apr 4, 2020 at 0:37
  • \$\begingroup\$ Unfortunately I have a slew of errors. I'm not quite sure what went wrong. Weirdly, a lot of the errors are duplicates (I've tried setting error settings from Build+Intellisense to Build only) and fundamentally don't really make sense. I do have a circular dependency between my object class and some of my component classes and those are the components that are causing issues; I haven't found anything to help me fix that though. \$\endgroup\$ Commented Apr 4, 2020 at 20:10
  • \$\begingroup\$ That doesn't give us very much to go on. Without seeing your code or the specific errors you"re getting, we'd have a hard time helping you fix this. Things like circular dependencies are general programming problems that don't require gamedev-specific expertise to solve, so you should find existing Q&A on StackOverflow useful for solving this part at least. \$\endgroup\$ Commented Apr 4, 2020 at 20:14
  • \$\begingroup\$ In terms of the architectural part of your question... cowboyprogramming.com/2007/01/05/evolve-your-heirachy \$\endgroup\$ Commented Apr 7, 2020 at 19:13

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.