-
|
|
Publishing Issues (xna 3.0)
|
Hello,
I am having problems with the publishing feature in xna 3.0. I have used it in the past and it has worked very well, however I and a team have created a game that is causing issues with this publishing feature xna provides. In our game once you hit the play button it will read from a .txt file and generate a 3d game level. This .txt file simply contains coordinates and an object type at the specific coordinates (eventually some other stuff later...). The issue that occurs is our game Crashes once the start game button is selected and it has to find these text files. It is very clear that xna does not recognize these files as required pieces of information, therefore ignores them all together. I have tried to manually place these text files in the published folder it creates, however with no luck it will never find these files.
In short: My team's game reads from text files created from another program. How can we use the publishing method to account for these specific text files?
Thanks for the help.
|
|
-
-
- (6313)
-
premium membership
-
Posts
2.974
|
Re: Publishing Issues (xna 3.0)
|
Two options:
1) Use a better way of finding the folder where your files are. Look in MSDN; there are tons of different ways to find information about where your files can be relative to your program. If you need help on this, then post the code you use to find the files now so we can fix it.
2) Use the content pipeline. Add the text file to your project, and then under "Properties" change the values to read "Copy to output directory" and "none" for the compile options. Then your files will be published along with the rest of your content.
"No programmer can pick up a TV remote without thinking what it would take to add a stun gun. [...] Their motto is 'if it ain't broke, it doesn't have enough features yet'" - Scott Adams, The Dilbert PrincipleThe signature that was too big for the 512 char limit
|
|
-
-
- (758)
-
premium membership
Team XNA
-
Posts
594
|
Re: Publishing Issues (xna 3.0)
|
It might help to change the publishing properties for your data files in this scenario. I'd suggest taking a look at the "Special Considerations for Game Data Files" section of the Distributing Your Finished Windows Game topic in the XNA Game Studio documentation to see if that option is helpful in your scenario.
Thanks!
|
|
-
|
|
Re: Publishing Issues (xna 3.0)
|
I still haven't been able to get this to work.
The way the program is set up, the text files are located in
...EscapeBall_402b\EscapeBall\bin\x86\Debug\Content "as Level1.txt or Level2.txt"
The functions used to located these files are:
public LevelGenerator()
{
ReadBlockList("Content/Level1.txt", 0);
ReadBlockList("Content/Level2.txt", 1);
}
void ReadBlockList(string path, int Zone)
{
using (StreamReader reader = new StreamReader(path))
{
while (!reader.EndOfStream)
{
Blocks tempBlock = new Blocks(new Vector3(), 0);
string assetLine = reader.ReadLine();
string[] assetInfo = assetLine.Split(',');
// The blocks vector position is read by these 3 lines
tempBlock.BlockCoordinates.X = float.Parse(assetInfo[0]);
tempBlock.BlockCoordinates.Y = float.Parse(assetInfo[1]);
tempBlock.BlockCoordinates.Z = float.Parse(assetInfo[2]);
tempBlock.blockHome = tempBlock.BlockCoordinates;
// The blocks model type is read here
tempBlock.BlockHandle = int.Parse(assetInfo[3]);
// The blocks collision type is read here
tempBlock.BlockCollision = int.Parse(assetInfo[4]);
// Finally the block is added to the list of blocks
EscapeMode.blocks[Zone].Add(tempBlock);
EscapeMode.blocks[Zone][EscapeMode.blocks[Zone].Count - 1].CreateBoundingBoxes();
}
reader.Close();
}
}
When it is published, the text files are no where to be found. Even when added to the project content and through the methods listed above.
|
|
-
-
- (758)
-
premium membership
Team XNA
-
Posts
594
|
Re: Publishing Issues (xna 3.0)
|
Do you see the level text files included in the Publish folder when you publish your game? If so, do you see them in the destination location on a machine that you've tried to deploy to?
The relative path that you're using to load the level text files might be causing issues here too. Could you try outputting the path to the level text file in your code before you try to load it and see if it matches the actual path the file is deployed to on your system. It might also help to construct fully qualified paths instead of using relative paths in this scenario. The Platformer Starter Kit does this - you can take a look at the LoadNextLevel() method in PlatformerGame.cs for an example of how that games loads level text files.
Thanks!
|
|
-
|
|
Re: Publishing Issues (xna 3.0)
|
Thanks Aaron for pointing out the platform demo. However after following what it uses I still am having the same issues. The game will run in debugging / start without debugging modes, but when it gets published it still does not like to read those files. They are created with the publish now... I will continue to try things on it. Are there are any options that I need to enable/disable?
|
|
-
|
|
Re: Publishing Issues (xna 3.0)
|
Im starting to think the error is something different. I removed the read file method and tested it (creates a black screen), published the game and tested it, it crashes still... It loads the game title screen, then when I hit Play it crashes.
If I use ISTool to create a published .exe for the game, it will work, however it doesn't install the necessary files to the computer. I'm not too attached to the privacy of this code, if anyone is willing to download it to help check it out? I hate asking that, but I cant seem to get any farther than where I started...
Thanks for the help,
James M.
|
|
-
-
- (758)
-
premium membership
Team XNA
-
Posts
594
|
Re: Publishing Issues (xna 3.0)
|
Can you add logging to your game so it will show you the full path it is trying to load your level text files from, and then compare the expected paths to the actual paths on your system after you publish and deploy your game to another system? I'm guessing that the paths don't match.
Also, if you can zip and post your project somewhere and reply here with a link, I can try to take a quick look and see if I can figure anything out as well.
Thanks!
|
|
-
|
|
Re: Publishing Issues (xna 3.0)
|
Thanks again for the help. The project can be found at: http://www.megafileupload.com/en/file/119810/EscapeBall-402b-zip.html
Inside includes a text document with the two methods that might mean anything to this situation. Also, there really isn't anything to "play" yet, it was a game but I've been reconstructing it to be a new game with a lot more features. I'm not sure how to write something to compare the required paths. I edited the method to match what was found in the Platformer Demo, however that still doesn't work in the published version.
But thanks again. My email can also be found in that text document if there is anything else you need.
|
|
-
-
- (758)
-
premium membership
Team XNA
-
Posts
594
|
Re: Publishing Issues (xna 3.0)
|
The game that you posted crashes when I try to click on Escape Mode both in the debugger and after publishing it. The LoadContent method in EscapeMode.cs is referring to Models\LargeSphere, but that model doesn't exist in your content project. I changed that code to refer to Models\Misc\Placeholder, re-built and re-published and it started working fine for me in the debugger and after publishing it. The code you have appears to load the level text files correctly when I run your game. Are you still able to reproduce an error after publishing while it tries to load the level text files after fixing the same Model\LargeSphere issue that I had to fix?
To debug this issue further, you can create a log file that lists the full paths to the files you're trying to load, or display a message box or something like that. You can also publish to the computer that you're developing on so that if it crashes, you can attach a debugger and get call stack information more easily.
Hopefully this helps.
Thanks!
|
|
-
|
|
Re: Publishing Issues (xna 3.0)
|
Oh My Lord...
Somewhere along the lines we lost the Large Sphere model. It was working in debug/build, but never wanted to work in publish. Publish works now. Thank you so much for your help. *Facepalmdeskdeskdesk
|
|
-
-
- (758)
-
premium membership
Team XNA
-
Posts
594
|
Re: Publishing Issues (xna 3.0)
|
That's great news - I'm glad to hear that things are working now! Maybe you had an old cached copy of that model in your debug output directory that was causing this scenario to work in your local debugging scenario but not in the publishing scenario?
Thanks!
|
|
-
|
|
Re: Publishing Issues (xna 3.0)
|
Yeah, there was that file in the debugging folder, but not in the content. I noticed this around 3 months ago and didnt think anything of it since the game worked... I am not really sure how to do any of the things you had said in your previous post, about creating a debug output to show loaded files and locations. I'm sure if I had something like that it would tell me instantly, "This file was not found" etc.
I am also pretty sure there was a second problem that I had resolved earlier, which was sort of confusing me. I had to do something and change the properties of the text files, which was the first problem. This second problem was something I really had no idea and was just thinking the first problem never got fixed. Really really bad luck hehe. Hopefully my job search is a little better now that I have a "working" game lol.
Thanks again for all your help
|
|
|