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

Author Topic: SFML Game Development by Example - 4th SFML book  (Read 183131 times)

0 Members and 3 Guests are viewing this topic.

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #195 on: January 30, 2017, 11:01:22 pm »
regarding the new book
...
Yeah, the book is actually available now! Regarding the code files, the additional map stuff was left in by me. Those were, more or less, just backups for me that I forgot to take out. They simply contain different versions of the game map that hold more entities and lights for stress testing during Chapter 10. Feel free to ditch them, as they're not essential.
I read the first two chapters then did a skim over the rest, it looks great. I'm wondering how I would go about incorporating this text into the server from the project in the final chapter of the last book. Can the shaders and lighting affects be handled solely on the client portion? I'm new to networked programming and just trying to learn everything I can.
I'm really glad it looks good to you at this point. Thanks so much for reading! This book only deals with client-side techniques, so you could easily take all of them and apply them to the client. Lights themselves, as they're part of the map, may need to be updated on the server side if you want to move them around. The approach taken in the first book assumes that the maps are both the same on the client and server sides, but you'd probably either want to only read in tiles on the client side, or just send everything to the client from the server to ensure continuity. When writing networking programs for anything beyond mere testing, client input should never be trusted.

Side note: Packt really messed up by uploading the archives of the code to GitHub, rather than the code files themselves. I have no idea why they did it like that, but it kind of misses the point of source-control if you ask me.
« Last Edit: January 30, 2017, 11:03:39 pm by OrderNexus »

Nightmare_82

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: SFML Game Development by Example - 4th SFML book
« Reply #196 on: January 31, 2017, 07:46:48 pm »
Hi,

I just wanted to say that your new book looks great! I preordered it a while ago and didn't have time to read everything yet but I looked at all chapters and it contains a lot of very cool/advanced topics and good explanations!

Thanks for making this book  :)

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #197 on: January 31, 2017, 08:48:10 pm »
Hi,

I just wanted to say that your new book looks great! I preordered it a while ago and didn't have time to read everything yet but I looked at all chapters and it contains a lot of very cool/advanced topics and good explanations!

Thanks for making this book  :)
Hello! Thank you for reading. I really appreciate it. Hope you enjoy the book! :)

Grundkurs

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #198 on: February 05, 2017, 12:32:54 pm »
i just ordered the book at packtpub, can't wait to read it.

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #199 on: February 06, 2017, 05:02:48 am »
i just ordered the book at packtpub, can't wait to read it.
Thanks for buying it! I really hope you enjoy it. :)

Xorlium

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #200 on: February 13, 2017, 02:50:48 pm »
I want to buy the new book (it's on sale!) , but I have a couple of questions first:
1. Is it multiplatform? Im on linux.
2. Is it required to have the first book?

Thanks.

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #201 on: February 13, 2017, 05:50:52 pm »
I want to buy the new book (it's on sale!) , but I have a couple of questions first:
1. Is it multiplatform? Im on linux.
2. Is it required to have the first book?

Thanks.
1) It should work with other platforms just fine, albeit with a little tweaking on your part if some concepts don't carry over. Nothing about the code screams certain platform dependence, but I've developed it on a Windows machine, so some things may be leaning slightly towards VS. Still, the tweaking should be minor, if any. Take it with a grain of salt and use it as a reference book, while making the necessary adjustments when needed, provided you know C++ rather well.

2) The first book isn't required at all. It uses the third RPG project from the first title, but covers the code-base fairly well so you can jump into it without looking at too much of the underlying code. It may be useful for you to have the first book just to understand the concepts, but if you do already, it's not necessary.

Xorlium

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #202 on: February 14, 2017, 02:36:54 pm »
Thanks. I bought it :) Looks good.

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #203 on: February 14, 2017, 06:12:55 pm »
Thanks. I bought it :) Looks good.
Thanks! I really appreciate your support. Hope you enjoy it! :)

Sidious78

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #204 on: March 01, 2017, 04:59:42 pm »
I´m working with both this book and the new book at the same time.

Any plans of making a thread for the new book?

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #205 on: March 03, 2017, 06:15:21 am »
I´m working with both this book and the new book at the same time.

Any plans of making a thread for the new book?
Yeah, I'll be making a thread soon. I haven't had much time lately to really maintain my online presence, but I'll at least get a thread started when I have more than a minute. In the meantime, if you have any questions or concerns, feel free to just shoot a PM my way and I'll do my best to help you out. Thanks for reading! :)

Bryan Pope

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #206 on: April 28, 2017, 01:20:05 am »
Good evening,

In the downloaded code, chapter 10, ECS/Core/System_Manager.h has an #include "../../Debug/DebugOverlay.h", but that directory/file does not exist in any of the downloaded code's chapters.

Maybe it was clobbered because Visual Studio uses the Debug directory when compiling?  I commented this line out and was able to successfully compile.

Cheers,

Bryan

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #207 on: April 28, 2017, 02:15:33 am »
Good evening,

In the downloaded code, chapter 10, ECS/Core/System_Manager.h has an #include "../../Debug/DebugOverlay.h", but that directory/file does not exist in any of the downloaded code's chapters.

Maybe it was clobbered because Visual Studio uses the Debug directory when compiling?  I commented this line out and was able to successfully compile.

Cheers,

Bryan
No, it was just an include directive that either somehow got left behind by me, or it was not the most recent code file used by Packt, as we have gone over a couple of revisions and they're not the best when it comes to using the most up-to-date code sent in by the author. Either way, it can safely be left out to execute the code. Thanks for bringing this to my attention though.

_Imperial_

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #208 on: May 03, 2017, 07:09:26 pm »
Hi, OrderNexus. I bought the Mastering SFML book. Big fan of your work. I want to dive deeper into openGL. Looks promising. Btw, I just thought you might like this small change on the codebase (that is, if you didn't do this yet in this specific part of the code). Anyways, on the StateManager.cpp file, consider using reverse_iterators, they are good for what you wanted to accomplish in the update and draw methods, but with less hastle.  8) Here is what I did. It has less lines of code and does the exact same thing and also uses the STL facilities "rbegin" and "rend". Thanks!!  ;)

void StateManager::update(const sf::Time& time) {
   if (statesContainer.empty()) { return; }
   if (statesContainer.back().second->isTranscendent() && statesContainer.size() > 1) {
      for (auto statesItr = statesContainer.rbegin(); statesItr != statesContainer.rend(); ++statesItr) {
         if (!statesItr->second->isTranscendent()) { break; }
      }
      for (auto statesItr = statesContainer.begin(); statesItr != statesContainer.end(); ++statesItr) {
         statesItr->second->update(time);
      }
   }
   else { statesContainer.back().second->update(time); }
}

void StateManager::draw() {
   if (statesContainer.empty()) { return; }
   if (statesContainer.back().second->isTransparent() && statesContainer.size() > 1) {
      for (auto statesItr = statesContainer.rbegin(); statesItr != statesContainer.rend(); ++statesItr) {
         if (!statesItr->second->isTransparent()) { break; }
      }
      for (auto statesItr = statesContainer.begin(); statesItr != statesContainer.end(); ++statesItr) {
         locator->window->getRenderWindow()->setView(statesItr->second->getView());
         statesItr->second->draw();
      }
   }
   else {
      locator->window->getRenderWindow()->setView(statesContainer.back().second->getView());
      statesContainer.back().second->getView();
   }
}

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #209 on: May 04, 2017, 06:10:29 am »
Hey thanks, _Imperial_! I appreciate your kind words and the input on the book(s). You are absolutely right, I should've used reverse iterators. The way your code is written though, every single state will be updated and drawn. The main point of having two loops in each method is first finding the state that is no longer supposed to be "transparent", and then tracing back from that point all the way till the end of the container to update and render the states that are supposed to be "on top of each other". In the code that you posted, that first loop in each method does absolutely nothing.

With that being said, you can definitely still use the reverse iterators. In retrospect, that's what I should have done. I guess I just wanted to outline the process I just explained more clearly. Not sure how well that worked, all things considered.

Either way, thank you so much for your support and the suggestion. Reverse iterators are useful. If I ever get to make editions to either one of the books, I will make sure to put that in. It's on my list! :)