Jump to content
  • Advertisement
Sign in to follow this  
tashaklikedi

visual c++ version runs differently than the exe in explorer!

This topic is 1922 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I have a strange issue ( noob programmer here )

Some of my game's collisions do not work when I click on the exe that is located in the "release" folder from windows explorer, but they work when I do "build and compile" from visual c++. I made sure I compiled in release mode, and the data folder is copy paste in both folders. 

I really don't understand. 

Share this post


Link to post
Share on other sites
Advertisement

That is because the working directory is different when you run from the debugger (it goes to the path of the solution).

You have 2 options:

1: Change the debugger settings to set the working directory to be the same as the executable‘s directory and then move all of your resources respectively.

2: Force the working directory for your executable to be that of the executable’s at run-time via SetCurrentDirectory() and then move all of your resources respectively.

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites

I tried 1- and it didn't work.

the weird thing is, there is a defaults.sav file which holds all the default settings, which includes an entity which is an electric wire, which is supposed to be a solid body. It loads its sprite as it should, but it does not load its collisions... from the same file

Share this post


Link to post
Share on other sites

I found the problem: there is a bitwise flag that does not work in the actual exe:

 

it goes like: 

 

if(CEntityManager::currentMapEntities->flags & ENTITY_GAIA) 

 

this condition is always negative in the original exe, but it works in debug mode. Why could this happen?

Share this post


Link to post
Share on other sites

If the problem is related to differences between release mode and debug mode, it is often related to uninitialized variables.

Check that it is initialized properly in all modes.

 

 

L. Spiro

Share this post


Link to post
Share on other sites

Debug builds automatically initialize (or zero out) your variables for you, while Release builds retain whatever garbage value is presently set at that location in memory your variables refer to.

 

Whenever you create a new map entity object, set flags = 0 in the constructor.  That should do it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!