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

Started by
4 comments, last by RabblePants 11 years, 1 month ago

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.

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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

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?

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

This topic is closed to new replies.

Advertisement