Getting an .atlas file into the game
by Ron Hiler · in Torque Game Engine Advanced · 01/03/2009 (6:28 pm) · 9 replies
Aye, I'm having the worst time just getting my terrain to work :)
Alright, I created a new project using SetupNewProject.exe
This project lives at D:/MyProject. I tested this out and got the expected starter game. Good.
I also made a .atlas file using L3DT, called Final1.atlas. I made this using the AtlasDemo project executable, but copied the file over to D:/MyProject/MyProject/game/scriptsAndAssets/data/terrains.
So far so good.
Then I modified simple.mis in the missions folder, removing the MegaTerrain simgroup (and its 4 terrainblock children), replacing it with my atlas datablock (as a child of SimGroup(MissionGroup))
new AtlasInstance(NewTerrain) {
position = "-151.417 7.48933 80";
rotation = "1 0 0 0";
scale = "1 1 1";
detailTex = "~/data/terrains/details/detail1";
atlasFile = "~/data/terrains/Final1.atlas";
};
Started up the exe and got no terrain. Perusing my log file, this is what I see:
*** LOADING MISSION: scriptsAndAssets/data/missions/simple.mis
*** Stage 1 load
*** Stage 2 load
scriptsAndAssets/data/missions/simple.mis (0): Unable to instantiate non-conobject class AtlasInstance.
*** Mission loaded
Okay, so how then do I get atlas working? I've seen mention about flags that have to be set? Where are these flags and to what am I supposed to set them?
And while we are here, where does detail1 come from? There was no detail1 created by the L3DT program (though I do note that there is a detail1.png in the terrains/details folder, but I think that came from SetupNewProject.exe, because I didn't put it there).
Thanks for any advice. Trying to get a terrain working has seemed like pulling teeth, hehe.
Alright, I created a new project using SetupNewProject.exe
This project lives at D:/MyProject. I tested this out and got the expected starter game. Good.
I also made a .atlas file using L3DT, called Final1.atlas. I made this using the AtlasDemo project executable, but copied the file over to D:/MyProject/MyProject/game/scriptsAndAssets/data/terrains.
So far so good.
Then I modified simple.mis in the missions folder, removing the MegaTerrain simgroup (and its 4 terrainblock children), replacing it with my atlas datablock (as a child of SimGroup(MissionGroup))
new AtlasInstance(NewTerrain) {
position = "-151.417 7.48933 80";
rotation = "1 0 0 0";
scale = "1 1 1";
detailTex = "~/data/terrains/details/detail1";
atlasFile = "~/data/terrains/Final1.atlas";
};
Started up the exe and got no terrain. Perusing my log file, this is what I see:
*** LOADING MISSION: scriptsAndAssets/data/missions/simple.mis
*** Stage 1 load
*** Stage 2 load
scriptsAndAssets/data/missions/simple.mis (0): Unable to instantiate non-conobject class AtlasInstance.
*** Mission loaded
Okay, so how then do I get atlas working? I've seen mention about flags that have to be set? Where are these flags and to what am I supposed to set them?
And while we are here, where does detail1 come from? There was no detail1 created by the L3DT program (though I do note that there is a detail1.png in the terrains/details folder, but I think that came from SetupNewProject.exe, because I didn't put it there).
Thanks for any advice. Trying to get a terrain working has seemed like pulling teeth, hehe.
About the author
#2
Is there some better way of doing this that I'm not seeing? Or do I just start typing them in manually?
01/03/2009 (7:53 pm)
LOL, you mean I have to break open the vcproj files, insert file definitions for something close to 100 files that are living within 4 subdirectories without making a single typo, and do tihs across three different files. This must be some new and exciting definition of "easy enough fix" that I was previously unaware of :)Is there some better way of doing this that I'm not seeing? Or do I just start typing them in manually?
#3
01/03/2009 (7:56 pm)
It seems that way yeah. You could just copy that file(s) from one of the other projects like AtlasDemo or Stronghold and just rename where it says "AtlasDemo" or whatever, to your projects name.
#4
You could also make the 4-5 folders that atlas uses, and drag and drop the files over, which shouldn't take more than 5 minutes.
01/03/2009 (11:10 pm)
There is a tool to automatically build projects, and I think it is included in the 1.8 release. That's what is used internally to generate all the project files for the Torque releases, and getting it working for you would be a lot less pain than doing it by hand.You could also make the 4-5 folders that atlas uses, and drag and drop the files over, which shouldn't take more than 5 minutes.
#5
01/04/2009 (7:06 am)
There's a file "config/project.conf" in your project directory and a line "includeModule( 'atlas' );' that is commented out. Just uncomment that line and run "generateProjects.bat" in your project directory and all is fine.
#6
I have to say, even though this has been a giant pain in the rear, at least I'm getting a good overview of the files in a project and what they do. Good information to have for a newbie.
So here is what happened, just for reference. I uncommented the atlas line in my Project/config/project.conf file as per Rene's advice (I compared it against the same file in the AtlasDemo project, and it looked identical other than the SolutionConfig name, so that seemed right), then ran generateProjects.bat. Unfortunately, that didn't work. My project is not a subdirectory of the Torque engine, it lives in it's own place on the D drive, and what I got was a console with a complaint that the "system cannot find the path specified", so I must have something out of whack still. I think that somewhere there is a non-relative directory, or it is assuming your project is within the Torque directory, which mine is not. I hunted for where this might be coming from for a bit, but since the console was not specific, I couldn't figure it out. So that didn't work.
So instead I went to the Template directory in the Torque area, and made the same change. This time generateProjects.bat worked just fine. I popped open the corresponding Template.vcproj, and there the atlas files were! Success! I then deleted my project directory and reran SetupNewProject.exe. Then, just to be sure, I popped back open the MyProject.vcproj file and checked that the atlas files were there. They were. Good.
So I made the changes to simple.mis again, taking out the old megaterrain block and putting in my atlas terrain block. Sadly, when I ran the mission, no terrain. Opening up the log again, I found I had the same error :(
I'm not really sure why that didn't work. I modified the template and ran generateProjects.bat on it, so the template project executable should be Atlas compatable at that point, and running SetupNewProject.exe should just copy over that executable and rename it. But for whatever reason, it still won't initialize.
So I just said to heck with it and copied over the executable from the AtlasDemo project into my own project and renamed it. That worked. I have my terrain in game now.
This is a kudge as far as I'm concerned. I don't like things I don't understand, and I would like to know why I still can't get an Atlas compatable executable generated, so if anyone has further thoughts, I would be interested. Even though I have it working, it's a less than satisfactory solution :)
And if I haven't already said it, thanks for the help you've given already. I know it's rough holding a newbie's hand when they are struggling through their first baby steps, and I appreciate the time you've taken to help me out.
Ron
01/04/2009 (8:44 am)
Thanks guys. That is a lot less painful :)I have to say, even though this has been a giant pain in the rear, at least I'm getting a good overview of the files in a project and what they do. Good information to have for a newbie.
So here is what happened, just for reference. I uncommented the atlas line in my Project/config/project.conf file as per Rene's advice (I compared it against the same file in the AtlasDemo project, and it looked identical other than the SolutionConfig name, so that seemed right), then ran generateProjects.bat. Unfortunately, that didn't work. My project is not a subdirectory of the Torque engine, it lives in it's own place on the D drive, and what I got was a console with a complaint that the "system cannot find the path specified", so I must have something out of whack still. I think that somewhere there is a non-relative directory, or it is assuming your project is within the Torque directory, which mine is not. I hunted for where this might be coming from for a bit, but since the console was not specific, I couldn't figure it out. So that didn't work.
So instead I went to the Template directory in the Torque area, and made the same change. This time generateProjects.bat worked just fine. I popped open the corresponding Template.vcproj, and there the atlas files were! Success! I then deleted my project directory and reran SetupNewProject.exe. Then, just to be sure, I popped back open the MyProject.vcproj file and checked that the atlas files were there. They were. Good.
So I made the changes to simple.mis again, taking out the old megaterrain block and putting in my atlas terrain block. Sadly, when I ran the mission, no terrain. Opening up the log again, I found I had the same error :(
I'm not really sure why that didn't work. I modified the template and ran generateProjects.bat on it, so the template project executable should be Atlas compatable at that point, and running SetupNewProject.exe should just copy over that executable and rename it. But for whatever reason, it still won't initialize.
So I just said to heck with it and copied over the executable from the AtlasDemo project into my own project and renamed it. That worked. I have my terrain in game now.
This is a kudge as far as I'm concerned. I don't like things I don't understand, and I would like to know why I still can't get an Atlas compatable executable generated, so if anyone has further thoughts, I would be interested. Even though I have it working, it's a less than satisfactory solution :)
And if I haven't already said it, thanks for the help you've given already. I know it's rough holding a newbie's hand when they are struggling through their first baby steps, and I appreciate the time you've taken to help me out.
Ron
#7
All the setup program is doing is copying the files and changing info the match your new name, not recompiling the exes.
Edited: To remove carpal tunnel syndrome typos:)
01/04/2009 (9:16 am)
The executable in the Template directory was created without the Atlas Terrain in it. Recompile the Template project, then when you create a new project the correct executable should be there. If I am understanding your problem was the same I ran into. You need to set the Template directory up, compile it and make sure it runs like you want, then delete the DSOs, ect. Then run setupnewproject to create the new "copy" of the Template Directory.All the setup program is doing is copying the files and changing info the match your new name, not recompiling the exes.
Edited: To remove carpal tunnel syndrome typos:)
#8
Ah, gotcha. There was the step I missed. I thought that the generateProjects.bat would actually recompile the executable, but I see that looking at the date/time stamp, that is not the case. No wonder it didn't work. I'm going to try that now and see what happens.
[edit] Yep, recompiling the Template executable did the trick! I ran SetupNewProject.exe, plugged in my atlas block, and there it was. Thanks again, guys. I'm happy now.
01/04/2009 (10:08 am)
Quote:Recompile the Template project, then when you create a new project the correct executable should be there
Ah, gotcha. There was the step I missed. I thought that the generateProjects.bat would actually recompile the executable, but I see that looking at the date/time stamp, that is not the case. No wonder it didn't work. I'm going to try that now and see what happens.
[edit] Yep, recompiling the Template executable did the trick! I ran SetupNewProject.exe, plugged in my atlas block, and there it was. Thanks again, guys. I'm happy now.
#9
Glad everything's working for you now, Ron.
01/04/2009 (12:28 pm)
I should have mentioned that the project builder invoked by generateProjects.bat only re-generates the various projects files for the IDEs supported by TGEA.Glad everything's working for you now, Ron.
Torque Owner Adam Beer
Ignition Games Inc.
www.garagegames.com/mg/forums/result.thread.php?qt=82081