One of my friends, Maadhavan, got inspired by me and decided he would learn c++ and make a game. I have to say- he has such a strong determination, he learnt c++ in about two weeks (or should I say- learnt whatever is possible in two weeks) and started coming up with games he tried to make from scratch. Sadly, none of his games worked, but I told him not to loose hope at all, and came up with an idea about doing a tutorial on making the simplest game with c++ for him.(Thats nice, isn't it? He got inspired by me and I got inspired by him!) Maadhavan, this one is for you.
Friday, 13 March 2015
Tic-Tac-Toe ....Anyone?
Thursday, 12 March 2015
UNDONE Engine Update!
So last time I was struggling with the mathematics, right? You won't believe how far I came from there. Not only did I solve the maths problem - which was caused by the very reason I thought it was - I added a couple of new abilities to the engine. So here they are:-
Colored cubes with materials. |
First up, I added materials, which abstract away the OpenGL calls required to set up corresponding shaders for a mesh, getting the uniforms to the shader and such stuff, including handling and managing textures and colors. A material is designed as a component, and each Game Object can have it's own personal little material with the help of which it's mesh gets rendered, So now I can render colored cubes!
Further, I improved the transformations, so now transforming Game Objects with 'child' Game Objects will effect the transforms of all the child Game Objects. Think of this like when you move a ship, all the independent objects inside the ship will move with it too, just like it should be!
Here are some screenshots which I took while experimenting with rendering colored cubes of different sizes in a grid.
The screen shot on the left contains exactly 2500 cubes altogether. That ran at a frame rate of about 20 FPS - which is kinda low. I do not yet use instanced drawing, and using that in that scene will give me a performance boost for sure. I will add instancing later, but for now, this is quite impressive, ain't it?
After that I worked on loading 3D model data from files, so that I can design models in Blender or something similar and load it into a game in the engine. I chose to use an open source library called Assimp for making thing easy for me. Assimp is one really cool library- trust me. It can import and export nearly all the well known 3D model formats. Here, I loaded Blender's Suzane into my engine.
I had a particularly weird problem while setting Assimp up with UNDONE. In my visual studio project, I set in the project properties the include path and library paths for the Assimp library, which I downloaded the version 3.1 SDK. After that, everything compiled and linked correctly, but my application was unable to start because assimp depended on a weird little .dll somewhere which it could not find, and did not start. It won't even tell me which library it was. Later I found out that there was something wrong in the way assimp's distribution was made, and had to go through the trouble of downloading the source, generating a vc++ project file via C Make (which I didn't have and had to learn how to use correctly, even after reading assimp's instructions here.), correct what was wrong, and build the library by myself to use it with UNDONE. When I get time, I will write a post about how to do that in detail, so that others out there struggling to get Assimp work can see. That won't be late, I promise.
That was the only problem with assimp I faced. otherwise, it is an awesome library, like really awesome. Here's a Chinese Dragon I imported with it's help:
Not that bad, is it? |
After model loading was done, I then worked on my 2D rendering. Thanks to the texture loading code I had written earlier, it wasn't hard for me to make a 2DGraphic component and get a texture on the screen with the help of it.
Look Suzane! You have a friend! |
Labels:
3D,
Assimp,
Game Engine Development,
Materials,
OpenGL,
UNONE Engine
Subscribe to:
Posts (Atom)