Jump to content
The Dark Mod Forums

Recommended Posts

Posted
So I've been wading through all those typedefs and templates and classes that all seem to call themselves for over an hour now and it's still not quite clear to me. My goodness, two weeks of C++ and now this...

If it takes you an hour to wade through that crap and understand what's going on, then you're doing very well. :) I spent a couple of days just sifting though the renderer implementation trying to understand it, and still only gained a rough idea of how it works.

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
  • 3 weeks later...
Posted

I don't wanted to post in the Off-Topic forum, as this is scons-related: Is there a possibility to turn off the update notification for scons 096.92-02? I had to re-install the 0.96.1 package for Ubuntu 6.06 as New Horizon and now it bugs me everytime to update the (working) package with the (not working) package...

Posted

Crashing when I try to run the latest build.

 

Loading modules from /home/newhorizon/darkradiant/install/plugins/

Loading modules from plugin dir /home/newhorizon/darkradiant/install/modules/

Segmentation fault (core dumped)

 

That's as far as I get. Weird.

Posted

I have a question regarding the generic/vector.h lib:

 

While disentangling the code of selection.cpp I noticed masses of function that look pretty deprecated to me, like:

vector3_subtracted(origin, ray.origin);

Looking at the BasicVector3 template, I found that the Vector3 class has no + or - operators defined, wouldn't this be handy or is there a specific reason for using functions like vector3_substracted()? This is C-style, isn't it?

 

In fact, I found an implementation of the - operator in math/vector.h:

template<typename Element, typename OtherElement>
inline BasicVector3<Element> operator-(const BasicVector3<Element>& self, const BasicVector3<OtherElement>& other)
{
 return vector3_subtracted(self, other);
}

that again is calling vector3_substracted() what I somehow find weird... this should be declared in the class BasicVector3, shouldn't it?

 

Another thing I wanted to ask: I found this line in the getLength() function of BasicVector3:

double lenSquared = x()*x() + y()*y() + z()*z();

Wouldn't it be faster if this was implemented like this

double lenSquared = m_elements[0]*m_elements[0] + m_elements[1]*m_elements[1] + m_elements[2]*m_elements[2];

without having to call the internal function six times? Or is this neglectable in terms of speed? Maybe I'm thinking too conservative in terms of CPU cycles (like I had to in the olden days :D), perhaps I underestimate the optimisation routines of g++, I just wanted to know.

Posted

Having to call it six times is definitely slower. After all the stack has to be built and destroyed and depending where each function resides in memory, you might get a cache miss as well.

Gerhard

Posted

Ah, I think I got the idea, why the vector addition was implemented this way, and not directly in the class: the above declaration of vector3_substracted() is designed such way, that one can also substract Vector3s of different type (e.g. an int-Vector3 and a float-Vector3). I'm not sure if this is feasible with declaring the operation within the class BasicVector3 itself, someone with more experience might well know that.

 

I don't know how often this happens, though, but I guess I'll leave it as is is then, before anything breaks.

 

edit: perhaps the + operator can be defined as a template operator, analogous to this templated constructor?

template<typename OtherElement>
BasicVector3(const BasicVector3<OtherElement>& other) {
  x() = static_cast<Element>(other.x());
  y() = static_cast<Element>(other.y());
  z() = static_cast<Element>(other.z());
}

Posted

Wouldn't it make more sense to have the complete function defined as a template? That's what templates are for. You instanciate a an object with the type that you need. So there shouldn't be a need for a seperate function. I rather think that it was done this way to also support older C compilers maybe.

Gerhard

Posted

What function do your refer to? The vector_substracted() one? This is already a template, it's in one of the last posts.

Posted

The reason it is designed like that is because the author doesn't understand C++ design techniques (like using member functions to operate on objects, rather than C-style functions), and also because the author thought that by splitting the vector code into generic/vector.h which just contains the basic type, and math/vector.h which contains all the mathematical operations, he could reduce the amount of code that would be included if you wanted a vector without performing maths operations on it.

 

This design is, as you have noticed, crap. I am adding member functions piecemeal onto the BasicVector3 definition, and eventually all of the vector3_blah() functions will be removed. Calling the x() and y() functions shouldn't be that slow, because they are inlined and hence optimised out, but I agree that referring to the array directly would be better design.

 

@NH : Segfaults are serious. Can you post the contents of your .darkradiant/radiant.log? Also, are you running a Release build? If so, try compiling a Debug build and see if you get an assertion failure or other diagnostic message before the crash.

Posted
This design is, as you have noticed, crap. I am adding member functions piecemeal onto the BasicVector3 definition, and eventually all of the vector3_blah() functions will be removed. Calling the x() and y() functions shouldn't be that slow, because they are inlined and hence optimised out, but I agree that referring to the array directly would be better design.

I just managed to implement the + and - operations to the Vector3 class, which work seamlessly (I commented out the operator in math/vector.h and it works flawlessly). I will try to do as much as possible without having to touch every single cpp-file in the codebase.

 

@NH : Segfaults are serious. Can you post the contents of your .darkradiant/radiant.log? Also, are you running a Release build? If so, try compiling a Debug build and see if you get an assertion failure or other diagnostic message before the crash.

I got such a crash once when I ran DarkRadiant with a completely outdated user.xml in my user settings folder. I guess this had to do with all the toolbars that were missing, so I could imagine that's the case here. A log dump would definitely help to write a more fail-safe routine to include those XML settings.

Posted
I got such a crash once when I ran DarkRadiant with a completely outdated user.xml in my user settings folder. I guess this had to do with all the toolbars that were missing, so I could imagine that's the case here. A log dump would definitely help to write a more fail-safe routine to include those XML settings.

 

Yes, we will certainly need to fix that. An application should never segfault for any reason short of damaged hardware or bad memory.

Posted

Ok, as soon as I get my hands on the log file, I will look into this.

 

edit: just looked at the toolbar code: it's already bolted up against NULL pointers, so perhaps it's some missing colours causing the problem.

Posted

A completely different question: does the "scale" operator work for anyone else here? Create a brush, toggle the "scale" mode on the toolbar, and try to drag a brush. What happens for you? For me, the brush get's stretched ad infinitum, and just a thin line remains. Can anyone reproduce this?

 

First I thought I have screwed some of the vector operations, but this seems to be a problem with Radiant in general.

Posted

I take it you've tried the usual sweep-and-clear tactics - fresh checkout and remove the contents of the build/ directory before recompiling?

 

Does your Windows build work OK (or did you never get the Windows build to work properly)? You can try the 0.7.0 preview I posted in the Current Build forum to test in Windows if you don't have a build environment on the platform.

Posted
I have logging enabled, but it's not generating a log file.

You sure that you are looking in the right folder? It's a hidden folder: /home/newhorizon/.darkradiant (note the point). You can show the hidden files in Nautilus by pressing Ctrl-H. Sorry, if I sound smart-ass and say the obvious, I just want to make sure.

Posted

Ahh, sorry. I didn't realize it was a hidden folder.

 

Started logging to /home/newhorizon/.darkradiant//radiant.log

Today is: Sat Nov 4 09:49:33 2006

This is DarkRadiant 0.7.0

Scanning for game description files: /home/newhorizon/darkradiant/install/games/

/home/newhorizon/darkradiant/install/games/doom3.game

XMLRegistry: Importing XML file: /home/newhorizon/darkradiant/install/games/doom3.game

saving global preferences to /home/newhorizon/.darkradiant//global.pref

game description file: "doom3.game"

archivetypes = "pk4"

basegame = "base"

basegamename = "Doom 3"

brushtypes = "doom3"

engine_linux = "Doom3"

engine_macos = "Doom3.app"

engine_win32 = "Doom3.exe"

enginepath_linux = "/usr/local/games/doom3/"

enginepath_macos = "/usr/local/games/doom3/"

enginepath_win32 = "C:/Program Files/Doom 3/"

entities = "doom3"

entityclass = "doom3"

index = "99"

maptypes = "mapdoom3"

modeltypes = "lwo ase md5mesh"

name = "Doom 3"

patchtypes = "doom3 def2doom3"

prefix = ".doom3"

shaders = "doom3"

texturetypes = "tga jpg dds"

type = "doom3"

unknowngamename = "Custom Doom 3 modification"

XMLRegistry: Importing XML file: /home/newhorizon/darkradiant/install/user.xml

XMLRegistry: Critical: Could not parse /home/newhorizon/darkradiant/install/user.xml

XMLRegistry: Critical: File does not exist or is not valid XML!

XMLRegistry: Importing XML file: /home/newhorizon/.darkradiant//user.xml

ColourSchemeManager: Loading colour schemes...

Found '/home/newhorizon/darkradiant/install/plugins/brushexport.so'

Found '/home/newhorizon/darkradiant/install/modules/archivepak.so'

Found '/home/newhorizon/darkradiant/install/modules/archivewad.so'

Found '/home/newhorizon/darkradiant/install/modules/archivezip.so'

Found '/home/newhorizon/darkradiant/install/modules/entity.so'

Found '/home/newhorizon/darkradiant/install/modules/image.so'

Found '/home/newhorizon/darkradiant/install/modules/imagepng.so'

Found '/home/newhorizon/darkradiant/install/modules/mapq3.so'

Found '/home/newhorizon/darkradiant/install/modules/md3model.so'

Found '/home/newhorizon/darkradiant/install/modules/model.so'

Found '/home/newhorizon/darkradiant/install/modules/shaders.so'

Found '/home/newhorizon/darkradiant/install/modules/vfspk3.so'

loading global preferences from "/home/newhorizon/.darkradiant//global.pref"

qpref import: data version 1.0 is compatible with code version 1.0

loading local preferences from /home/newhorizon/.darkradiant//doom3.game/local.pref

failed to load local preferences from /home/newhorizon/.darkradiant//doom3.game/local.pref

Module Initialising: 'radiant' '*'

Module Ready: 'radiant' '*'

Module Initialising: 'VFS' '*'

Module Initialising: 'archive' 'pk4'

Module Ready: 'archive' 'pk4'

Module Ready: 'VFS' '*'

Module Initialising: 'entity' 'doom3'

Module Initialising: 'qgl' '*'

Module Ready: 'qgl' '*'

Module Initialising: 'undo' '*'

Module Initialising: 'preferences' '*'

Module Ready: 'preferences' '*'

Module Ready: 'undo' '*'

Module Initialising: 'scenegraph' '*'

Module Ready: 'scenegraph' '*'

Module Initialising: 'renderstate' '*'

Module Initialising: 'shaders' 'doom3'

Module Initialising: 'textures' '*'

Module Initialising: 'image' 'tga'

Module Ready: 'image' 'tga'

Module Initialising: 'image' 'jpg'

Module Ready: 'image' 'jpg'

Module Initialising: 'image' 'dds'

Module Ready: 'image' 'dds'

Module Ready: 'textures' '*'

Module Initialising: 'scriptlib' '*'

Module Ready: 'scriptlib' '*'

Module Initialising: 'image' 'bmp'

Module Ready: 'image' 'bmp'

Module Ready: 'shaders' 'doom3'

Module Initialising: 'openglshaderlibrary' '*'

Module Ready: 'openglshaderlibrary' '*'

Module Ready: 'renderstate' '*'

Module Initialising: 'selection' '*'

Module Ready: 'selection' '*'

Module Initialising: 'reference' '*'

Module Initialising: 'filetypes' '*'

Module Ready: 'filetypes' '*'

Module Initialising: 'model' 'lwo'

Module Initialising: 'filters' '*'

Module Ready: 'filters' '*'

Module Ready: 'model' 'lwo'

Module Initialising: 'model' 'ase'

Module Ready: 'model' 'ase'

Module Initialising: 'model' 'md5mesh'

Module Ready: 'model' 'md5mesh'

Module Initialising: 'map' 'mapdoom3'

Module Initialising: 'eclassmanager' 'doom3'

Module Ready: 'eclassmanager' 'doom3'

Module Initialising: 'brush' 'doom3'

Module Ready: 'brush' 'doom3'

Module Initialising: 'patch' 'def2doom3'

Module Ready: 'patch' 'def2doom3'

Module Initialising: 'patch' 'doom3'

Module Ready: 'patch' 'doom3'

Module Ready: 'map' 'mapdoom3'

Module Ready: 'reference' '*'

Module Initialising: 'namespace' '*'

Module Ready: 'namespace' '*'

Module Initialising: 'modelskin' '*'

Module Ready: 'modelskin' '*'

Module Ready: 'entity' 'doom3'

Module Initialising: 'plugin' 'brushexport'

Module Ready: 'plugin' 'brushexport'

vfs directory: /home/newhorizon/.doom3/base/

vfs directory not found: /usr/local/games/doom3/base/

filesystem initialised

searching vfs directory "def" for *.def

ColourScheme: Colour light_volumes doesn't exist!

 

I never did get windows working properly, so I'll try out the windows preview to see what happens, and I'll also purge my directory in linux.

Posted

This is the part that's describing the problem:

XMLRegistry: Importing XML file: /home/newhorizon/darkradiant/install/user.xml
XMLRegistry: Critical: Could not parse /home/newhorizon/darkradiant/install/user.xml
XMLRegistry: Critical: File does not exist or is not valid XML!

It seems that there is no user.xml in your install/ folder, please try to checkout the file again. You can safely delete the user.xml file in the hidden folder (it gets copied over by the install/user.xml at startup).

Posted
This is the part that's describing the problem:

XMLRegistry: Importing XML file: /home/newhorizon/darkradiant/install/user.xml
XMLRegistry: Critical: Could not parse /home/newhorizon/darkradiant/install/user.xml
XMLRegistry: Critical: File does not exist or is not valid XML!

It seems that there is no user.xml in your install/ folder, please try to checkout the file again. You can safely delete the user.xml file in the hidden folder (it gets copied over by the install/user.xml at startup).

 

Ahhh, ok.

 

It was giving me the seg fault, and you posted something about the user.xml, so I deleted it. It was crashing before the delete though. I'm just rebuilding after a full checkout. I'll let you know what happens.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • thebigh

      Starting a playthrough of the whole Dark Mod, from oldest mission to newest. I've knocked over the first few already and about to start Living Expenses. Only ~170 missions to go!
      · 6 replies
    • Goblin of Akenash

      test
      test
      test
       
      Click Here for goblin secrets
      · 0 replies
    • Ansome

      I'm back! Happy new years, TDM folks!
      I brought with me a quick update for my first FM that fixes up a lot of small issues that didn't get caught in beta testing. I didn't exactly expect it to take me nearly 9 months to release a patch, but it's been a wild year to say the least. Teaching, finishing up my Master's of Education, and all manner of other events forced me to drop out of the anniversary FM contest and ate up all my time, but I'm back again in a comfortable position to start catching up on all the new FMs. I may even start work on another spooky project of greater length and difficulty in the coming year.
      Thanks again for the warm welcome to the community and have a happy new year!
      · 3 replies
    • JackFarmer

      I got myself the apple tv trial subscription. I have to say, “Foundation” (season 1) is very exciting. Shall I read the books as well?
      · 2 replies
    • datiswous

      One more like..
       

      · 3 replies
×
×
  • Create New...