Beauty, your help has been greatly appreciated. [...] I did Console.WriteLine("Colliding") [...] 1200 times every frame
Hehe, yes this causes much CPU load.
But in an other application I did the same mistake - Much output to the console or to a GUI textbox.
When you have a text as String and attach more text very often (myString += "more text"
) then it could be better to use the class StringBuilder
instead. When you update a String, there will be created a new String object for every update. The StringBuilder class is good for heavy write access. (But you only need it if you change the content very very often. In most cases just use common Strings.)
For advanced logging or heavy use (e.g. 1200 log entries per frame) there is a nice logging library called log4net
log4net is a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent log4j framework to the .NET runtime. We have kept the framework similar in spirit to the original log4j while taking advantage of new features in the .NET runtime
When the configuration is done (by code or by an XML file), you just need to call log.Info("neu log entry")
, log.Warn("neu log entry")
or log.Error("neu log entry")
and the library will put it to the logfile (using an other thread). By a configuration you can attach time stamps, class names, etc. to your logfiles.
At first the usage is looking complex, but when you understand the concept, then it's fine.
Here is an easy example how to configure by code:
In regards to boyamers physics enginge, it uses p/invokes.
Boyamer develops a whole game engine, not only a physics engine.
He has a p/invoke version and also a pure C# version of his engine for XNA/Xbox target. I'm shure that boyamer did or will embedd a pure .NET physics engine. If there is realy no fitting library, maybe he write a port for C#. He's a crazy boy and did similar things in the past, although it's much work
I actually did get a physics library (JigLibX) and added the hooks for Mogre. It was kind of like using .net to wrap something for .net, so it remained completely managed, the down side? The user would have to have XNA installed on their system. A complete port of the library would be possible, if not easy, but I'm afraid I've wasted enough time on collision and need to move on. If there's interest I'll upload the "wrapper", but most people here I'm sure are comfortable using their c++/cli wrappers.
Be welcome to publish your wrapper. Maybe somebody will need it.
I prefere to upload it to a public hoster like sourceforge, google code or bitbucket.
It's a pain, when people upload useful stuff to private websites or file hosters and after some months or years the links are dead.
If it's just a tiny code snippet, maybe you could add it to the Ogre wiki. (If you need help with the wiki, I can help you.)