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

0 Members and 2 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 #450 on: December 28, 2015, 11:51:06 am »
Yeah, I think that dynamic_cast is not really necessary, but I think that assert which checks that cast succeeded will be nice. Are there any speed diferences between static_cast and dynamic_cast?
Yes, of course. As implied by the name, static_cast is resolved at compile time (the compiler computes the new start address of the class, which is more or less an addition at runtime), while dynamic_cast is a runtime operation that looks up the RTTI of the involved classes and checks their inheritance relation. But in any case, performance should not be the decisive factor here.
Good to know, thanks.

You can only use static_cast when you're sure about the conversion, and it's more limited (regarding cross-casts or casts through virtual inheritance).
After some thinking, I think that I need to do dynamic_cast, because I can't be sure about some stuff. Like if I have some property Property<T, Class> which is stored as IProperty<Class>* and then if I call
int i = meta.get<int>("someProperty")
I assume that T is int, so this needs an assert.

But the use of dynamic_cast should be questioned; often, a design with virtual functions can replace it.
Yeah, I'll try to think about improving my design, but right now it works pretty okay :D

And here's another screenshot of the animation tool. Almost done!
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re:creation - a top down action adventure about undeads
« Reply #451 on: December 28, 2015, 02:40:25 pm »
I posted while you were replying to Nexus, so you may have missed it:

Quote
Oh... if you use QVariant then it's a totally different thing. It does all the crappy things for you (type abstraction, checking, conversion, JSON serialization, ...). But I thought that you wanted to stay away from Qt specific stuff for this part of the code.

So now, may I ask why you still need this IProperty class with typed derived classes?
Laurent Gomila - SFML developer

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #452 on: December 28, 2015, 05:34:53 pm »
I posted while you were replying to Nexus, so you may have missed it:

Quote
Oh... if you use QVariant then it's a totally different thing. It does all the crappy things for you (type abstraction, checking, conversion, JSON serialization, ...). But I thought that you wanted to stay away from Qt specific stuff for this part of the code.

So now, may I ask why you still need this IProperty class with typed derived classes?
Yeah, I've missed it, sorry. :D
So, I need to cast from QVariant to T and back to be able to edit/display properties with QTreeView. It passes QVariant to setData in my model (which is inherited from QAbstractItemModel) and then I need to cast it to the correct type and set it to property. But... I think that the QVariant passed by QTreeView can be converted to QString and then to std::string, so I can basically make this get/set functions which convert std::string to needed value. (instead of making virtual functions which operate on QVariant)
So, when I type "56" it's treated as int, when I type "32, 32" it's treated as sf::Vector2i, etc.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #453 on: December 29, 2015, 10:54:31 pm »
So, implementing toString and getValueFromString methods totally solved the problem with having QVariant near animation classes. QTreeView uses QString for data manipulation, so when you input something, you get QVariant which contains QString with stuff you just wrote. This is converted to std::string and passed to virtual function in IProperty<Class> which then calls function in Property<T, Class> which then converts from std::string to T.

One interesting problem to solve was checking the input data. That's because if you do this:
auto i = std::stoi("bla-bla");
you get an exception. So, I created a quick function which checks if the string contains data which can be converted to following types: bool, int, float, string (he-he), etc.
And if you input wrong stuff, you get a nice error message instead of program crash. :)


I've also worked on the game itself (finally!). I connected meta stuff to main project and quickly thrown away old JSON loading code in favor of meta-deserialization! It worked pretty well. I'm now very glad that I did all that stuff instead of sticking to the easiest solution.
Now only animations use JSON but I'll start to convert most of the component data from Lua to JSON. What's interesting is that I can do it gradually (converting component data to JSON one by one), so I won't stop working on other stuff in meanwhile!

I've also came up with a bunch of cool ideas which will be easy to implement (mostly dialogues and cutscenes) and I won't spoil anything. Oh, and I'll soon start working on cutscene system, so expect some silly test cutscenes soon.

And by the way, I have question about reusing your own code in your projects. How do you do it?
Often I feel that I need to use LogManager, ResourceManager or Meta stuff in other quick/test projects and I end up just copying the code from main project so I don't break some stuff in it accidentally (by changing code shared among different projects). This approach is obviously not the right way to do stuff... So, what's your approach? Where do you store your code which you reuse in different projects? Do you just include them in all your projects or do you make shared libs?
« Last Edit: December 29, 2015, 11:11:03 pm by Elias Daler »
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re:creation - a top down action adventure about undeads
« Reply #454 on: December 30, 2015, 09:40:08 am »
Quote
So, I created a quick function which checks if the string contains data which can be converted to following types: bool, int, float, string (he-he), etc.
I still don't get why you're writing all that stuff when QVariant can already do it.
Laurent Gomila - SFML developer

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #455 on: December 30, 2015, 03:08:31 pm »
Quote
So, I created a quick function which checks if the string contains data which can be converted to following types: bool, int, float, string (he-he), etc.
I still don't get why you're writing all that stuff when QVariant can already do it.
That's because I have to handle types like sf::Int/FloatRect, sf::Vector2i/f, etc. (they're not stored inside QVariant! Only strings like "54, 20, 32, 32" are stored, so I need to manually convert them.)
 
And I also want to make meta stuff independent from Qt. If I use QVariant inside the Property class, I can't use this code inside my game which doesn't use Qt.
« Last Edit: December 30, 2015, 03:19:33 pm by Elias Daler »
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re:creation - a top down action adventure about undeads
« Reply #456 on: December 30, 2015, 06:03:33 pm »
Good points ;)
Laurent Gomila - SFML developer

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #457 on: December 30, 2015, 10:06:48 pm »
Nothing special, just repaired Lua callbacks and I think that this area looks neat with fog in it. :D (Though there are lots of tiles I' have to draw!)
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #458 on: December 31, 2015, 03:51:16 pm »
I've written a big blog post about the stuff I've done this year. Lots of gifs, pictures and info. If you've followed this thread, you may have already seen this stuff, but it's always too look back and remember how much the game improved. :D
Read it here

Thanks again, everyone. And Happy New Year!
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #459 on: January 03, 2016, 10:29:50 pm »
My short holiday rest is almost finished, I'll soon be resuming the development. ;D
I want to hear what you think of the progress I've made this year. (check the post above)
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Hapax

  • Hero Member
  • *****
  • Posts: 3349
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re:creation - a top down action adventure about undeads
« Reply #460 on: January 03, 2016, 11:44:24 pm »
I had a look through it and it's as I remember it: impressive!  :D
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #461 on: January 04, 2016, 09:17:15 am »
I had a look through it and it's as I remember it: impressive!  :D
Thank you! :D
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re:creation - a top down action adventure about undeads
« Reply #462 on: January 05, 2016, 09:23:22 am »
I'm back working on the game! Right now I'm working on moving entity data to JSON from Lua, but I've done it in such way that it can be loaded from Lua and JSON at the same time, so I won't need to provide Meta stuff for each component and the game will still work, so I'll work on the other stuff in parallel.
I'll also try to measure how faster the loading from JSON would be (I hope it would be faster, ha-ha!)
JSON will look like this:


And a strange thing happened. I randomly visited daily discussion thread on /r/gamedev and came upon this post.
My first reaction was this:"Huh, someone posted a screenshot of my game...? Cool. Oh wait..."

Compare for yourselves.

Right top corner part is my game with some color adjusted.

Generally I'm okay with people copying stuff from other people, but it should be subtle and you should add something to the original. I'm taking huge inspiration from Zelda, yeah, but it's not that obvious.
What will I do? Nothing. I've already called out the person on twitter and reddit and they said that they'll redo the graphics (while saying it's just a "coincidence").
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Hapax

  • Hero Member
  • *****
  • Posts: 3349
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re:creation - a top down action adventure about undeads
« Reply #463 on: January 05, 2016, 02:26:21 pm »
It's possible that it really is a co-incidence. Creative people that have never seen each others' work come up with the same thing all the time.

Still, I don't buy it.

It's a shame they didn't post their character design  ;D

However, their version doesn't stick to the pixelation very well. The flowers, for example, are obviously scaled down from wherever they stole them from  ::)

On top of everything, though, the best part is that his Reddit account has been deleted.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re:creation - a top down action adventure about undeads
« Reply #464 on: January 05, 2016, 02:51:28 pm »
For me there is too much similarity to call that coincidence. Everything except for the lamps looks almost identical.

Quote
Actually, the project is inspired by A Link to the Past and Dark Souls. Thus the Zelda vibe combined with the darker and gloomier atmosphere.
Sure... I was really hoping to see one of "his" main gameplay mechanics. Let's make an elaborated guess: Taking over dead enemies/npcs to get their abilities?

Well, like hapax said his account is deleted, so we most probably won't see anything from him anytime soon.

 

anything