Page 1 of 2

Compiling RF2

Posted: Mon Mar 08, 2010 3:35 pm
by paradoxnj
First step is to get the code from the SourceForge Subversion Repository

-- Download an Subversion client. I recommend TortoiseSVN.

-- Create an empty directory where you want the code to go. I use C:\My Programs\RF2.

-- Open that folder and right click an empty area and select "SVN Checkout..."

-- Put the following URL in the "URL of repository" field:

https://realityfactory2.svn.sourceforge ... /trunk/RF2

-- Click OK

-- The code will be in a subfolder under the empty folder you created called RF2. In the RF2 folder, create a bin folder.

-- You'll need Visual Studio 2010 or Visual C++ 2010 Express to compile.

-- Download the Binary Dependencies for RF2

-- Unzip the binary dependencies into the RF2\bin folder.

-- Open Visual Studio 2010 or Visual Studio 2010 Express using the RF2 solution.

-- Choose your build type (Debug or Release)

-- Hit Build Solution

-- Please post any build errors you may encounter.

-- Run RF2_Debug.exe (Debug build) or RF2.exe (Release Build)

You can modify the main.lua and init.lua to change the startup behavior. Take a look at mainmenu.lua to see how to make a GUI. You can also have a look at testgui.lua for a more complex example of a GUI.

Re: Compiling RF2

Posted: Mon Mar 08, 2010 9:59 pm
by Allanon
Compiled the code without error. When running the first time I found that resources.cfg was missing. Not knowing what resources.cfg did I just copied the resources.cfg from Ogre3d. Then ogrecore.zip couldn't be found. I opened resources.cfg and found that it has all the paths for the resource files. I corrected the paths so they point to the correct location then ran again. This time the "Ogre Engine Rendering Settup" dialog poped up. I selected Direct3d9 and then hit "OK". Then I got a debug error. It seems it can't find ogrecore.zip but the file is in the packs folder and I tried setting the paths in the resources.cfg file a lot of different ways but each time this error occurs. Attached are the logs. I ran the debugger and it stopped at this function:

Code: Select all

void RFGraphics::registerResource(const char *group, const char *resname, const char *restype, bool recursive)
{
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Ogre::String(resname), Ogre::String(restype), Ogre::String(group), recursive);
}

And here is the auto variables:

Code: Select all

+		group	0x0172f75c "Bootstrap"	const char *
		recursive	false	bool
+		resname	0x0172f664 "./packs/OgreCore.zip"	const char *
+		restype	0x0172f99c "Zip"	const char *
+		this	0x016c6088 {m_bInitialized=false m_bQuit=false m_pRoot=0x014e0260 ...}	RF2::RFGraphics * const
In the RealityFactoryOgre.log file there is this line:

Code: Select all

14:45:16: OGRE EXCEPTION(7:InternalErrorException): ./packs/OgreCore.zip - error whilst opening archive: Unable to read zip file. in ZipArchive::checkZzipError at f:\codingextra\ogre\shoggoth_vc9\ogre\ogremain\src\ogrezip.cpp (line 259)
It seems to be looking for the OgreCore.zip file at "./packs/" instead of "./media/packs/" which is what I put in the resources.cfg file. Can you post your resources.cfg file so I can be sure it is correct?

Re: Compiling RF2

Posted: Tue Mar 09, 2010 1:58 am
by paradoxnj
More importantly...you compiled without error. Contents of resource.cfg

Code: Select all

# Resource locations to be added to the 'boostrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=./media/packs/OgreCore.zip

# Resource locations to be added to the default path
[General]
FileSystem=./media
FileSystem=./media/fonts
FileSystem=./media/materials/programs
FileSystem=./media/materials/scripts
FileSystem=./media/materials/textures
FileSystem=./media/models
FileSystem=./media/overlays
FileSystem=./media/particle
FileSystem=./media/gui
FileSystem=./media/DeferredShadingMedia
FileSystem=./media/PCZAppMedia
Zip=./media/packs/cubemap.zip
Zip=./media/packs/cubemapsJS.zip
Zip=./media/packs/dragon.zip
Zip=./media/packs/fresneldemo.zip
Zip=./media/packs/ogretestmap.zip
Zip=./media/packs/skybox.zip
Your directory structure should look like this:

Image

Re: Compiling RF2

Posted: Tue Mar 09, 2010 2:58 am
by Allanon
My resources.cfg file looks exactly like what you posted. Any ideas why it doesn't find OgreCore.zip? I copied the packs folder to the bin folder and it was then able to find OgreCore.zip and display the logo before crashing again. So apparently it is looking for ./packs/OgreCore.zip instead of ./media/packs/OgreCore.zip.

I'm now debugging trying to find out why it crashed after displaying the logo, will update with more information.

Re: Compiling RF2

Posted: Tue Mar 09, 2010 4:34 am
by paradoxnj
Check the main.nut file. I'll just give you mine.

Code: Select all


function onInitGame()
{
	setWindowTitle("My Test Game");
	showConfigDialog(true);
	
	runScript("./packages/test/actors.nut");
	print("onInitGame\n");
}

function onShutdown()
{
	print("onShutdown\n");
}

function quitGame(v)
{
	print("Quitting game\n");
	quit();
}

function onInitGraphics()
{
	print("onInitGraphics\n");

	RFGetGuiManager().loadScheme("TaharezLookSkin");
	RFGetGuiManager().loadScheme("TaharezLook");

	RFGetGuiManager().setDefaultFont("BlueHighway-12");
	RFGetGuiManager().setDefaultMouseCursor("TaharezLook", "MouseArrow");
}

function onInitInput()
{
	print("onInitInput\n");
	
	local input = RFGetInput();
	input.bind(input.EVENT_TYPE_KEYPRESS, KEY_ESCAPE, "quitGame");
}

function onInitWorld()
{
	print("onInitWorld\n");
	
	RFGetGuiManager().loadWindowLayout("Demo8.layout");
	RFGetGuiManager().setCurrentLayout("Demo8.layout");

	local wrl = RFGetWorld();
	wrl.setAmbientLight(0.5, 0.5, 0.5);
	wrl.setSkyBox(true, "Examples/SpaceSkyBox", 50.0);
	
	cam <- RFCamera("mainCamera");
	
	local vecTmp = Vector3(0.0, 99.0, 0.0);
	
	local pd = PlaneData();
	pd.Normal = Vector3(0.0, 1.0, 0.0);
	pd.Distance = 100.0;
	pd.Width = 1500;
	pd.Height = 1500;
	pd.NumXSegments = 20;
	pd.NumYSegments = 20;
	pd.GenerateNormals = true;
	pd.NumTexCoordSets = 2;
	pd.TileU = 60.0;
	pd.TileV = 60.0;

	local tp = RFPlane("TestPlane01", pd);
	tp.setMaterial("Examples/OffsetMapping/Specular");
	tp.setCastShadows(false);
	tp.setPosition(vecTmp);

	local light1 = RFLight("BlueLight");
	light1.setType(2);
	light1.setPosition(Vector3(-200.0, 150.0, -100.0));
	light1.setSpecularColor(ColourValue(1.0, 1.0, 1.0, 1.0));

	local dir = Vector3(200.0, -150.0, 100.0);
	Vector3Normalize(dir);

	light1.setDirection(dir);
	light1.setDiffuseColor(ColourValue(0.5, 0.5, 1.0, 1.0));
	light1.setCastShadows(true);

	local light2 = RFLight("GreenLight");
	light2.setType(2);
	light2.setPosition(Vector3(0.0, 150.0, -100.0));
	light2.setSpecularColor(ColourValue(1.0, 1.0, 1.0, 1.0));
	
	dir = Vector3(0.0, -150.0, 100.0);
	Vector3Normalize(dir);

	light2.setDirection(dir);
	light2.setDiffuseColor(ColourValue(0.5, 1.0, 0.5, 1.0));
	light2.setCastShadows(true);

	local rob = RFObject("Robot");
	//rob.setPosition(Vector3(0.0, 99.0, 0.0));
	rob.setScale(Vector3(0.25, 0.25, 0.25));
	rob.setComponentProperty("animation", "current_animation", "Idle");
}
Make sure you have the following files in the media\gui folder:

Code: Select all

Batang-26.font
batang.ttf
cegui8.layout
CEGUIConfig.xsd
CompositorDemo.layout
CompositorDemoCegui.config
CrowdDemo.layout
DejaVuSans-10.font
DejaVuSans.ttf
Demo7Windows.layout
Demo8.layout
Demo8.scheme
DragDropDemo.layout
DriveIcons.imageset
DriveIcons.png
facial.layout
FairChar-30.font
FairChar.imageset
FairChar.tga
Falagard.xsd
fkp-16.font
Font.xsd
FontDemo.layout
GPN-2000-001437.tga
GUILayout.xsd
GUIScheme.xsd
Imageset.xsd
InstancingDemo.layout
logo.png
OceanDemoCegui.config
OceanDemoLayout.xml
ogregui.layout
shadows.layout
TabControlDemo.layout
TabPage.layout
TabPage1.layout
TabPage2.layout
TaharezLook.imageset
TaharezLook.looknfeel
TaharezLook.scheme
TaharezLook.tga
TaharezLookSkin.scheme
TaharezLookWidgetAliases.scheme
TaharezLookWidgets.scheme
TextDemo.layout
TreeDemoTaharez.layout
Vanilla.imageset
Vanilla.looknfeel
vanilla.tga
VanillaConsole.layout
VanillaSkin.scheme
VanillaWindows.layout
WindowsLook.imageset
WindowsLook.looknfeel
WindowsLook.scheme
WindowsLook.tga
WindowsLookWidgets.scheme

Re: Compiling RF2

Posted: Tue Mar 09, 2010 6:28 am
by Allanon
I'm missing a lot of the files that should be in the ./media/gui folder, I have the ones that came with RFOgre but where would I get the others?

Re: Compiling RF2

Posted: Tue Mar 09, 2010 10:43 am
by QuestOfDreams
The most of the gui media should come with CEGUI.

Re: Compiling RF2

Posted: Tue Mar 09, 2010 3:13 pm
by paradoxnj
Yes. QoD is correct. It comes from the CEGUI installation. CEGUI 0.7.1 is a new implementation. I have to update the prepare.cmd to accommodate this change.

Re: Compiling RF2

Posted: Tue Mar 09, 2010 7:37 pm
by Allanon
Got it working! After adding the missing GUI files and adding the actor.nut file to bin/projects/test the program worked. It displayed an animated robot with a scroll bar on the left and two dialog boxes with a bunch of controls and panels. I was able to see the cursor and move all the controls and ESC exited the program.

I would suggest for the future you keep the assets for your test program up-to-date in the SourceForge so people can run the program right away after compiling. Some might get deterred if the program crashes.

Re: Compiling RF2

Posted: Wed Mar 10, 2010 2:21 am
by paradoxnj
Yes. Like I said...I just implemented CEGUI 0.7.1. Feel free to change the scripts and add your own models. Just make a component object in packages\test\actors.nut and change the onInitWorld() function to call that object instead of Robot.

I've been kicking around the idea of doing something similar to Torque and using Squirrel as the world file format. So when you save a world, it generates a Squirrel script that creates the objects in the world and defines any world data.

Just a note: It was amazing that you could get it up and running and was able to identify where the problem was and ask the appropriate question. That means the logs are working and it's semi-easy to understand.

Re: Compiling RF2

Posted: Thu Apr 01, 2010 2:23 pm
by ardentcrest
I Don't have the brains to compile the code.

Could you do a zip with a exe and all the files needed, please Mr P.

Re: Compiling RF2

Posted: Thu Apr 01, 2010 3:42 pm
by paradoxnj
Sure. I am in the process of upgrading to Ogre 1.7. Give me a couple of days to complete that and I will make a zip of the binaries for you.

Re: Compiling RF2

Posted: Thu Apr 01, 2010 7:34 pm
by ardentcrest
:D

Re: Compiling RF2

Posted: Wed Apr 07, 2010 5:14 pm
by paradoxnj
@ardentcrest - Here you go.

@ALL - I updated the build instructions to reflect the Ogre 1.7.0 and CEGUI 0.7.2 upgrade. It was not hard to upgrade to Ogre 1.7.0. I only had to make a few subtle code changes to reflect the new Singleton class (add a copy constructor and = operator). The format of the resources.cfg file changed a little also. My next step is to get camera movement attached to the player so you can at least run around and get some sound/music happening.

I no longer include the CEGUI or Ogre libs with the SVN code. I did this so that any version of Ogre or CEGUI can be used when compiling and you are not restricted to one version. The changes from one version of Ogre/CEGUI to another are not that large. Ogre 1.7.0 was a great improvement, but the API stayed the same making things much easier. I will be doing this with OpenAL and DirectX as well later on. Since I don't use the DX graphics API, I can do this comfortably as the DirectSound API does not change from version to version. OpenAL is designed like OpenGL so that API remains the same from version to version as well. I am designing the sound system to be a bunch of abstract classes that are implemented in SoundSystem DLLs (plugins) which RF2 will enumerate on launch and allow the users to choose.

Re: Compiling RF2

Posted: Thu Apr 08, 2010 8:56 pm
by tgrech
When i load "RFOgre_d" from that binary file, it comes up with a Visual C++ runtime error saying-
This application has requested the Runtime to terminate in an unusual way.
Please contact the applications support team.

EDIT- I ran it as Admin and it fixed the problem, but then it says it didnt find d3dx9_42.dll was not found, then it says debug error and says the same thing again.

EDIT 2- I downloaded that file, and it worked, but after i got past the OGRE screen it crashes.Now when i start it up it crashes straight away.