I have an idea to organize a game cycle. I have some doubts about performance. Maybe there are better ways to do something.
You have an array of gaming components. All of them are called to do some things on each iteration of a game cycle. For instance:
GameData data; // shared app.registerComponent("AI", ComponentAI(data) ); app.registerComponent("Logic", ComponentGameLogic(data) ); app.registerComponent("2d", Component2d(data) ); app.registerComponent("Menu", ComponentMenu(data) )->setActive(false); //... while (ok) { //... app.runAllComponents(); //... }
Benefits:
Doubts:
, ? ?
C++ . , . .
, , . , . , , , , .
"" , .
, , ( ) , .. .
, , , - , , "" . , , , , , . , . , , , .
.
, , , , 100 , .
, , , .
, oldschool, , , .
struct GameObject { Ai* ai; Transform* transform; Renderable* renderable; Collision* collision; Health* health; };
: ; "", NULL. ? . (, "AI" ), . , ?
" " , , , . , , , .
, , . , "" . , -. , , , , - , - ?
Source: https://habr.com/ru/post/1742018/More articles:JBPM Web Designer - Installation and Use - designerHow to fix IE ClearType + jQuery transparency issue in this script? - jqueryHow to store arbitrary type values ββin one Django model? - pythonEmacs gud raise prefix error - emacsF #: Tell me what I am missing in using Async.Parallel - parallel-processingFinding Errant exit in System.out in a large Java program - javaError starting Newtonsoft.json: the array was not a one-dimensional array - json.netWhy is Django reverse () not working with unicode? - pythonPHP MYSQL retrieves data based on two columns of the corresponding row - phpSecurity PHP script, inline or other - htmlAll Articles