Monday, 25 July 2016

Weekly Dev Report #5 - TEXTURES!

Oh, did I say, last week, that I was working on the player moving? Well, I did that too, on the 19th, and also on the 19th I implemented some basic texture, basically, a failed checkerboard pattern:
Yeah, I fixed that soon....Anyhow, on the 20th I actually bit the bullet and worked with libPNG and my lovely little graphics program to get this:
Lookie! TWO screenshots in one Dev Report! Lucky you guys! Note: not final textures. Not final models...Not final anything!

I've also changed some background code for the models, and the loading of them.

Next week I'll be working on the model format, making things easier to work with and render. I want it to be simple and easy to use for myself, and anyone else looking at the engine. Currently it looks like this (model side, not talking about textures):
Make MeshBatch (The thing that actually deals with GPU-Program communication for meshes)
Make Model (Variable)
Tell Model about MeshBatch.
Load an actual model in the Model.
Make the Renderer.
Then in the game loop:
For each Geometry in the Model, Render it.

A lot of the steps will be the same all the time, so I'll be shorting this to:
Make ResourceManger;
Make Model(s) and load it from ResourceManager.
Make a RenderList.
Tell RenderList about Model(s).
Then in game loop:
Tell RenderList to Render.

The ResourceManager will, well, manage all the resources, models, textures, anything else I can think of. It'll also deal with all the little things that programmers (or rather, myself) don't want to do with every single resource. Also, if I decide to release this to public, for learning purposes or any other, people won't be overwhelmed by everything this engine provides, or doesn't provide.

Anyhow, nothing else new I can think of so, like always, have a good time!

Monday, 18 July 2016

Weekly Dev Report #4 - Some useful tools


My life this last week.

Quaternions, they're tricky little things. You can kinda guess what I was doing this week, other than making witty comments. So! All my lovely work is now in quaternions, that work! For anyone insane enough to make their own math library, I shall give you the references I used, and sometimes intermingled, to get this lovely piece of work, working!
http://www.cprogramming.com/tutorial/3d/quaternions.html  This was a big help, no doubt about it. If you want something quick and easy, that's where you go to.
http://www.3dgep.com/understanding-quaternions/  Good read, can help you understand quaternions and the math behind it more, there's some more functions there too like dot products of two quaternions.
http://www.songho.ca/math/quaternion/quaternion.html I just liked this one, the format of how it was done, explains a few things too. All these links tell you the exact same thing, though in different ways in some.

Now... Wanna make sure your calculations are right? The following two sites helped me debug the above problem, with my own print() functions for the matrices and quaternions:

And, my so far favourite tool of all time: gDEBugger!

Now What did I Actually Do?

A lot-ish. First, I made the cube, instead of a rotating rectangle, made it rotate on the x and y axis for fun. That was, seriously, the day after the last post. The rotation was using Euler angles though, and I didn't like the idea of impending doom (gimbal lock) so I started with the Quaternion math, spent half a day writing it, spent the rest of the day debugging it, it took me 5 hours to find out the signs were switched....It deserved a comment... (as above). Then I decided to use the keyboard to control the rotation of the cube, cause, why not?!
Then, after that, I started working on separating my code so I can actually load models in! Exciting! Guess what the first model I loaded in? A CUBE! Actually, it was created on the spot with code...I'll have some utility functions to create basic shapes. Later on I separated the huge mass of the hard-coded cube into just rendering and a MeshBatch class, which will be used for having multiple meshes into one VBO, and the mesh Indices into one IBO. After that I finally separated the Shader Program class from the renderer.
I'll taking out all the functionality of the Renderer and placing them in other places. Right now my code is structured so that the renderer does all the work. My method of working, which may not be the best, but it works for me, is make it work first, then separate it into classes later, make sure it still works, and cut it up some more!

Now, for the fun part (My niece gave me that idea, she's reading this as I type it): The weekly screenshot!
It's a cube! Better than a rectangle right?...RIGHT?! Well, since the game will be made outta cubes, for the most part, this is the most important part!....Well, there's the other code too...but....ANYHOW

Next Week: (or rather this week heh) I'll be working on making the camera move around with the mouse and WASD keys (and QE for rotating on the Z axis); anything more is extra and awesome :)

And, like always, have a good time!

(Also, Welcome Twitter users!)

Monday, 11 July 2016

Weekly Dev Report #3. Update and "Why make a game engine?"

Oh hey! I'm on time!
So yeah, I'll be trying to do this on Monday afternoon sometime (my time, might be tuesday morning for all you folks overseas!)

So, what did I do this week? A lot of vector math, matrix math, etc. Nothing to show, other than a spinning square. Oh hey, I did say I'd show progress...Well okay:
Last week! ish....I actually don't have a screenshot for last week and didn't want to delete all the code, so I just modified the shader to show ALMOST what last week was.
This week! So exciting huh? No? Well, that's cause most of the work was behind the scenes. I have it so you can specify matrices values as column major order, the system OpenGL uses. If you don't like that, there is also row major order as well. All the vector and matrix math uses templates so you can just use Vector<float, 3> or Vector<int, 2> Heck, I don't see why Vector<char, 17> wouldn't work! Just...it would be pointless. Same with Matrices, but one must specify in column major order for it to work. Next week the plan is to make sure that I can convert between Vector and Matrix, and also have Matrix * Vector work. Won't take long at all, I'll also be working on Quaternions, so don't expect anything prettier than above for next week, who knows, maybe I'll make a gif of it spinning? 

Now... I can hear a few of you asking "Why make a game engine? You have Unity, or Source, or <insert fave engine here>!" Well, for one: the experience, the pure joy of making something by hand! That's also why I'm making my own *grunt* math library. Another reason is that, Unity, Source, and others don't have the features I'd want, SURE they have a lot of features I do want, SURE I can program the features I want into them....but that would require understanding how they work at a deeper level, when I already understand OpenGL at the level I currently require. Also the game doesn't require too much in way of graphics capability, so using something as powerful as Unity is, let's be honest, overkill.

Would I suggest making your own engine? If you want to make a game asap? The no. You want to make a game that'll sell this next year? Nope! Want to make a game that will impress everyone? Probably not. Want to learn how games are made inside out? Yup, make one then. Have wayy too much free time and want something to keep you busy? Then if you're up to the challenge, do it!

So, Normally I'd say something about last week to tie these two weeks together, but...the only thing that's really the same is the vector math library I'm working on. So, besides that, nothing much to relate to.

While I'm still trying to get comfy figuring what I should say each week, to make this more engaging for you guys, and not just saying whatever comes to mind! (Though, I think that works too hehe)

Anyhow! This is it for now! Don't expect a screenshot next week, unless I've done something AMAZING (ie, not get distracted and did something productive that's for show) Well, I guess I did do something new, seriously the day after I posted this, so screenshot next week! I'll see ya guys next week! Until then, have a good time!

Tuesday, 5 July 2016

Weekly Dev Report #2! - Starting rough!

Well, a day late, isn't this going well!?

My excuse: Vector Math Library. My real excuse:
dot product, cross product, vector addition, subtraction, scalar multiplication, normalizing, magnitudes, and anything else I can think of.

I was thinking of slapping a picture on here of what I've done, show you guys the week to week progress. While there is progress going on, I realized I should've typed this last night instead of this night, so I'm gonna say there's no time and leave it at that ;)

Okay so, summery of what I ACTUALLY did, because I can't make excuses all the time right? Anyhow, the beginning of the week I started some big time research on sound, a subject I haven't touched until now. Why was I researching sound? Why aren't I going head deep into graphics first? Well....I AM going head deep into graphics first, I just wanted to get excited about what will come in the future, help me get motivated, and allow me to realize what I might have to get into later on.

I later came across an article about Unicode, and thought I should read a bit about that, so all you geeks can put "ФÐ" and similar as your ingame name, if you so choose! The reason for this is so that my library will be able to support multiple languages if I choose to go that way. And if not, you guys can still get pretty weird names outta it! This lead me to program a quick and dirty little UTF-8 to wchar_t converter, nothing too special, but it was a fun little distraction from OpenGL.

Then I targeted my aim at OpenGL and got a simple rectangle on the screen, nothing too brilliant, but it's something (so I can check off something from my insanely growing list). Now, I'll be implementing a simple rendering system in my engine, while I've never seen this done before, I'm probably not the first to do this idea. I call them Render Lists. They're basically a list of geometries to render on the screen, and their location. They'll be ordered by texture and material, so we only need to select the texture, render as many geometries with said texture, switch to a new one, render those, switch, render, etc.

And finally, that todo list I briefly mentioned (the one that's insanely growing), I'm doing that to help myself keep motivated, as checking things off is, in a way, a reward for itself. In a game, if you have a todo list, isn't it rewarding to get something done? even if there isn't a reward to do it (because it's a part of a bigger quest, which will give you a reward). Well, same idea here. While there's not really a big reward to get these tiny things finished, if any reward at all (other than seeing your code work), there will be a huge reward afterwards, namely, a milestone finished, a milestone that I can play and have fun with, and more importantly, a break to get my mind relaxed and ready for the next milestone! Who knows, I might treat myself to dinner too...Subway anyone?

And here is where I shall leave you guys! Have a good time!

Monday, 27 June 2016

Weekly Dev Report #1 - Hello World

printf("Hello World!");

My first post, my first weekly report, my first big plan.

This blog is here to share my lovely experiences with C++, game programming, and anything else I may come across useful for programmers. I'll be posting a few snippets of code here and there, to show troubles, workarounds, and maybe thoughts about my project(s).
I'll be discussing pretty much anything that comes to mind, any research, anything really.
Another big thing I'll be doing every week is showing screenshots and posting what I've done within that week. 

So, enough introductions, let's get to it!

What's the biggest thing that stops a lot of people from doing anything? I'd have to say, at least for me personally, is motivation, or rather, the lack of. So how do we fix this problem? 
Well, I'm trying to do exactly that right now! By writing posts, tweeting (something the outside birds are having no problem doing right now), and writing a rather lengthy todo list.
Just a word of warning though, the todo list, don't make it too lengthy, or else you'll just see a huge mess of writing and you'll probably end up thinking "How am I supposed to do ALL of this?!" For me, I just wrote a small-ish part of the project, and then made sub-tasks for that part. In my case, for my currently unnamed game, I just wrote down "Make ship editor" That's it. That's all. My game, for the current time, will be a spaceship editor. You can't fly it, you can't shoot it's guns, you can just walk and build onto it, and delete things off. Oh and save and load it (those are important aren't they?)
What's more, everything will be cubes. Textured cubes, but cubes nonetheless. Will that be the final game? I hope not! But it's a start, and the best thing for motivation is to start! And to start simple!
What will I hope the game to become? Who knows, you'll see! 

This week I'm planning to actually get something started, since I already have some code half ready, I'll start with that, since it was originally supposed to be a similar game, I've already have some code to jump off of!

But anyhow, this is the small little report for this week. I'll be writing one every Monday, assuming I'm not deathly ill! And have a good time!