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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - OrderNexus

Pages: 1 ... 4 5 [6] 7
76
is the ebook on packtpub different from the one on playstore?
on packtpub it says 44.98€ for the ebook and 44.99 for printed + ebook?
google play store basically has it for half the price.
I don't think it is. Try switching the prices on packtpub to US dollars. For me, it currently states that the e-book is $39.99 and the print + ebook is $49.99. Either way, I highly doubt that any content would be stripped from the copy on playstore.

77
Is there a reason why when falling vertically past the maximum map height, the map will be recreated (tiles will be placed) except for the leftmost tiles?

I assume it has to do with the tile map variable within the Map class.

I'm sorry if the description did not make sense. I'll try to provide pictures when I can.

The player should die if they fall outside the boundaries of the map, and get respawned at the beginning shortly. The console will print out a message every time that happens. Assuming this check is taken out, the map being repeated would have to do with the way tile indexes are represented in the tile container.

78
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 10, 2016, 06:39:42 pm »
Read this: Fix Your Timestep!
I have. Like I said, the results depend heavily on the implementation. It's a good resource to reference though :)

79
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 10, 2016, 06:25:57 pm »
Then you misunderstood the concept, because it's the other way around. A fixed time step provides a consistent time frame for the simulation across any machine. If one machine has a weaker CPU the simulation will run the same, but the FPS might drop.
What I meant was that FPS is directly tied to the simulation in a case of a variable time-step. If it goes down, the simulation will be advanced just that much more in between the frames, which would produce consistent results across different hardware. Depending on your fixed time-step implementation and setup, you may get slightly different results on different machines (ex. 2 updates per frame, then 3, then 2 again), assuming the frame time is still being accumulated and used to determine how many updates should take place in case of lag. I've also seen games that do not accumulate the frame-time at all, in which case the simulation is entirely dependent on the hardware it's being executed on.

While the variable time-step may not be ideal for physics simulations, it can keep the results slightly more consistent. That's not to say it doesn't have problems of its own, of course.

80
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 10, 2016, 05:03:27 pm »
The first project (snake) uses a fixed timestep, unlike the last two that rely on a variable timestep. The first bouncing mushroom example actually wasn't capped or adjusted in any way, and was later used to underline the issue of different execution times between varying systems. It was then adjusted to use delta time in order to run at a constant speed near the end of Chapter 2, so if you noticed that behavior before, you were absolutely correct. :)
So, the platformer game and the RPG-styled game both run in variable timestep, correct? I ask because I'm currently trying to make a platformer game following your example. Could you explain your reason for using a variable timestep method for your platformer example over the other methods (fixed timestep, minimum timestep)?
Correct. The main reason behind using variable time-step is performance. Using a fixed time-step across multiple machines would produce different results. Variable time-step allows the simulation to remain the same, even if the application is running at a lower framerate.

81
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 08, 2016, 07:20:33 pm »
I'm done writing the code for chapter 5 but I have a problem with the "unordered_map", it says that the "emplace" and "find" methods does not exists and it redirect me to hashtable_policy.h at line 85 (noexcept(declval<const _Hash&>()(declval<const _Key&>()))>).

I searched a little bit on stackoverflow and it might be a problem with C++11, however I have enabled C++11 in build options. I'm using Codeblocks (16.01). Any idea ? (I also tried to run the original code with no success)
I believe this may be related to Code Blocks not knowing how to hash a particular data type, since it's the key in an unordered_map. VS doesn't require you to do this, but Code Blocks might. I know for sure this problem occurs when compiling code for linux using gcc. What you can do is provide a way for the map to hash custom data types as the third argument. You can do it by using this code:
struct CustomHash
{
    template <typename T>
    std::size_t operator()(T t) const
    {
        return static_cast<std::size_t>(t);
    }
};
You can stick this in a new header file. When defining data types that use unordered_map with custom keys, make sure you provide a third argument like so:
using StateFactory = std::unordered_map<StateType, std::function<BaseState*(void)>, CustomHash>;

Give it a try!
Thank you for the nice customer support  ;D I tried to add your piece of code but there is a problem with the loadBindings() function:
Code: [Select]
CustomHash.hpp|9|error: invalid static_cast from type 'std::basic_string<char>' to type 'std::size_t {aka unsigned int}'|
Do I have to use "std::make_tuple" for both "find" and "emplace" methods in order to add the "CustomHash" argument or I don't have to touch them ? The question is more related to C++ than SFML/Your book tho
std::string should be hashable by default, if I'm not mistaken, so you don't need to provide the third argument for the binding container. You only need to do that with non-fundamental data types, such as "enum class" or anything else you might use as the key. It's also fair to point out that the CustomHash posted above works only with types that can be statically cast to std::size_t (unsigned integer). The binding container's key is a string, so that would require a different approach. Hope this helps :)

82
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 08, 2016, 12:01:59 am »
EDIT 2: I managed to make it work by starting over again with a fresh C::B project and with modifying the line (added a macro at line 2999) in Basic_string.h again. I didn't try to go further at the moment (chapter 4 works perfectly now) but it should be fine  ;D

Hi,

First of, really nice book ! I'm a total beginner in game development but I'm enjoying it so far :)

However, I'm having trouble compiling with Codeblocks. Everything works fine till chapter 4 (EventManager) but then, I can't seem to make it work. I even tried to download and use the source code (from packt) but same issue.

I managed to solve one of the problem (which was related to the MinGW version, issue with the "stoi" function solved by a little "hack" in the basic_string.h file, took from an answer on stackoverflow), I managed to run the code from chapter 4 but the "Mouse left click + Left shift" didn't work at all despite being the original code (only the mouse left key code appeared when I debugged it with std::cout but not the LShift one)

So my guess is that it comes from C::B or the line I changed on the basic_string.h file (but then I can't compile at all if I reverse it).

I hope you will be able to help me, I really want to start the next project (The scroll platform one)  ;D

EDIT: I didn't mention it but I already read the first book (the one with the aircraft shooter game) and I was able to run it perfectly (with SFML 2.1 at the time, tho) on CodeBlocks
Hello! First of all, thank you so much for showing support and purchasing the book! I hope you enjoy it the rest of the way :)

The shift key problem you're experiencing is a result of tiny changes between SFML versions. The sf::Keyboard::Key enum values are different after version 2.1, so you have to edit the "keys.cfg" file, specifically the "Move 9:0 24:38" line, and change the number 38 to whatever numerical index the LShift key happens to fall under in 2.1.

Please let me know if you have any more problems on the way!

I'm done writing the code for chapter 5 but I have a problem with the "unordered_map", it says that the "emplace" and "find" methods does not exists and it redirect me to hashtable_policy.h at line 85 (noexcept(declval<const _Hash&>()(declval<const _Key&>()))>).

I searched a little bit on stackoverflow and it might be a problem with C++11, however I have enabled C++11 in build options. I'm using Codeblocks (16.01). Any idea ? (I also tried to run the original code with no success)
I believe this may be related to Code Blocks not knowing how to hash a particular data type, since it's the key in an unordered_map. VS doesn't require you to do this, but Code Blocks might. I know for sure this problem occurs when compiling code for linux using gcc. What you can do is provide a way for the map to hash custom data types as the third argument. You can do it by using this code:
struct CustomHash
{
    template <typename T>
    std::size_t operator()(T t) const
    {
        return static_cast<std::size_t>(t);
    }
};
You can stick this in a new header file. When defining data types that use unordered_map with custom keys, make sure you provide a third argument like so:
using StateFactory = std::unordered_map<StateType, std::function<BaseState*(void)>, CustomHash>;

Give it a try!

83
General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 04, 2016, 01:48:27 am »
EDIT 2: I managed to make it work by starting over again with a fresh C::B project and with modifying the line (added a macro at line 2999) in Basic_string.h again. I didn't try to go further at the moment (chapter 4 works perfectly now) but it should be fine  ;D

Hi,

First of, really nice book ! I'm a total beginner in game development but I'm enjoying it so far :)

However, I'm having trouble compiling with Codeblocks. Everything works fine till chapter 4 (EventManager) but then, I can't seem to make it work. I even tried to download and use the source code (from packt) but same issue.

I managed to solve one of the problem (which was related to the MinGW version, issue with the "stoi" function solved by a little "hack" in the basic_string.h file, took from an answer on stackoverflow), I managed to run the code from chapter 4 but the "Mouse left click + Left shift" didn't work at all despite being the original code (only the mouse left key code appeared when I debugged it with std::cout but not the LShift one)

So my guess is that it comes from C::B or the line I changed on the basic_string.h file (but then I can't compile at all if I reverse it).

I hope you will be able to help me, I really want to start the next project (The scroll platform one)  ;D

EDIT: I didn't mention it but I already read the first book (the one with the aircraft shooter game) and I was able to run it perfectly (with SFML 2.1 at the time, tho) on CodeBlocks
Hello! First of all, thank you so much for showing support and purchasing the book! I hope you enjoy it the rest of the way :)

The shift key problem you're experiencing is a result of tiny changes between SFML versions. The sf::Keyboard::Key enum values are different after version 2.1, so you have to edit the "keys.cfg" file, specifically the "Move 9:0 24:38" line, and change the number 38 to whatever numerical index the LShift key happens to fall under in 2.1.

Please let me know if you have any more problems on the way!

84
Didn't the first SFML book cover this in the last chapter? Either way the book looks great and interesting!

Yes.
Up until this point, I haven't actually read any of the previously published SFML books. Before the writing process began, I was told by my editor that the networking subject hasn't been tackled yet, and this would be the first time. I stand corrected. :)

85
Question: What would you say is the method you are using for frame rate? It seems like the game is running with variable time step, is this correct? If it is, I'm curious if a different method is used later in the book. It might just be my computer, but the bouncing mushroom seems to be moving quite variably.
The first project (snake) uses a fixed timestep, unlike the last two that rely on a variable timestep. The first bouncing mushroom example actually wasn't capped or adjusted in any way, and was later used to underline the issue of different execution times between varying systems. It was then adjusted to use delta time in order to run at a constant speed near the end of Chapter 2, so if you noticed that behavior before, you were absolutely correct. :)

86
That's really odd. I just tested it myself, and it seems to be working fine. Please feel free to send me your code through either the PM function on these forums, or directly to my email address: order.nexus.dev@gmail.com. I would be happy to help you out!

Edit: One thing you should check is the order in which data members of the classes are declared. Since they're allocated on the stack, the destruction of these objects will follow in the reverse order of declaration. Make sure to consult the code that came with the book, and if that doesn't work, please feel free to contact me! :)

Ahh! You beat me to it! I just figured it out and was about to post it! Hahah! You are correct, it was the order the members were created, such a simple mistake.

Thanks!
No problem! Thank you so much for reading, and I hope you enjoy the rest of the book! :)

87
Loving the book so far, however, I've hit a snag.

I'm at the beginning of Chapter 7 and just finished testing the Tile/Mapping classes. The background texture loads, but when I hit the close button or click the "exit" button on the main menu, I receive an exception. I believe the error is occurring because the Game object's deconstructor is called when the window closes, causing my SharedContext object to lose scope.

Thus, other objects that depend on the SharedContext for releasing resources cause an error. Also, the ResourceManager's deconstructor is being called first, so it purges all of the resources before the map can do so itself.

I hope someone will be able to assist me!
That's really odd. I just tested it myself, and it seems to be working fine. Please feel free to send me your code through either the PM function on these forums, or directly to my email address: order.nexus.dev@gmail.com. I would be happy to help you out!

Edit: One thing you should check is the order in which data members of the classes are declared. Since they're allocated on the stack, the destruction of these objects will follow in the reverse order of declaration. Make sure to consult the code that came with the book, and if that doesn't work, please feel free to contact me! :)
The e-book costs €43.54 while the print+ebook costs €44.99. That's strange. I would expect e-book to be significantly cheaper. This book has everything that I would like to learn (well, except a chapter about SFML android development). I am going to buy it, but it's not exactly cheap.
The e-book on packtpub.com is priced at €35.99, while the paperback version + e-book costs €44.99. I'm not sure where you saw that price for just the e-book alone, but it doesn't seem right.

88
For the GetWindow() method, you absolutely could use a reference. It actually makes more sense in most cases, assuming nullptr is a valid return value.
Not sure if you meant to say that differently, but nullptr is not a valid return value for a reference of a window.
Yes, you're right. Sorry, I was replying in a rush. It's fixed now. I did mean that pointers should be used, provided nullptr being returned is a possibility.

The "l_" prefix stands for local, meaning the argument is local to the function/method. There are better alternatives to using Hungarian notation though, so take that with a grain of salt.
Should a parameter know where it comes from?
Not sure which function/method it is local to. The one it's passed to or the one it's passed from?
I agree, it's not widely used and debatably unnecessary. It can be useful if the method/function has a similarly named local variable inside the body somewhere. This, as well as most of the design choices in the book are entirely optional and up to the reader to leave in.

89
Hey,

I bought your book a couple of days ago. Working on the Snake chapter atm. Nice to read :) I think using pointers etc. is okay ... I for myself try to avoid them and will exchange your pointers to smart pointers...but I have a question:

The Game class in chapter 2 -> Building the game class has the method
Window* GetWindow();
 

why using a pointer instead of this?:
const Window& GetWindow() const;
//EDIT: the const may be ignored, later on it will be stupid to make it return a const Window...
 


Btw.: I try to be more const correct than the book, but I don't see it as a flaw, since the code is much more readable while learning :) Nice work so far! I also prefer it over the first book so far!

Edit2:
What does the prefix l_ for function parameters stand for?! LValue?!
Snake::Render(sf::RenderWindow& l_window)
Hi! Thanks for purchasing and reading the book! I'm glad you like it so far. :)

For the GetWindow() method, you absolutely could use a reference. It actually makes more sense in most cases, unless nullptr is a valid return value, in which case using a pointer would be best. Regarding const correctness, you're absolutely right. That was actually my intention. Shoving everything into one publication just seemed like too much, not to mention it would cause formatting problems every once in a while.

The "l_" prefix stands for local, meaning the argument is local to the function/method. There are better alternatives to using Hungarian notation though, so take that with a grain of salt.

90
Who could say no to a 5 bucks eBook. ;)

I very quickly went a bit over the source code and it looks quite good, even though I don't agree with some of the design decisions.
I'm glad to hear it's acceptable. Regarding the design choices, I can already imagine what those would be for the most part. :) I hope that doesn't ruin the book for you, and you find something useful in it still. Thanks so much for purchasing it!

Pages: 1 ... 4 5 [6] 7
anything