Jump to content
  • Advertisement
Sign in to follow this  
CIJolly

Published project jams during level load

This topic is 3412 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

Hey everyone, after 7 weeks of coding, I've got my first complete game ready to publish. However, that process is somewhat hampered by the fact that it only runs on my own computer. The problem occurs when the game tries to load levels which are stored as .bin files. When I install it on another computer, the menus load, but when a level is loaded it hangs. The same error happens whether the level files are in the directory or not, and the error stops occuring when I have the game open a hard coded test level. Thus, I'm fairly certain that the ecternally stored levels are the cause, and that it's not finding them. I am using this code to find the current directory: string currentdirectory = System.IO.Directory.GetCurrentDirectory(); Then, to get the full path of the level to load string pathofleveltoload = currentdirectory + "\\" + leveltoload; This works fine when I run the project from the debug directory, but after I publish it it wont work on my own or anyone elses computer. Where should I be storing the .bin level files, and how can I tell the program where to load them from? As an aside, when I just copy and paste the entire debug folder into the target computer, the levels load with or without the directory specifying code above. However, none of the sounds play. How come all of the sprites load automatically, and it can find the levels, but not the sound effects? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Have you tried this?

try
{
LoadLevelFunc();
}
catch(Exception Error)
{
MessageBox.Show(Error.Message);
}

To check for any exceptions that might be causing the error?

I'd also suggest to use
pathofleveltoload = Path.Combine(currentdirectory, leveltoload)
instead of
pathofleveltoload = currentdirectory + "\\" + leveltoload;

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!