Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualVZdemon

Posted 28 August 2013 - 06:16 AM

Hey people. As a heavy Unity3D user and a programming hobbyist I was inspired by Unity3D to make my very own game engine. Except this one was going to be free for everyone and completely cross-platform. Meaning you could play and make games on linux, windows, and osx (Not ready to get in to mobile yet). I have a very rough base to start from and I wanted to get some feedback or just show off some code.

#include "Core.h"

class Controller : public Component {
      public:
          void Init() { // Gets Called Right before main loop starts
               cout << "Hello World" << endl;
          }          

          void Update() { //Gets Called every frame update
               if(Input::GetKey(KEY_W))
                    node->transform->Translate(0, 0.1f, 0);//node is the GameNode this object is attached to
               
               if(Input::GetKey(KEY_S))
                    node->transform->Translate(0, -0.1f, 0);//node is the GameNode this object is attached to
          }

          void Quit() { // Gets Called Right after main loop closes
               //Nothing to put here and it doesn't have to be declared. Just wanted to show it exists
          }
};

int main() {
	Engine::Init(); {

		GameNode* Cam = Engine::Create("Cam");
		Cam->AddComponent(new Camera());

		GameNode* Cube = Engine::Create("Cube");
		Cube->AddComponent(new Renderer());
                Cube->AddComponent(new Controller());

	} Engine::Play();

	return 0;
}

of course a lot of core features are missing such as lights and shadows, asset pipeline, and an interactive scene graph viewer and editor, and addtional graphics features. But for a start i think I'm in the right direction.

 

Btw any opengl advise/help is gladly welcome.

 

thanks for reading


#1VZdemon

Posted 28 August 2013 - 06:14 AM

Hey people. As a heavy Unity3D user and a programming hobbyist I was inspired by Unity3D to make my very own game engine. Except this one was going to be free for everyone and completely cross-platform. Meaning you could play and make games on linux, windows, and osx (Not ready to get in to mobile yet). I have a very rough base to start from and I wanted to get some feedback or just show off some code.

#include "Core.h"

class Controller : public Component {
      public:
          void Init() { // Gets Called Right before main loop starts
               cout << "Hello World" << endl;
          }          

          void Update() { //Gets Called every frame update
               if(Input::GetKey(KEY_W))
                    node->transform->Translate(0, 0.1f, 0);//node is the GameNode this object is attached to
               
               if(Input::GetKey(KEY_S))
                    node->transform->Translate(0, -0.1f, 0);//node is the GameNode this object is attached to
          }

          void Quit() { // Gets Called Right after main loop closes
               //Nothing to put here and it doesn't have to be declared. Just wanted to show it exists
          }
};

int main() {
	Engine::Init(); {

		GameNode* Cam = Engine::Create("Cam");
		Cam->AddComponent(new Camera());

		GameNode* Cube = Engine::Create("Cube");
		Cube->AddComponent(new Renderer());
                Cube->AddComponent(new Controller());

	} Engine::Play();

	return 0;
}

of course a lot of core features are missing such as lights, asset pipeline, and an interactive scene graph viewer and editor. but for a start i think I'm in the right direction.

 

Btw any opengl advise/help is gladly welcome.

 

thanks for reading


PARTNERS