Scrolling camera
Got a scrolling camera to work in tonights short session, showing a part of a bigger underlying map. Next up:
- Generate Dungeon
- Shadow casting/field of view
Got a scrolling camera to work in tonights short session, showing a part of a bigger underlying map. Next up:
Today, by chance, I stumbled upon the free tileset section on Itch.io (https://itch.io/game-assets/free/tag-pixel-art), and I instantly fell in love with so many of them! I’m usually not a big fan of using random peoples stuff, but I think this made me change my mind!
I downloaded a few and started playing around with one of them, making ireggular semi-topdown floor tiles. I could easily integrate them since this is not a console at all, but a regular window I draw bitmap fonts into. Easy peasy!
But the very reason I started with this in ascii was to NOT having to bother with graphics… so even though it looks realy nice, it will have to wait for another project.
Bought myself a new hobby gamedev laptop. It’s really small, and really neat. And kind of weak… So I needed a project that it could handle.
After trying haxe it was clear that compiling haxeflixel was painfully slow. If I did it directly in c++ instead it worked like a charm.
So c++ project it is! Using SDL and the base from my Ludum Dare code base. Got a dude moving and placing blocks. Good first progress =)
I’ve spent some time trying to port my text engine to linux and mac, with the following results:
So I have abandoned that path for now. Instead started looking into the SDL library instead… and it is really smooth to work with! (at least on Linux). I have currently managed to get it to work on both Linux and Windows!
I can even work with this code on my old, very beloved, Asus EEE 1005PE netbook. A ten year old 10.1" computer that freezes if it tries to open any random webpage (Gmail? Just forget about even trying), however it has a whooping 250gb harddrive, a keyboard like a dream and a battery that lasts for an eternity. Writing C++ code in VIM (in a terminal window) works like a charm… like in the 70’s ;-) Compilation is around 1-2 seconds, which is not only acceptable, but also faster than Unity compiles on my powerhorse workstation.
This looks very promising for the upcoming Ludum Dare competition!
Now writing to bufferes and writing those to the output. Writer class that prints text character by character and interprets simple commands (right now only newlines and changes in speed and pauses). Two days left to Ludum Dare.
Tutorial that describes pretty much exactly what I’m playing around with
http://cecilsunkure.blogspot.se/2011/11/windows-console-game-writing-to-console.html
Good to keep as reference!
https://github.com/Tommislav/cppTextEngine/commit/1110c6c53b7abb51c5c5a34364d7f450046d8c35
More fun with your terminal:
So far I’m surprised by the speed (the delay you see is actually me pausing the thread)! The last time I tried stuff like this directly in the terminal it flickered like hell. But that time I was using conio.h
, this time I write stuff myself using only windows.h
.
I’m not using buffers yet, only moving cursor and writing to that position. Guess writing to buffers will make it even faster. But thats for another day…
Ok, for the first time in a long while I got two hours that I could spend on programming! Need to refresh my c++ knowledge quite a bit (the metro siberia part below uses OpenFrameworks to do all the heavy work for me). But in these two hours I still managed to:
:make
)Not very exciting, and now the time is up. Time to hit the bed. Felt good to do some programming anyways.
Small progress. Started porting over my matrix implementations from haxe. At the moment it actually looks more like C-code than C++.
Started a re-make of my old game Metro Siberia in C++. This is the big plan:
Currently nothing more than a window that renders the picture above.
My recent days of night dev has been a bit fragmented due to the fact that I have two newborn kids that require a lot of attention. But whenever I get a spare moment I try to do a little bit of programming, so todays post is actually the result of several short days of work.
First of all I needed to read up on plasma effects again. Haven’t done that in several years, and it turned out I did not fully remember how it was done. But I did find the excellent tutorial I used several years ago, I highly recommend reading it!!! It is ugly, but very interesting read: http://lodev.org/cgtutor/
After that I started playing with shaderToy, trying to get a plasma shader running.
And lastly, I implemented that shader into my c++ sandbox project. Something seems to be a bit off though, it is way to bright. I think it is because the range of each sine/cos-effect (that is merged together to form the plasma) has an incorrect range (not 0-1), or perhaps the area is too zoomed in – but it’s too late to start bug-hunting now so this will have to do for now.
Next up: colors and bitmaps!
Spent several hours rewriting my setup code to play with shaders. This is a tutorial that explains it very nice and cleanly: https://open.gl/introduction
I also found a library for loading png files from disc, that don’t require you to invoke make-scripts and all that madness. Just add one .h and one .cpp-file to your project and you’re done! The name is LodePNG. However, did not come far enough to read textures into my shader.
However I managed to get uniforms working, so I could pass the current time to my shader and animate it. I guess that’s something. That’s all for tonight.
Since I became a father of two twins, two months ago, I haven’t been able to do much coding at all. Any opportunity I get I have to make sure I do something really small since my work time gets very fragmented.
So I started a c++ project, open a window with an openGL context, and started playing with some really basic shader code. As I said, I didn’t get very far before I had to abort. But it’s something.
Just wanted to save the links to some pages that helped me setting up GLFW on windows in Visual Studio 1013. http://www.41post.com/5178/programming/opengl-configuring-glfw-and-glew-in-visual-cplusplus-express
http://www.codeincodeblock.com/2013/05/introduction-to-modern-opengl-3x-with.html
https://github.com/smokindinesh/Modern-OpenGL-Series
#version 420 core
out vec4 color;
void main() {
float x = mod(gl_FragCoord.x, 100.0) / 100.0;
float y = mod(gl_FragCoord.y, 100.0) / 100.0;
color = vec4(x,y,1.0,1.0); }
Took a short break from the Unity project to go into C++land. Decided I wanted to play around a little with some C++ and openGL.
I wanted to develop on my Linux partition (why make it easy for yourself?) but make the code cross platform so I’ll still be able to run it on my windows machine. I decided I wanted to use glfw for all the window, input and timer hassle. It seems light weight, and it is used in this tutorial by my colleague at Isotop (he named the blog series “I’m not a smart man” for some reason. Trust me that it is very far from being true!)
So, did it go smooth? Not at all. I’ve spent a bit over three days trying to figure out how in *#¤% you manage to tell Code::Blocks how to find and link the libraries I want to use. I’ve covered it in a blog post, mostly for my own convenience. Probably full of incorrectness.
Well, now I have a spinning triangle in a window. Time to make something more interesting!
Continued with the C++ project. Noticed that the sample code for my triangle was in the older glBegin…glEnd format and changed it to the new opengl 3 standard with shaders, only to get a totally black window. Turned out you need to add the following code to enable opengl 3 and core profile:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
Which gave me a triangle once more.
The rest of the evening was spent re-reading about matrix operations, and the Model-View-Projection matrices. It was a long time since I last played around with this. You quickly forget if you do not keep working with it.
Since the Christmas Holidays I’ve started watching the fairly new stream Handmade Hero, where we get to follow Casey Muratori, as he builds a game in C, from scratch, without any libraries, and streaming and explaining every single line of code that he writes.
I’ve been struggling with C++ for a while now, but it’s very difficult to find answers when you get into a situation where you need help with a specific problem. There are endless ways of solving the same problem in C and C++, and very often you will get contradictionary or incomplete solutions. And a lot of times people just answering “You shouldn’t do it like that” and then nothing more.
So I enjoy this video stream very much. Casey explains every single line of code he writes. And also sometimes explain other ways to solve a task, and why he prefers the one or the other. He also tackles some very advanced topics, like how to structure your code to get a good foundation for platform independance. And he does it very elegantly.
The stuff he teaches is not something you wouldn’t easily find in any text book, and corresponds to years experience, so I highly recommend watching.
At this point I’ve watched Episode 13, and coded up to episode 5. I Haven’t anything more interesting to show right now than a simple window, with a simple animated buffer (rendered in software) in Windows. All I have to show for it right now is a simple Screenshot.