Journey To Mars (Game)

Pages: 12
Line 148 in OP's main.cpp is copying the sprite along with the texture for every asteroid at every iteration of the game loop. Tell me that isn't unnecessarily impacting the games performance because I can prove otherwise by simply commenting it out and looking at Process Explorer.

I'll be the first to admit that I suck at these "find the difference between the pictures" games but there is no noticeable difference between the images to me.. EDIT: Engine booster, got it.

The new and delete comment was just a "good practices" suggestion I guess it was more geared toward future projects since it doesn't have a huge impact in this case.

Again, these were all extremely minor things that I wanted to point out. I've already said that the OP did a great job with this game and I stand by that.
Last edited on
Line 148 in OP's main.cpp is copying the sprite along with the texture for every asteroid at every iteration of the game loop.

No, it isn't. Sprites don't own or contain textures; internally they hold a pointer to a texture.
This particular piece of code is executed at most one time for one sprite per iteration of the game loop.


Tell me that isn't unnecessarily impacting the games performance because I can prove otherwise by simply commenting it out and looking at Process Explorer.

It isn't. Process Explorer is a notoriously bad tool for profiling.
Process Explorer takes some flak because it is relatively resource intensive. The data it gives you back is as good as you can expect without opening each process in a debugger. Even if it's not copying the texture each time that line is having a notable and unnecessary impact on the processes performance.
@ Computergeek01: Hey, I'm sorry for my non-commented code. I should have done that. In case you haven't figured the spriteC variable, it is used for animating the spaceship. It stores the x-coordinate of the beginning of a ship image in the ship.PNG file and changes every iteration of the game loop. You can see where it is used if you check the part of the code where the ship is being animated. Also there are differences between each ship image in the ship.PNG file and that's why the ship animates :3. Thanks for your nice comment and I'll try to use the new and delete methods in future projects :).
Last edited on
First of all: This is a great game! Its rather better than my first graphics project...

Anyway, just 2 little things that annoyed me with the asteroids:
'
Can you make them start off the top of the screen? This means that rather than 'appearing' in the screen they slide in and give a nicer effect.

The other thing is just a small bug, in that the asteroids sometimes start off the edge of the screen, so you can see them but you can't shoot them.

Apart from that, good work!
Stormboy - just a hint from me - since C++11 you have std::to_string function
http://en.cppreference.com/w/cpp/string/basic_string/to_string
It's easy to use and does the job.

Cheers!
@ NT3: Thanks! What do you mean by 'slide in' from the top? Doesn't it already come in from the top? :/ Oh and I am gonna fix that asteroids appearing out of screen bounds bug sometime this Thursday.

@ MatthewRock: Unfortunately MinGW (4.7.2) doesn't let me use it. It gives something like symbol not found error. I tried the C++ 11 switch during compiling but still the same. :C
Last edited on
What I mean is this: (its not very much):

If you look at the asteroids as they appear, they just appear in the very top row of the screen. What this means is it feels like it very quickly arrived there, and then goes at a more reasonable pace to the end. If the asteroids were to "appear" out the top of the screen, where they can't be seen, then the asteroids can "slide in", meaning that rather than just appearing in the top of the screen, bits will be exposed at a time through their natural movement towards the player.
@Stormboy - Perhaps some Googling can solve your problems? Example first hit on a search: stackoverflow.com/questions/16136142/c11-functionality-with-mingw

Anyway, good job on this. Hopefully you plan to make another more advanced game next?
@ NT3: Well, I've fixed the asteroids going out of the window bounds bug and also added that "slide in" effect (you can check it and see if it was what you wanted).

@ Mats: I've tried those but it still doesn't work :(. Thanks and I think I will probably work a bit more on this game before starting a new game project.
Topic archived. No new replies allowed.
Pages: 12