Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post Posted: January 3rd, 2018, 9:22 pm 
 

Joined: January 3rd, 2018, 7:44 pm
Posts: 7
Hello guys!

this is my first post here after half a year of watching chillies videos.

I made a Space Invaders clone and it's working pretty well i think. But when I added a background sprite and realigned my invader starting position I found a wired behaviour.

I do set the invader starting position inside game.h and forward it to my alien.h with a rect.
The rect however that arrives in alien is not updating every time I make adjustments to the rect in game.h or in game.cpp. I varied the generation and the point of generation of the rect various times but still the same problem. I do get it updated with a full recompile of the solution. Maybe thats how it is but I think it's more likely that I fucked up some compiler variable generating things or whatever.

Here is my Github: https://github.com/Neithari/Space-Invaders
I mostly use the dev branch but both are the same and up to date after I finish my work.

I hope you guys can help me :-)

Thanks in advance
so far
Neithari


Top 
 Profile  
Reply with quote  
 Post Posted: January 3rd, 2018, 9:41 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 509
Location: Idiot from northern Europe
in Alien.h you have this

const Rect<float> playSpace;

This should be a reference or a pointer

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 3rd, 2018, 10:43 pm 
 

Joined: January 3rd, 2018, 7:44 pm
Posts: 7
thats a good idea. I changed it but still the same behaviour. The variable does change only with rebuild solution and not with a normal compile.
Could it be me sending the variable before it's initialization?

Repo is updated to pointer now.

Edit: I was in release, behavior is normal in debug. So that is at least fixed, but why is it occuring?


Top 
 Profile  
Reply with quote  
 Post Posted: January 3rd, 2018, 10:56 pm 
 

Joined: November 30th, 2013, 7:40 pm
Posts: 645
Location: Merville, British Columbia Canada
Do you have DirectX SDK installed ?. I can't complie because of directx errors ->

Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'd3d10sdklayers.h': No such file or directory (compiling source file Alien.cpp) Engine c:\program files (x86)\windows kits\10\include\10.0.15063.0\um\d3d10.h 6773

must be because of i am using Windows 10

_________________
Curiosity killed the cat, satisfaction brought him back


Top 
 Profile  
Reply with quote  
 Post Posted: January 3rd, 2018, 11:03 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 509
Location: Idiot from northern Europe
in game.cpp constructor

pAlien( new Alien( gfx, alienShotMax, alienShotChance, &alienSpace ) )

move this to the body of the constructor.

or init alienSpace before in the constructor instead of the h file.

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 3rd, 2018, 11:09 pm 
User avatar

Joined: January 19th, 2017, 10:28 pm
Posts: 509
Location: Idiot from northern Europe
Sorry I haven't downloaded you game. Maybe I' not understanding your problem or something.
I don't see you ever changing alienSpace in gampe.cpp? it's also a const so you can't change it. So what do you mean it's not getting updated?

_________________
I just like to thumb my nose at millionaires.
If I was rolled I'd bust them heads up.


Top 
 Profile  
Reply with quote  
 Post Posted: January 4th, 2018, 12:57 am 
 

Joined: January 3rd, 2018, 7:44 pm
Posts: 7
Yumtard wrote:
I don't see you ever changing alienSpace in gampe.cpp? it's also a const so you can't change it. So what do you mean it's not getting updated?


When I am in release mode and I want to make chages to the alienSpace (now called playSpace) to realigne it for example I change a value and compile it but it is not changed in the game. Only if I rebuild everything or use Debug mode. And I don't know why this is happening. I get it aligned now so I don't have to tough that variable again but I am curious why it does behave like this.

MrGodin wrote:
Do you have DirectX SDK installed ?. I can't complie because of directx errors ->

Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'd3d10sdklayers.h': No such file or directory (compiling source file Alien.cpp) Engine c:\program files (x86)\windows kits\10\include\10.0.15063.0\um\d3d10.h 6773

must be because of i am using Windows 10


Not that I remember installing it or can find it right now. I am on win 10 too. Maybe because my solution is for VS 2017?
Edit: I checkt my VS install and the only thing I have directX related is
Graphics debugger and GPU profiler for DirectX under Games and Graphics
Found a solution in google. Do you have Windows 10 SDK installed? I have Windows 10 SDK (10.0.15063.0) for Desktop
Should I use 16299 or is that fine?


Last edited by Neithari on January 4th, 2018, 1:34 am, edited 2 times in total.

Top 
 Profile  
Reply with quote  
 Post Posted: January 4th, 2018, 1:19 am 
 

Joined: January 3rd, 2018, 7:44 pm
Posts: 7
Yumtard wrote:
in game.cpp constructor

pAlien( new Alien( gfx, alienShotMax, alienShotChance, &alienSpace ) )

move this to the body of the constructor.

or init alienSpace before in the constructor instead of the h file.


I tried moving it to the body before it was a pointer.
However now everything is working as expected. I init alienSpace/playSpace before in the constructor and now everything is working fine. Maybe I had it double init once in .h and once in .cpp I am not sure.

But anyway thank you for your help :-)


Top 
 Profile  
Reply with quote  
 Post Posted: January 4th, 2018, 2:13 pm 
 

Joined: February 12th, 2017, 1:50 pm
Posts: 18
Hi there!
If I understand your problem, I think it happend due to that you only changed the values in the h file. If you then just build the project, because noting changed in the cpp file, the compiler does not make a new obj and does not link in a new exe, so the changes do not get into the game. If you rebuild, then the "new" h file gets it into the game, and the values are updated. On the one hand you can rebuild the solution or init the variable in the cpp file, not the h file. You can verify what I said if you compile your project, run it in the debugger and step into the constructor of game. If you get to the lines where the construction happens in the h file, Visual Studio tells you that the h file is different form the last build... I had the same problem and found that out, maybe it helps you:) What I do not unterstand is that it works if you build in release mode, maybe because VS rebuilds the project with optimizations?!


Top 
 Profile  
Reply with quote  
 Post Posted: January 4th, 2018, 7:03 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2908
Location: Oklahoma, United States
Personally I think it's a bug that has been with VS for a while now. Sometimes I can make changes in headers and every .cpp file that includes that header is recompiled as it should. After a while of using VS or for some random reason, this behavior stops and I have to choose Rebuild instead of Build.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron