State of the Code

Re: State of the Code

Postby StefanP.MUC » 04 Aug 2011, 17:17

Nice. :)

Is it correct that you added the F10 key event to the Console input handler instead of the regular one? This will only react if the console is turned on.
StefanP.MUC
 

Re: State of the Code

Postby oln » 04 Aug 2011, 17:19

Yeah, just ignore that one, it was just for testing and I forgot to remove it.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby StefanP.MUC » 04 Aug 2011, 17:35

Just compiled the game (works fine), but starting the game doesn't work. On first run with the new code I got the Ogre graphics options menu, but after clicking OK the game exited without warning and without any message. Now it doesn't start at all (not even the graphics options menu appears). I have the newest svn files and the ogre shader dll. In the .OpenDungeons folder the shader cache was created by the game.
StefanP.MUC
 

Re: State of the Code

Postby oln » 04 Aug 2011, 17:48

Does the log say anything?
I had several issues with the part where the shaders were compiled. Maybe the rtshader files are missing or not being found?
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby oln » 04 Aug 2011, 18:00

svenskmand {l Wrote}:I have now added support for the My Documents\Open Dungeons folder to save userconfig files, screenshots, replays, etc. in. The path to the place to put these files is now stored in a single line in user_files.cfg in the root OD directory. The same file is also used on Linux, here I make it point to ~/.opendungeons in the deb-package and finally in the tarball releases user_files.cfg should just contain "." to indicate that files will be save in the root OD directory. If people compiling from source wants them stored somewhere else they can edit the file themself.

So now you just need to take this file user_files.cfg into account in the game.

I forgot to comment on this before now.
The game has code for locating the home folder in both windows and linux and is in use (I think on linux "." is used if the environment variable that points to the data folder is not specified.). Though, being able to manually specify a location is probably useful as well.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby StefanP.MUC » 04 Aug 2011, 18:35

Here is the last part of the log file, where the errors start. It does only get this far if the shader cache is not existing. If the cache exists, it doesn't even get to start logging (log file isn't accessed then).

{l Code}: {l Select All Code}
19:24:03: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program 1552867684_FS: The compile returned an error.
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
 in CgProgram::loadFromSource at ../../../../../../PlugIns/CgProgramManager/src/OgreCgProgramManagerDll.cpp (line 67)
19:24:03: High-level program 1552867684_FS encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program 1552867684_FS: The compile returned an error.
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
(0) : error C6007: Constant register limit exceeded; more than 32 constant registers needed to compiled program
 in CgProgram::loadFromSource at ../../../../../../PlugIns/CgProgramManager/src/OgreCgProgramManagerDll.cpp (line 67)
19:24:03: OGRE EXCEPTION(2:InvalidParametersException): Could not create gpu programs from render state  in ProgramManager::acquireGpuPrograms at ../../../../../../Components/RTShaderSystem/src/OgreShaderProgramManager.cpp (line 102)
19:24:03: Ogre exception:
OGRE EXCEPTION(2:InvalidParametersException): Could not create gpu programs from render state  in ProgramManager::acquireGpuPrograms at ../../../../../../Components/RTShaderSystem/src/OgreShaderProgramManager.cpp (line 102)
StefanP.MUC
 

Re: State of the Code

Postby oln » 04 Aug 2011, 18:46

Hm, those errors look like the shader generated isn't supported by the graphics card or driver you are using (or something is set wrongly in the code, I don't know) 32 registers sounds like a very low amount.
Have you tried to run the shader example in the Ogre sample browser?
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby StefanP.MUC » 04 Aug 2011, 19:19

I have an ATI Mobility Radeon 2600 HD with 512 MB VRAM with the latest drivers (from two days ago). It's DirectX 10 compatible and OpenGL 3.3. According to the Ogre forums this error could be if the graphics card doesn't support so much instructions. But my card is not 10 years old, it can run most current commercial games on medium to high graphics settings.

The DirectX renderer works perfectly, only the OpenGL one doesn't.

Maybe you have to set the minimum OpenGL or GLSL version in the code? My card/driver can handle OpenGL shader model 4.0, but not 5.0. Maybe there is the problem.
StefanP.MUC
 

Re: State of the Code

Postby oln » 04 Aug 2011, 19:30

I haven't touched anything like that. My card quite old (Quadro FX3500M DX9c,Shader model 3.0), so I don't think it's a hardware issue.
I was planning to make a post at the ogre forums about this, maybe there are changes that should be done. (Didn't work with GLSL shaders, only cg when I tested here. I already had to comment out one of the default materials provided to make the game run.)
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 04 Aug 2011, 21:36

oln {l Wrote}:The game has code for locating the home folder in both windows and linux and is in use (I think on linux "." is used if the environment variable that points to the data folder is not specified.). Though, being able to manually specify a location is probably useful as well.

I added this to the installers so the game would not have to deal with finding the right path on different OS'es, I think it is cleaner this way. This should also make it easier to make the game work on new OS'es like Mac and other variations of Linux (although I guess .appname is standard in all Linux variants).
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby MyEmail » 05 Aug 2011, 06:15

Ogre's filesystem management should have something to do this for you. If not, its a piece of cake:
{l Code}: {l Select All Code}
void getProgramHomePath(string &out) {
#if defined WINDOWS
    out = getenv("PROGRAMFILES");
#elif defined LINUX
    out = getenv("HOME");
#elif defined OTHER_OS_YOU_SUPPORT
    // code here
#else
    #error Unkown platform!
#endif
}


getenv() is also useful for attaining other system folders such as temporary directories, user folders, application directories, etc.
MyEmail
 
Posts: 107
Joined: 06 Jul 2011, 08:58

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 06:46

Assuming that PRROGRAMFILES gives you back c:\program files that is not going to work as windows vista and 7 does not allow a program to change files in that directory.

When we use installers to handle such stuff they take all peculiarities across OS's into account, e.g. a msi package for windows will give the correct paths back for future OS's too.
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby oln » 05 Aug 2011, 09:21

The code uses GetUserProfileDirectoryW on windows, not the env variable.
GetEnv is used on linux.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 09:38

So should I remove the "user_files.cfg" from Git and the Windows installer and Ubuntu/Debian package?
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby oln » 05 Aug 2011, 10:15

I think, rather than having this file, we should have a config file covering more things, including the ability to specify this directory.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 11:35

So you also want it to be done during the installation process, i.e. so that it is independent from the code?
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby oln » 05 Aug 2011, 14:47

I don't know. Are there other settings where we would want different default settings depending on the distribution method?
Also, I posted on the Ogre forums regarding the shader issue.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 17:01

Nope, cannot really think of anything at the moment. If we cannot find any other stuff should we then remove it from the installers or what?
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby oln » 05 Aug 2011, 17:02

I guess we can remove it then yeah. Maybe re-add a config file later.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 17:48

But where are we saving files currently? When I play the game on Windows 7 it does not make any folder in my documents where it saves config files.
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby oln » 05 Aug 2011, 17:55

http://msdn.microsoft.com/en-us/library ... 85%29.aspx
So in c:/users/<username> or similar it seems.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby oln » 05 Aug 2011, 18:10

StefanP.MUC {l Wrote}:I have an ATI Mobility Radeon 2600 HD with 512 MB VRAM with the latest drivers (from two days ago). It's DirectX 10 compatible and OpenGL 3.3. According to the Ogre forums this error could be if the graphics card doesn't support so much instructions. But my card is not 10 years old, it can run most current commercial games on medium to high graphics settings.

The DirectX renderer works perfectly, only the OpenGL one doesn't.

Maybe you have to set the minimum OpenGL or GLSL version in the code? My card/driver can handle OpenGL shader model 4.0, but not 5.0. Maybe there is the problem.


One thing that could be an issue, after reading a bit on the ogre forums, is the number of lights in the scene.
Could you try to comment out most of the lights in the level and see if this still happens? Solved the issues for me.

Also, I think it would be an idea to reduce the size of the textures (most of them are unnecessarily large), and keep the full size ones in the source area of the svn repo. This could hopefully lower the loading time a bit.
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 19:54

oln {l Wrote}:http://msdn.microsoft.com/en-us/library/bb762280%28v=vs.85%29.aspx
So in c:/users/<username> or similar it seems.

Hmmm, that does not seem to be a natural place to put them compared to how other games do it :S Most games puts their user data in the Document folder, just looking at my document folder I have the following games that does that:
  • Duke Nukem Forever
  • Overlord
  • StarCraft II
  • Magic the Gathering - Planeswalkers
and then the following two games make a "My Games" folder inside of the Document folder where they put their user data, those games are Dawn of War 2 and Unreal Tournament 3.

Looking a bit more at you link and following links I found this (WinXP and Vista, I think). It seems you need to use CSIDL_MYDOCUMENTS or CSIDL_PERSONAL to get the documents folder for the current user. This seems more robust than my idea with the user_files.cfg as this support multiple users having their own seperate user files for the game. For Windows 7 this describes the equivalent. So it depends on which Windows version the user is running :S
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Re: State of the Code

Postby oln » 05 Aug 2011, 20:14

Yeah, you are probably right.
Quickly looked at Rigs of Rods.
It was using:
{l Code}: {l Select All Code}
SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, user_path)

Which is what you were talking about.

The current code was based on the code for getting the home folder in Qt.

(Oh the joy of the windows API...)
User avatar
oln
 
Posts: 1020
Joined: 26 Oct 2010, 22:16
Location: Norway

Re: State of the Code

Postby svenskmand » 05 Aug 2011, 20:38

oln {l Wrote}:(Oh the joy of the windows API...)

Exactly!

Then I will remove the user_files.cfg file from Git again and remove it from the Windows and Ubuntu/Debian packages.
Jamendo.com - The best music store on the net, uses CC licenses.
User avatar
svenskmand
OD Moderator
 
Posts: 1850
Joined: 09 Dec 2009, 00:07
Location: Denmark

Who is online

Users browsing this forum: No registered users and 1 guest