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 278333 times)

0 Members and 2 Guests are viewing this topic.

dwarfman78

  • Full Member
  • ***
  • Posts: 228
  • I'm bietzsche, Nietzsche !
    • MSN Messenger - cd4c@hotmail.com
    • View Profile
    • Email
Re:creation - a top down action rpg about undeads
« Reply #90 on: May 21, 2015, 10:19:05 am »
Hi Elias, i am wondering as you're using lua scripts, do you intend to let the user modify them ? If not how are you going to package them ?
@dwarfman78
github.com/dwarfman78

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9909
    • View Profile
    • development blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #91 on: May 21, 2015, 11:28:58 am »
He's using Lua and as stated before, he won't really pack them, because yay modding! :D
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #92 on: May 21, 2015, 06:02:08 pm »
^ This. I've answered it here

For those who may have missed (damn it, my post was the last on the page!)

New dev log is here!

I've made lots of stuff and I want you to check it out. ;)
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #93 on: May 21, 2015, 06:07:26 pm »
I've just read your dev log and I honestly can't say enough good things about this. The callback system is brilliant and I think I'll try and put that sort of thing into the next game I make.

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #94 on: May 21, 2015, 06:56:27 pm »
I've just read your dev log and I honestly can't say enough good things about this. The callback system is brilliant and I think I'll try and put that sort of thing into the next game I make.
Thanks! You should definitely try. C# has that system already(events and delegates) and I needed to implement something similar in C++.
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

shadowmouse

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #95 on: May 21, 2015, 07:01:30 pm »
Did you use std::tr1::function for callbacks, or did you just let each class store references to all its observers, each of which would have a function that can be called (probably via inheritance)?

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re:creation - a top down action rpg about undeads
« Reply #96 on: May 21, 2015, 07:31:38 pm »
Did you use std::tr1::function for callbacks

You can use std::function without ::tr1 for a little while now :)

Quote
gui->registerCallback(&GUIPlayingState::onHpChange);
player->addObserver(gui);
 
 
void GUIPlayingState::onHpChange(int senderId, const std::shared_ptr& e) {
    auto event = std::dynamic_pointer_cast(e);
    int hp = event->hp;
    ... // do some stuff!
}

With that code, how do you do the link between you HpChangedEvent and the right callback to call (as your registerCallback() method doesn't take the type of event as parameter. And how do you register callbacks with different signatures ?


I don't like that way of doing so much, because everything is done at execution. Plus you have to tell your Subject class (in that case Player) when the Observer is destroyed.
I prefer compile time Event Systems, zagabar has a good one in his Featherkit lib using structs. Again I guess it's harder to bind such a system to Lua compared to a simple Observer pattern (which does the job well anyway).

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #97 on: May 21, 2015, 07:36:12 pm »
Did you use std::tr1::function for callbacks, or did you just let each class store references to all its observers, each of which would have a function that can be called (probably via inheritance)?
Yep, I use std::function (no need to write tr1 in C++11).
Basically, Observer has std::map<std::type_index,std::function> callbacks and onMessage function which just calls callbacks[type_index_of_event].
When Subject fires an event, it calls onMessage function of each observer.

With that code, how do you do the link between you HpChangedEvent and the right callback to call (as your registerCallback() method doesn't take the type of event as parameter. And how do you register callbacks with different signatures ?

I don't like that way of doing so much, because everything is done at execution. Plus you have to tell your Subject class (in that case Player) when the Observer is destroyed.
I prefer compile time Event Systems, zagabar has a good one in his Featherkit lib using structs. Again I guess it's harder to bind such a system to Lua compared to a simple Observer pattern (which does the job well anyway).
Oops, I should fix that. RegisterCallback takes event type as a template argument and maps a function to this type of events.
This should answer all your questions.

I'll check out compile time Event Systems. My system is just one of the first ones I've come up with. Maybe I'll find something more convenient and awesome. :)
« Last Edit: May 21, 2015, 07:38:43 pm by Elias Daler »
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re:creation - a top down action rpg about undeads
« Reply #98 on: May 21, 2015, 07:47:12 pm »
This should answer all your questions.

I'll check out compile time Event Systems. My system is just one of the first ones I've come up with. Maybe I'll find something more convenient and awesome. :)

Yes it does answer ! Maybe the template parameter has been considered as HTML, does happen sometimes on blogs.

The observer pattern way is fine, there's nothing wrong with what your doing. I just wanted to point out other way of achieving messaging, with different pro and cons.

Anyway your game isn't just amazing to see, the code looks nice even if we just have the right to see snapshots :)

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #99 on: May 21, 2015, 09:18:09 pm »
Yes it does answer ! Maybe the template parameter has been considered as HTML, does happen sometimes on blogs.

The observer pattern way is fine, there's nothing wrong with what your doing. I just wanted to point out other way of achieving messaging, with different pro and cons.

Anyway your game isn't just amazing to see, the code looks nice even if we just have the right to see snapshots :)

Nah, I probably just forgot to add it. ;)

I like to look at different approaches, so I appreciate when people tell me about different ways of achievening something I did.

And thanks for you kind words! I try to keep my code clean and nice and I'm really proud that people see it.
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #100 on: June 02, 2015, 01:14:33 pm »
So, I didn't have time to work on the game last week because I had to study a lot. I still have to study a lot (exams are coming...) but I now have more free time so I can slowly work on the game. I'm working on the dungeon level now. It's coming along nicely.
So, here's a new screenshot:

This witch (actually a powerful necromancer!) will help you a lot on your quest. How? I'll tell a bit later when I finish some animations. ;)
« Last Edit: June 08, 2015, 12:14:40 am by Elias Daler »
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #101 on: June 08, 2015, 12:14:16 am »
Still working on necromancer grandma. Drew a portrait. Still work in progress. :)


P.S. Also have some cool ideas for a level called Ghost Town. This was a town full of musicians but all its population is dead now and travels in ghost form. They can't return even become undeads... Why? I won't spoil it, you'll see for yourself later! :D
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

JackPS9

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re:creation - a top down action rpg about undeads
« Reply #102 on: June 08, 2015, 02:00:20 am »
Elias, please dont take this wrong only asking cause of your forum profile pic.
But is that necro grandma a family member?

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #103 on: June 08, 2015, 07:38:26 am »
Elias, please dont take this wrong only asking cause of your forum profile pic.
But is that necro grandma a family member?
Ha-ha, no. I just drew my profile pic as a portrait inside the game.
But thanks for the question, it's great. :D
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re:creation - a top down action rpg about undeads
« Reply #104 on: June 10, 2015, 12:54:35 am »
I've been working on a platform puzzle (sorry, some tiles are not finished yet!).

See this platform? When you step on the button, it moves in another direction. When you step off the button, it moves as it did before.


You can try to jump on the platform, but what's the point of it? You'll be returned back!


You have to use recreation to solve that thing. ;)
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

 

anything