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

Author Topic: SFML Game Development -- A book on SFML  (Read 285256 times)

0 Members and 3 Guests are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: SFML Game Development -- A book on SFML
« Reply #45 on: July 01, 2013, 07:47:39 pm »
Just bought it and I'm reading through it now, it looks very promising, also, thank you for not being a complete bastard and putting DRM all over the .pdf file so I can store it and keep it offline. Too often I buy something digital only to discover if the internet goes down I can't even use it properly.

More developers just need to say no to DRM that doesn't even work.

Edit: The best thing about this book is on one of the very first sections it goes into a lot of detail about a problem I posted on these boards which is really nice :D

Ah that, we have no control over. That's the publisher that needs cudos for not being dicks then ;)
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Lethn

  • Full Member
  • ***
  • Posts: 133
    • View Profile
Re: SFML Game Development -- A book on SFML
« Reply #46 on: July 01, 2013, 08:29:45 pm »
lol! If it's the publisher indeed! Normally they're the ones responsible for DRM at all.
« Last Edit: July 01, 2013, 10:02:55 pm by Lethn »

Klaim

  • Full Member
  • ***
  • Posts: 137
    • View Profile
Re: SFML Game Development -- A book on SFML
« Reply #47 on: July 01, 2013, 10:56:10 pm »
Congrats for the book! Looks like I'll be able to get it from the publisher for review. If not I'll buy it anyway! :D

Montreal

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: SFML Game Development -- A book on SFML
« Reply #48 on: July 03, 2013, 07:23:33 am »
just bought the ebook version! Hoping to learn alot. Thanks

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: SFML Game Development -- A book on SFML
« Reply #49 on: July 03, 2013, 01:58:41 pm »
Okay, there are huge changes in SceneNode (about Categories and update that takes CommandQueue, mainly) between chapters 6 and 7 that you do not speak about.
It took me some time to figure out why there was 6 bullets shot instead of one, that's because the Layer and Categories attribution has changed in World class.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Game Development -- A book on SFML
« Reply #50 on: July 03, 2013, 02:48:27 pm »
Thanks for the feedback! Of course, we cannot address every change in the code, since it's just too much. But if we missed something important, we would like to know :)

Concerning the signature that changes from
void SceneNode::update(sf::Time dt)
to
void SceneNode::update(sf::Time dt, CommandQueue& commands)

The signature is extended because commands are incorporated into game logic. In Chapter 4, commands were introduced, but only used for input handling. At the end, we mention that the command system can also be used for other things like network input or in-game events. But you're right, we should probably have mentioned it again (and more clearly) in Chapter 7.


There are never 6 bullets shot at once, but at most 3 (namely when the player collects the pickup twice). This is explained:
Quote from: page 172
You may notice that the player's Eagle plane shoots two bullets at once, which is the result of a previously collected fire spread pickup.
« Last Edit: July 03, 2013, 02:50:21 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: SFML Game Development -- A book on SFML
« Reply #51 on: July 03, 2013, 03:42:04 pm »
There are never 6 bullets shot at once, but at most 3 (namely when the player collects the pickup twice). This is explained:
Quote from: page 172
You may notice that the player's Eagle plane shoots two bullets at once, which is the result of a previously collected fire spread pickup.

No, you misunderstood me (or I wasn't clear enough) :

The fact that you added that code into World::buildScene() [without telling the reader] :

Category::Type category = (i == Air) ? Category::SceneAirLayer : Category::None;

Changes the behavior for bullet shot. In fact it solves a problem. Indeed, before that line was added every SceneNode had a category Category::Scene. That is the category for the Projectile firing Command too.
But : or you didn't mention that change in the book or I totally missed it, so every SceneNode still has the Category::Scene category in reader code (SceneNodes that have not overloaded the getCategory() method, of course).
The result is that the bullet firing event is "catched" by 5 or 6 SceneNodes that are in Scene category. Each of them will action the command, giving a different "parent" node to the bullet.


Concerning the signature change for update() method, you didn't mention it in the book but it was clear (for me, at least). Perhaps a fast mention can help some people, dunno.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Game Development -- A book on SFML
« Reply #52 on: July 03, 2013, 05:39:21 pm »
I see this might be a bit confusing. To clarify:

  • The layer nodes that we need to differentiate (for game logics) have their own category, here SceneAirLayer.
  • Those that never receive any commands have category None.
  • Generic scene nodes which aren't explicitly assigned a category have category Scene.
The bullet firing event is addressed to Category::SceneAirLayer, which is held by only one scene node in the whole graph. Therefore, it is only attached to a single node, not 6.

Don't worry too much about None and Scene, they are not important. It is good if you understand the idea behind categories, and see the differences between the gameplay-related categories, such as EnemyAircraft ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: SFML Game Development -- A book on SFML
« Reply #53 on: July 04, 2013, 01:35:44 am »
Ok, so next step is to add "Let There Be Light" (and then Box2d) with the system. I'll do it, I'll do it ...!

Darragh

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: SFML Game Development -- A book on SFML
« Reply #54 on: July 04, 2013, 04:18:45 pm »
Does anyone know what licence the source code in this book was released under? I'd like to push my implementation of the game to a public repository as I read the book. Don't want to violate copyright. Thanks :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Game Development -- A book on SFML
« Reply #55 on: July 04, 2013, 04:44:50 pm »
We already asked the publisher concerning the source code license, but we haven't received an answer yet. I'll write them again.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: SFML Game Development -- A book on SFML
« Reply #56 on: July 05, 2013, 01:32:26 am »
Page 77 in the book gives the code for your World constructor, but the very top line of it is omitted.  It's missing "World::World(sf::RenderWindow& window)"

ALSO the same page the line that sets mSpawnPosition is missing "  .y / 2.f " at the end of the line.

Printed:
, mSpawnPosition(
     mWorldView.getSize().x / 2.f,
     mWorldBounds.height - mWorldView.getSize()
Should be:
, mSpawnPosition(
     mWorldView.getSize().x / 2.f,
     mWorldBounds.height - mWorldView.getSize().y / 2.f
« Last Edit: July 05, 2013, 01:54:44 am by The Hatchet »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Game Development -- A book on SFML
« Reply #57 on: July 06, 2013, 11:47:10 am »
Ok, thanks. It looks like there is even more missing.

This specific code snippet was (wrongly) reformatted in the very last phase, thus we had to describe what's wrong and couldn't edit it ourselves anymore. Apparently, the description was not correctly interpreted.

The correct snippet is:
World::World(sf::RenderWindow& window)
: mWindow(window)
, mWorldView(window.getDefaultView())
, mWorldBounds(
    0.f,                               // left X position
    0.f,                               // top Y position
    mWorldView.getSize().x,            // width
    2000.f)                            // height
, mSpawnPosition(
    mWorldView.getSize().x / 2.f,                        // X
    mWorldBounds.height - mWorldView.getSize().y / 2.f)  // Y
, mScrollSpeed(-50.f)
, mPlayerAircraft(nullptr)
{
    loadTextures();
    buildScene();

    mWorldView.setCenter(mSpawnPosition);
}
« Last Edit: July 06, 2013, 12:05:45 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Luponius

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: SFML Game Development -- A book on SFML
« Reply #58 on: July 07, 2013, 01:47:29 pm »
I have purchased the SFML Game Development book from Amazon UK (as directed by packtpub) and I attempted to find some way of linking the purchase with my PacktPub account (freshly created).

This is of course in order to acquire access to the e-book, which I haven't had any luck in pulling off thus far.  The price for the print version however is equal to that on packtpub from amazon uk, and therefore I assume it will grant me the ebook version as well.

I'll keep you updated on how this turns out, unless someone has already found a solution to it, in which case I urge you to post it for my benefit and anyone else who might require it =]

jacob

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: SFML Game Development -- A book on SFML
« Reply #59 on: July 08, 2013, 04:31:22 am »
This is by far one of the more impressive books I have read on programming so congrats on that  :D. I honestly did not manage to understand the uses of some of C++11's new features until reading this.I really like how the chapters flow together so you can develop one project throughout the lessons.

 

anything