I’m moving to https://eliasdaler.github.io

Hello, everyone.

Recently I’ve decided to create a new blog which will be cooler looking and easier for me to modify. So I’m proud to present it to you!

https://eliasdaler.github.io

This will be the blog I’ll be using in the future and then maybe I’ll move to some domain like eliasdaler.com or something like that.

You can find all the info about why I’m moving and what I’m planning to write about next here.

See you there. :)

P.S. This blog will remain as an archive of everything I’ve written before that, but I’m probably going to put big notices at the bottom of the pages to go to newer articles or I’ll just remake some parts of the articles which I consider to be out dated.

Advertisements

Using Lua with C++ in Practice. Iterating over Lua tables

Hello, this is new part of Using Lua with C++!
This part will be short, but very helpful. It will use LuaBridge and Lua C API, but it’s pretty easy to rewrite stuff for other Lua/C++ bindings.

The problem

Suppose you have a Lua table this:

someTable = { 1, 5, 10, 20 }

Suppose that someTableRef is a LuaRef pointing
It’s pretty easy to iterate over it using LuaBridge:

for (int i = 0; someTableRef.length(); ++i) {
    // note the i + 1 here, it's because arrays in Lua start with 1
    LuaRef elementRef = someTableRef[i + 1];
    ... // do something with the element
}

But what if you have a table like this:

someTable = {
    firstKey = "someString",
    anotherKey = { ... -- some stuff }
}

and want to iterate over it?

This can be easily done in Lua:

for k, v in pairs(someTable) do
    ... -- do stuff with k
end

But how do we do the same in C++? I’ve found no way to do it in LuaBridge (and seems like lots of other libraries don’t include this functionality as well), but fortunately we can use lua_next from Lua C API to do the thing for us!

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. April-May 2015. Recreation mechanic, archers, event system and more!

Last two months were pretty awesome. I had lots of free time and was able to implement lots of new stuff!

Recreation mechanic

Let’s start with a gameplay gif:

It’s another example of recreation mechanic.
For those who don’t know, recreation mechanic is the main mechanic in my game. When undead hero kills people, he can leave his body and control dead people with his ghost. He gains their abilities to progress through the game and solve various puzzles. But he can’t leave his body behind for a long time because he can’t carry the hammer while controlling other people. The hammer can do some stuff which normal weapons can’t. (break some floors, for example)
This hammer is very heavy so he can’t carry other weapons. So, for example, in order to shoot arrows, you need to kill archers and control them with your ghost.
He can also use his ghost to reach inaccessible areas. But this won’t be very useful if there are no corpses lying there because he won’t be able to interact with the world this way. But it has another use: you can look around and see what you have to deal with next. This will be very helpful when solving complex puzzles.

Continue reading

Instant Indie Halloween Edition

My game is featured there. :)

CrowSong Productions

Hey Everyone. Here’s another Instant Indie-A quick look at some great Indie products. In our Halloween Edition we look at a Motion Comic with music, a Kickstarter comic based on H.P. Love Craft called Kidthulu, an addictive iOS game and some early information on a Zelda-esque game in its early stages. All of the information is straight from the developers’ mouths, and it’s not my spin. It’s what they want you to know about their products, except for my opening commentary on each. Enjoy, and thanks for supporting independent goodies.

Re:creation

I’ve been talking with Elias Daler for awhile for an upcoming interview on being an Independent Developer. Look for that article soon. The concepts Elias is using and the gameplay his game will have are all things I’ve been wanting to see for awhile. I personally loved the Legend of Zelda games as well as early RPGs like  Final…

View original post 800 more words

re:Creation week #5. Improved level format and saving system.

Previous weeks:

Foreword

Last week I’ve posted this screenshot of re:Creation to /r/IndieGaming to know what people think about new graphics. I expected 2 or 3 people tell me something like: “it’s good, keep working” or “that’s bad, keep working”. The thread got lots of upvotes and comments and there was lots of constructive critique which I didn’t expect. Some people said the game looks really great. This was really awesome and now I know in which direction art style should be moving.

And here’s what I’ve been doing this week.

Continue reading