Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Re:creation - a top down action adventure about undeads [hiatus]  (Read 499034 times)

0 Members and 3 Guests are viewing this topic.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #510 on: February 06, 2016, 09:15:19 am »
Its your decision, but many games chose a boss to include it in teaser-gameplay (e.g. see Dark Souls 3).
Dark Souls has much more stuff than my game, so showing off one or two bosses out of 20-30 is not that big deal.  :)

Just wondering about that. While 6-8 sounds enough for a 1-man-game, i would say that the time to create gameplay content (if the required tools are developed), is small in proportion to the overall dev-time. Your data-driven-philosophy should go hand in hand with that anyway.

You seem to be at a point in dev where you might want to plan the next years instead of a few month so how are your future plans? I could imagine some kind of episode-format?
I currently focus on making a demo which will later show me what stuff I need to focus on. Feedback from people would be very useful and then I'll continue to work on the rest of the game.
The scope of the game is almost defined and I see how much stuff I want to make but it's hard to plan how much it would take me to do it. Cutscene system, for example, saved me a great bunch of time already. Who knows how much time I can save in the future by making new tools and systems.
So, my main plan is simple for now: fully playable demo with 30min-1hour of gameplay.
As for episode-format... No. The game should be fully complete and I won't make it early access before launch.

I see, the communication between my systems happens through events as well. As you said, it is minimal, but don't you think it is a big deal? I sure do. Maybe it's because I'm working on a turn-based strategy game, where events are essential.
The less communication there is between the systems, the better it is for you game, I think. You get less coupling and less dependencies between systems. They each do some stuff and don't share much information between each other.

I have another question, I don't know if you talked about it already somewhere: how about GUI? Are buttons and other GUI elements Entities as well?
GUI elements are not entities, they have their own classes (but I don't have much GUI, but your game may have classes like Button, ScrollBar, etc. Or you can use some SFML GUI libraries instead of writing your own) and right now they're had coded but I'll later store their properties in Lua.
Entities are objects in the game world. Using ECS doesn't mean that everything should be an entity. :)
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #511 on: February 06, 2016, 03:22:36 pm »
Quote
Thank you! Glad that it inspires you. This is turn inspires me. :)
Seeing encouraging posts about your game fills you with Determination.

Sorry could not resist :D

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #512 on: February 10, 2016, 09:19:47 am »
Quote
Thank you! Glad that it inspires you. This is turn inspires me. :)
Seeing encouraging posts about your game fills you with Determination.

Sorry could not resist :D
Ha-ha, that's right! :D

Okay, some progress update.
I'm determined to finish the demo's prototype by the end of the month or a bit later. I won't post much screenshots, because it will be a raw prototype which means shitty graphics, shitty dialogue and some bugs. But this just gets stuff moving faster which I've realized when I made pretty cool boss battle in just 3 days.
How long will I polish what I do? I have no idea.  8)

Scripted action sequence (previously cutscene system) goes pretty well and I'm adding new stuff I can do with it.
Sorry for broken tiles/stuff, this is just a test level!


It's not even a sequence anymore, as I can go from any action to another depending on some conditions. So, it's more like a state machine now.

For example, I made a script named house_enter.lua which scripts door behaviour and stuff when you enter the house.
Here it is: http://pastebin.com/GMcqUQwE

First of all, it has a function named makeCutscene which returns array of actions which are then later used to make a C++ vector of Actions which are then executed mostly in C++, but they also call to Lua functions (for example, f function defined in lots of actions in the script)
It could have been just a vector of references to Lua functions, but some tasks are pretty complex, so I've made some shortcuts for myself which are coded in C++.

I can pass table named args to cutscene, which is used to get different parameters.
For example, when I call door's interact function, it looks like this:
interact = function(this) -- "this" is a LuaEntityHandle of door entity
    playCutscene("house_enter",  { door = this, key = "GOLDEN_KEY" } )
end
So I can later get stuff which I need like this:
local door = args.door
Some actions have tags, so I can go to them by calling goTo function.
Actions which have nextTag property are calling goTo(nextTag) after they're finished. "EXIT_REQUEST_TAG" is a special tag which just stops cutscene from playing.
When I go to the "ENTER" action, following actions don't have tags, so they're executed one after another.

(I'm also thinking about how to do State machines in Lua better and I'll write some stuff about it later when I test some things. I'll also most likely use Behavior Trees for AI, because they're awesome, though this will be the first time I implement them and I'll try to make them data-driven, of course.)

So, that's how it works. What do you think about this system? Any stuff I can improve? :D
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Jabberwocky

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #513 on: February 10, 2016, 01:39:00 pm »
I won't comment on the lua scripting system, I've not much experience with it since I don't use one myself.  But the game looks to be coming along really nicely, Elias!  Agreed, setting some milestones for yourself (the demo) is a great idea.  Sometimes we programmers like to disappear down rabbit holes for a long time without such milestones.  ;)

Mörkö

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #514 on: February 10, 2016, 02:54:47 pm »
Hi.

As I understand you are using an entity component system in your engine right? Could you please summarize how it works, just the broad strokes, most important aspects, etc. What I'm mostly interested in is, for example, does the components have logic or just data? Is there a container `entity` object or are they just connected by ID? How is message passing done? Things like that.

I'm interested in this because I'm currently considering trying ecs for an engine I'm planning, so I'm gathering data on successful implementations of the concept. I could read the whole thread instead of asking but it's very long and thus difficult to get a good overview ^^ thanks.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #515 on: February 11, 2016, 05:29:31 am »
I won't comment on the lua scripting system, I've not much experience with it since I don't use one myself.  But the game looks to be coming along really nicely, Elias!  Agreed, setting some milestones for yourself (the demo) is a great idea.  Sometimes we programmers like to disappear down rabbit holes for a long time without such milestones.  ;)
But how does the script itself look? I think it looks pretty readable even if you have almost no experience with Lua :D
And thanks for support :)

Hi.

As I understand you are using an entity component system in your engine right? Could you please summarize how it works, just the broad strokes, most important aspects, etc. What I'm mostly interested in is, for example, does the components have logic or just data? Is there a container `entity` object or are they just connected by ID? How is message passing done? Things like that.

I'm interested in this because I'm currently considering trying ecs for an engine I'm planning, so I'm gathering data on successful implementations of the concept. I could read the whole thread instead of asking but it's very long and thus difficult to get a good overview ^^ thanks.
Hello. :D
There' some stuff about my view of ECS here.
Stuff about Event handling is here.
You can also check out my Using Lua with C++ series which show how I implement stuff (though it's simplified there, of  course).
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

grok

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • Email
Re:creation - a top down action adventure about undeads
« Reply #516 on: February 11, 2016, 07:17:49 am »
Hi there.
I've been following this topic for a long time. What I can say - you do an amazing job!

One question regarding ECS engine - how  do you process, say 'GraphicsComponents' in the specified order?
For example, let's suppose we have tilemap (i.e. the 'background' layer), then we have HUDS tilemap on top of that, and finally we have our entities like main hero, enemies, whatever. Obviously, during the render we must process them in the specified order: 1) tilemap; 2) HUDS tilemap; 3) enemies and main hero.

Or, suppose, we need to render GUI elements on top of all rendered stuff.

If we just say to our Render system: "hey, take all graphics components and draw them", it will be a mess.

How do you do that? Thank you.
« Last Edit: February 11, 2016, 07:29:31 am by grok »

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #517 on: February 12, 2016, 05:48:32 pm »
Hi there.
I've been following this topic for a long time. What I can say - you do an amazing job!
Hello! Thank you :)

One question regarding ECS engine - how  do you process, say 'GraphicsComponents' in the specified order?
For example, let's suppose we have tilemap (i.e. the 'background' layer), then we have HUDS tilemap on top of that, and finally we have our entities like main hero, enemies, whatever. Obviously, during the render we must process them in the specified order: 1) tilemap; 2) HUDS tilemap; 3) enemies and main hero.

Or, suppose, we need to render GUI elements on top of all rendered stuff.

If we just say to our Render system: "hey, take all graphics components and draw them", it will be a mess.

How do you do that? Thank you.
I have two GameStates in stack of states, so PlayingState calls renderingSystem.process() (which draws tilemap and entities) and GUIPlayingState calls state->draw() which just draws stuff on top of everything. That's all there it to it. :)
ECS doesn't mean that everything has to be part of ECS system. GUI is separate, but still can access events and info from entities. But it's drawing is fully separate and I'm okay with that. :D
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

totoo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #518 on: February 24, 2016, 05:27:29 pm »
hi Elias ! first of all I'd say what you made till now is great, just keep going, can't wait to play your game!

Actually I'm making my own game too (what a surprise!), and reading yours made me want to use Lua too for scripting. So I'm currently reading your articles in order to learn (which are great btw), and I found a better way than yours to get a table keys (https://eliasdaler.wordpress.com/2013/10/20/lua_and_cpp_pt2/), I don't know if you still use the same code but on your article you're making a string which contains lua code to execute it in a C++ program... definitely not the best way   ;)

So there's mine:

std::vector<std::string> LuaScript::getTableKeys(const std::string& tableName)
{
    std::vector<std::string> strings;

    if(!lua_gettostack(tableName)){
        return strings;
    }

    for(lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)){
        strings.push_back(lua_tostring(L, -2));
    }

    cleanStack();
    return strings;
}

In fact, when using lua_next(), the value is located at the bottom of the stack, whereas the key is located one upper. So getting the value of the key is as easy as that.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re:creation - a top down action adventure about undeads
« Reply #519 on: February 24, 2016, 06:25:19 pm »
You might accidentally call lua_tostring on a non string key, which will break lua_next.
Quote
While traversing a table, do not call lua_tolstring directly on a key, unless you know that the key is actually a string. Recall that lua_tolstring may change the value at the given index; this confuses the next call to lua_next.
Back to C++ gamedev with SFML in May 2023

totoo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #520 on: February 24, 2016, 07:43:04 pm »
indeed, but in my case (and in his too I guess) the keys I'll catch like this will always have no space, or if there are, I simply need to add brackets and double quotes. If the name has no spaces then it is automatically converted into a string, for example:

player = {
        AnimationComponent = {
               
                animations = {
                        idle = {
                       
                        },
                       
                        moving = {
                       
                        },
                       
                        attacking = {
                       
                        }
                }
        }
}
 

if I catch the keys of the animations table, like this:

std::vector<std::string> vec = script.getTableKeys("player.AnimationComponent.animations");

for(unsigned int i = 0; i != vec.size(); ++i){
    std::cout << vec[i] << std::endl;;
}

this will output this:
idle
moving
attacking
(the order is variable but it does not matter)

and if you want to use spaces in your key name :

player = {

        AnimationComponent = {
               
                animations = {
                        ["moving right"] = {
                       
                        }
                }      
        }
}
 

this will output the correct name, with the spaces  ;)

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re:creation - a top down action adventure about undeads
« Reply #521 on: February 24, 2016, 09:44:24 pm »
If there is a number in one of the tables then it'll raise an error. If that error is not in a protected environment (pcall) then it'll call the default panic function and call abort.
Back to C++ gamedev with SFML in May 2023

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #522 on: February 24, 2016, 10:34:44 pm »
Hello, totoo
Thanks for you kind words. Really appreciate that.
I recently wrote an article about the problem. Here: https://eliasdaler.wordpress.com/2016/02/16/using-lua-with-c-iterating-over-lua-tables/
So, it's almost the same as getting all keys in table. But it does more, it gets keys and puts values in LuaRef's which is a lot better, because then you can easily iterate over the table just as you would do in Lua with pairs function! That's because most of the time you don't need a list of keys, you need values too. So this function proves to be pretty useful.
As for the non-string keys... My function checks if the key is string, so there's no problems with that. Most of the time I don't care about non-string keys.

Progress update?
It's been a while since I've posted anything new. So you might be thinking that there's not much to write about. But this is false, I'm working very hard on the game and it's actually what I do most of the time for the last few weeks.
It feels like a completion of the base engine so I can focus more on the content once it's done.
I've done a lot of stuff and there are some pretty neat stuff I want to show and I'll do it as soon as I can!
Don't expect new amazing screenshots and gifs, though (sorry). Some of the coolest stuff I've done is pretty spoiler-heavy and isn't polish because I started to prototype a lot of stuff because making shitty art and doing gameplay stuff makes progress go a lot faster than usual.

One awesome thing I want to share right now is this:
I'm porting a lot of code to Lua. This goes quite well because it makes things faster (Calling Lua from C++ is expensive! More about this later), it make my code easier to modify and expand and it makes me write less code. I feel like I'm changing my philosophy about Lua scripting. :D
For example, I rewrote entity state machine in Lua yesterday. -387 lines of C++. +95 lines of Lua. :D
Once I finish some of the stuff I've already started, I'll share a lot of details and hopefully it will inspire other devs and some will help me improve my design.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

totoo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #523 on: February 26, 2016, 03:18:01 pm »
great!
as you're becoming a Lua pro, I'd like to ask you something. as I said previously I'm currently implementing Lua Scripting, what I made till now is being able to build an entity template with its components from the lua script, that works great. but what I want to do now is calling C++ functions from Lua. I read a lot about registering functions, I've made it work (in both senses) but, there's something I'm thinking about.
in every Lua function found in any script, we must be able to do everything that is possible (get the current animation frame, get the current speed, get the health... everything) so lots of functions have to be registered. But the thing is, everytime we open a new script file, everything about the previous one is deleted, including the registered functions.
Is there any way not to need to register every function (registered with lua_pushcfunction() and lua_setglobal()) each time I open a new script file ? (I'm not using LuaBridge or anything else and I'd like not to for the moment)

thanks.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #524 on: February 26, 2016, 09:52:50 pm »
You should just use the same Lua state for everything. This way you register all the functions once and then load as many script files as you want. Don't forget to check out this article: https://eliasdaler.wordpress.com/2016/01/07/using-lua-with-c-in-practice-part4/

Btw, feel free to ask me any questions about all the programming stuff by sending me emails: eliasdaler@yandex.ru or posting questions on my blog.
This is a dev log about the game in the first place, so I don't want it to be filled with questions which have no relation to the game or it's engine. People interested in the game would find it pretty hard to navigate in the thread.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

 

anything