Friday, August 1, 2025
HomeGame Developmentstructure - Necessity of node-graph-based rendering in easy sport engine

structure – Necessity of node-graph-based rendering in easy sport engine


I am engaged on a C++ sport engine for my very own initiatives. It is divided into two components: one which handles primary performance like logging, cross-platform abstractions, filesystem utilities, and many others., and one other which is used particularly as a sport growth library. The sport growth (“core”) library is designed for use like this:

  • Create a category which extends bwGame
  • Create a essential operate that creates an occasion of this sport (which from this level on behaves like a singleton) after which name run on it
  • Override the init operate of the sport class
    • Create a bwStage or an occasion of a category which extends bwStage, then set it as the sport’s present stage utilizing the enterStage technique
    • Create a bwCamera (a kind of bwActor), spawn it on the stage, then set it as the present digicam by means of the bwRenderer pointer saved within the sport singleton
    • Create the entire wanted actors, set their properties, then spawn them on the bwStage (a few of these actors might come from degree knowledge and be mechanically spawned upon coming into the stage)
  • Set the sport state to a bwGameState-type object, which handles logic for various components of the sport

A whole lot of that is topic to vary, however that is the overall thought.

Internally, bwGame-type objects are singletons, which preserve tips to the render supervisor (bwRenderer), the present sport state (bwGameState), and the present stage bwStage. The bwRenderer incorporates the foundation node of a bwSceneGraph (which is itself inherits from bwGraphNode), a easy graph-like construction that does not assist reparenting logic, discovering particular youngsters/ancestors/descendants, or something like that, because the expectation is that the scene graph can be constructed as soon as and by no means modified till it’s deleted and a brand new one is constructed. On the sport logic facet, nonetheless, bwStages preserve a listing of bwActors, which do not need dad and mom and youngsters as a result of that kind of construction is not obligatory for many sport logic.

The primary query right here, although, is whether or not or not I ought to preserve a separate scene graph particularly for rendering, or I ought to simply combine graphics-related metadata and knowledge buildings into the bwStage and bwActors, like having some actors lengthen a Drawable class or interface and having them present their very own drawing info like meshes and supplies, possibly even having a Drawable object separate from the actor however referenced by it, and having totally featured parenting and scene tree assist in bwStage. It is a very troublesome query for me to reply contemplating the design of my venture, so I would like some assist figuring it out given my circumstances.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments