Re:creation dev log. March-June 2016. Part one. Game stuff and and some awesome Lua scripting

The last few months I was very busy finishing my bachelor’s degree (it’s over, I got an “A”!). But still, I’ve managed to do some cool stuff and improve the engine structure and tools in the last couple of months.

This dev log will be released in two parts. In this part I’m going to talk about game stuff I did and stuff I changed about Lua/C++ integration. In the second part I’ll talk about engine tools I’ve made with ImGui and different refactoring I’ve done.

Game stuff

Here’s one of the latest screenshots of the game. Houses were previously just big sprites, but right now they’re composed out of tiles which lets me reuse them for other houses and build new buildings more quickly.
i2yn8x4

Continue reading

Advertisements

Creating awesome GUI for you game dev tools with ImGui and SFML. Part 1.

This is the first part of tutorial about Dear ImGui (AKA ImGui) and it’ll show you how to set it up with SFML. The second part will be library agnostic and will talk about common ways of doing stuff in ImGui, some awesome widgets and some useful STL overloads.

examples_01

Different ImGui widgets (taken from ImGui’s github page)

Introduction

Having good content creation (level editor, resource editor, etc.) and debugging tools for your game is very important and can lead to productivity and creativity boost.

Here are some examples of tools I managed to make with ImGui for my game:

Level editor:

Animation editor:

(It was possible to add ability to change members of C++ objects with ImGui by doing some template magic, maybe I’ll write an article about that later!)

As you can see there’s a wide range of widgets that ImGui can provide and there are lots of other great examples of how other people use it here. Continue reading

2015

Hello, I realize that this post may be a bit late, but I was so busy with exams and making of my game that I didn’t have enough time to write this post sooner. But now I’m finally free!
This post will about my life in 2015: the stuff I did, learned and experienced.

ovo5ghf

Playing some SNES games in Console Museum

This year wasn’t as life-changing as the previous one. It’s hard to surpass getting the best girlfriend ever and making an awesome game out of small prototype. But still, this year was a perfect continuation of the previous one. All the things in my life just got better.

Continue reading

Using Lua with C++ in Practice. Getting data from scripts and why globals are evil.

This part doesn’t depend on the others, so you can read it even if you haven’t read previous parts. (I suggest to check them out, though. You may find some interesting stuff!)

This part will mostly use Lua C API only. LuaBridge is used for a small part to show some cool stuff. (Though you’ll be able to follow with most other bindings)

This part contains one of the most important practices in Lua programming which I discovered pretty recently and felt dumb afterwards because for the last two years I’ve been doing stuff wrong.

Today I’m going to talk about storing Lua tables and variables in scripts.

Storing data in Lua is great. You can easily store stuff in neat way and you can also store functions which you can later call from C++. You can store tables (or other variables) in scripts in two ways: as global variables and as local variables. Let’s talk about each one.

Continue reading

Re:creation dev log. 2015. The most productive year yet.

It’s time to summarize what I’ve done during this year with Re:creation. It has been very good year, I’ve managed to do and learn lots of stuff.

Before I write about the stuff I’ve done I want to thank everyone who followed my progress and provided feedback. This stuff is really important for me and always keeps me motivated. With your support I never feel doubt about my game, I never want to stop making it. Thank you.

Special thanks to SFML community. It turned my dev log thread into a very cool discussion and helped me out with lots of stuff. This level of support is much more than I’ve ever expected and it’s very heartwarming.

I’ll show the most interesting stuff I’ve done and then explain some in more detail.
Some screenshots are taken at different parts of the year, so they may differ a lot!

Some gameplay gifs to get you started:



This one is my favorite gif so far. It really shows a lot of stuff I’ve made this year.

Continue reading

Using Lua with C++ in Practice. Part3. Controlling entities in Lua by calling C++ functions.

If you haven’t read the first part of the tutorial, I suggest you to read it, so you have a clear idea what’s going on. See the second part for the implementation details.

This article uses LuaBridge and if you’re not familiar with it, I suggest you to check out my tutorials about it. (Pt1, Pt2). If you’re using another Lua/C++ binding: that’s fine, you can totally implement everything I’m talking about with other bindings.

Intro

One of the coolest things in Lua is that you can call C++ functions from it. You can even register your own classes and call their member functions!

Suppose you have an entity class which contains a list of components:

class Entity {
    ...
private:
    std::vector<std::unique_ptr<Component>> components;
};

Suppose that you have a function which lets you get a component by its name.
What if you want to change animations in some Lua script? You can do it like this:

function someLuaFunction(entity)
  ...
    local graphics = entity:getComponent("Graphics")
    if(graphics) then
        graphics:setAnimation("someAnimation")
    end
  ...
end

I believe that this is not a greatest way to do things, because exposing components to Lua is not really necessary. Woudn’t it be nice to hide all the implementation details in C++? Here’s how the code above may look:

function someLuaFunction(entity)
  ...
    entity:setAnimation("someAnimation")
  ...
end

Continue reading

Re:creation dev log. June – October 2015. I’ve made lots of stuff.

Almost five months passed since the last dev log on this blog.
Why? That’s because I created SFML forums thread and TIGSource thread and wrote most of the stuff about the game here! But I’ve realized that a monthly summary about what’s going on would be pretty helpful for those who don’t want to read long threads and search the most awesome stuff that’s been happening. Another plus is that I don’t have to write lots of in-depth style here. I will write in-depth stuff in SFML forums and TIGSource threads and link to those posts here, so you don’t have to scroll through stuff that you don’t want to read lots about.

Here’s the best screenshot I can show you at the moment to show where the things are right now.

Okay, let’s start.

Continue reading