Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Xgkkp

  • Rank
    Advanced Member
  1. Xgkkp

    Detecting water?

    Quote:Original post by ButabeeI initially didn't want to do this because I wanted to have underground areas, but I decided that I'll just have the underground areas on higher ground. Couldn't you just define a region on the sphere where this test isn't made?
  2. Xgkkp

    class factory question

    I've been using a method from Bruce Eckels thinking in C++ (Free, very good c++ book series, search the net), basically there is a base 'factory' class that each class of yours creates a version of (and each class of yours is derived from the same base class) like so: class myclass : public baseobject { // Your class workings public: class Factory : public factoryclass { baseobject *create ( void ) { return new myclass; } } }; You then have a 'factoryclass' which contains a map between, say, a string and a pointer to a factoryclassobject, and a way to get a new class from it. class factoryclass { public: map<string, factoryclass *> factories; static baseobject* createobject(const string& id) { if(factories.find(id) != factories.end()) return factories[id]->create(); else // Handle the error case here (I throw an exception) } } You then 'add' the classes to the factory like so: factoryclass::factories["myclass"]= new myclass::Factory; Or write an add function inside the factoryclass class. I did experiment with function pointers, but it seemed awfully hard to make it flexible. I like this method, it is neat.
  3. Quote:Original post by ne0_kamen Pasman,thank you for posting your idea,I take a few things from it.Now I have a function which reads a whole line no matter of spaces :) As an extension of this, you might want to consider turning it into a 'tokeniser'. Instead of reading each line until you hit a '\n' - First trim off any whitespaces (i.e. space, tab, \n) until you hit a letter/character. - Then read the characters into a buffer string until you hit a whitespace, and return this string buffer Basically this means that you will be reading in a word at a time, instead of a line at a time. You may want to return \n on it's own too if the calling function needs to know when newlines happen.
  4. Xgkkp

    Visual Studio 2k5 Questions

    Quote:Original post by Forrest Smith2) Are there any good, free profilers for 2k5? In 2k3 DevPartner had a free version of theres and it was quite nice. But, again so far as I can tell, there isn't a feww one for 2005. Well, there is trial version that lasts for 14 days but that isn't very many days as I'd like this for a longer term project. I also would be extremely interested in finding this out - I shall need to start profiling (osmething which I have never done before) and have been wondering what tools I should be looking at. Of course, they would have to work with express.
  5. I find an invaluable reference is Numerical Recipes in C - a book that is available for free online. Check out chapter 7 for an in depth discussion of pseudorandom numbers and better ways of generating them (rand() is pretty much useless when anything approaching truly random numbers is needed)
  6. I think I get what you mean now... so would this work: The intersection calculator notes whether each intersection is an entry or exit when it compiles a list of all possible intersections - a list of distance, entry/exit type and any other needed information (like surface normal/reflection type) The program then goes through the list, adding one to an 'in volumes' counter every time it sees an 'entry' and subtracts one every time it sees an 'exit'. If the 'in volumes' counter is 1 when it hits an exit, it checks to see if the next collision is a duplicate position 'entry point' (and then ignores both collisions), and otherwise returns it as the proper wall collision point. Also unfortunately that book isn't in my university library, is there any others or perhaps websites that could be recommended?
  7. Quote:Original post by grhodes_at_work So, the other approach is simpler, and doesn't require the B-rep conversion. The idea is that at each intersection point, keep track of what object you are moving into and out of. For that bad intersection point you would have two points actually. One to leave the large box, and a coincident point to enter the small box. When you have two coincident points, if the two objects (the one you are leaving and the one your are entering) are the same (e.g., both empty space or both solid space), then you know to skip that point, filter it out because its an embedded point. This approach also works if one object is completely embedded inside another. Consider the case where the small box is shifted upwards and is inside the large box partially. Then, you'd find an intersection to enter the small box without a matching point to exit the large box. That too is a point to skip if the types (filled or empty) are the same. The rule set is simple. Skip points that come in pairs between objects of the same type (empty or filled). And skip points that are embedded within another object of the same type. Keep all other points! This second approach definitely sounds the best - I'm not actually building a complicated game world, and it probably wouldn't get much more complicated than this (a few volumes) - it's a physical simulation. Also I wanted to avoid going the faces/subdivided surfaces route because I need purely curved surfaces, and I'm even less sure how to treat them in that case (or even if it is possible to accurately treat subdivision of curved surfaces). So; you are suggesting that I would do something like the following: - Collide on all surfaces regardless of coming from inside or outside the object volume - Calculate collision points with every object, then sort them into distance - Test each collision point, and throw it out if: ...1. It is inside a seperate, 'negative' volume ...2. It is in a 'pair' of two collisions at the same point (wouldn't this be covered by 1?) - Have a 'safety' routine to select the last point anyway if it is the last detected collision (which would be, for instance, two volume faces occupying the same position) This is how I understand it, I don't quite get what you mean by tracking leaving and entering each object.. because surely you would run into trouble on that in cases where you exist in multiple objects? Also, do you have any good links where I can find out about ray-object intersection formulae/an introduction guide to it? I'm reading through a few things on google, but was wondering if there was a particularly recommended guide. My maths is strong, but I've never really covered the topic before.
  8. I am constructing a simulation of particles bouncing around inside a 'container', but am having trouble calculating the next point of impact. Bear with me a minute, as I am not sure how best to explain, or ask the question. I have the container defined as a set of 'negative volume' shapes (that is, where they are defined is empty space, and everything else is assumed to be solid - at the moment, I need not worry about positive volumes in the same space). As an example, the simple case I am working with is a large cylinder in one place, and a smaller cylinder joined and underneath for the entrance tube. I want to be able to take a position inside the structure and a vector, and calculate the point that it would next intersect with a wall. I can do it easily enough with just the one cylinder with some basic maths, but the problem comes when I want the second to 'hollow out' a pit in the bottom. My initial idea was to iterate through all objects, try casting the ray, and taking the shortest calculated distance as the collision point (taking into account the fact that if it starts outside of a volume, it can pass through the outer walls and hit on the other inside wall). However, this obviously doesn't work in my case because the shortest collision distance happens to be the boundary between two 'negative volumes'. This is shown in the diagram below. My other thought was to do the same thing, but have the second volume slightly overlapping, and at the collision point testing to see if it was inside any other negative volumes, and if so trying again but ignoring the first collision object it found (and keeping tabs on which ones it is ignoring). This seems highly inefficient. So I was wondering if anyone had any suggestions, either of solutions or links to places where I can learn about the proper way to deal with boolean volumes/ray collisions (although the cylinder surfaces definitely need to be a pure curve) Thanks! [Edited by - Xgkkp on September 1, 2006 3:22:48 PM]
  9. Ahh yes that is exactly what I need - thanks, though I am kicking myself for not being able to think of a concept so simple
  10. I am starting to redesign a project that I did last year to make it more flexible - my question is partly tied to scripts, however it is more of a general problem so I thought it would be most at home here (however using a scripting engine as an example) The problem I have is thus: I want to be able to specify objects to 'add' in the script file, for example, I want to be able to do this: add "BField" { ... add "linearfield" { ... } } add "particle" { ... The problem comes that I want the implementation to be vaguely flexible, that is, not hard-coded - to be able to pass the scripting code a list of "Class names" as strings (to match the parsed input) and some information that will let me create them dynamically - I assume all the objects would have to have to be inherited from the same base class, and that would be involved, but the only way I can think of is to pass a pointer to the objects constructor, but wouldn't that require it to be a static function? (And I'm sure that would cause other problems, if at all possible?) Any suggestions or insight would be greatly appreciated, I have tried searching but to be quite honest I'm not sure of the words I should be searching for, 'Dynamic class creation in c++ from scripts' and various permutations of that haven't yielded much information.
  11. Okay this is annoyingly me immensely; For some reason (in c) my printf statements have been changed so that instead of outputting whatever I tell them to, they seem to 'buffer' the output until I pass a newline, as in, it doesn't print anything until I pass something with '\n' in. This is immensely annoying as I want to build stuff up and display progress dots, and none of the dots show until the process is complete. Case in point: code: printf("."); is the exact line and nothing prints out until a later line passes a '\n' character. How can I get rid of this behaviour and return it to it's old ways? (why did it start?)
  12. Xgkkp

    Sudoku algorithm, anybody?

    Quote:Original post by silverphyre673 Actually, after doing a bit more research, it looks like the most common method involves applying an algorithm developed by David Knuth called "Dancing Links". I have tried looking for any information on it, but this is apparently a pretty obscure thing. Knuth's website has a paper on it, but it is in a format that I can't use (TeX format...). Anyways, if anyone can point me in the direction of more info on this algorithm, I would really appreciate it. Thanks a bunch! Here is his tex paper converted into pdf I'm not sure how long the link will remain active as my domain is due to be transferrred sometime later today though.
  13. Quote:Original post by dimebolt I believe that the matrices in OpenGL are the transposed of the Direct3D matrices. Did you do this?
  14. Recently a friend from work and myself have decided to start collaborating on a code project, given that neither of use has really worked in a programming team before and that we can make a bigger project together than on our own. We are planning on it being fully open source. I want to use a source control system so that we don't get any confusion, and I want to use subversion, as I am familiar with it (He has only used CVS but has indicated that as long as I tell him how to use it, it's all fine). I also would like to have some kind of task/bug tracking system, though it probably isn't as important. So I've been looking around for places to host this, as it isn't very practical for me to have a machine on all the time. Sourceforge is out,as that uses CVS - although if there is no other choices I probably could. Tigris.org (the place subversion is from) is so unclear about what they allow I'm not even sure our project would be allowed (It's a game). One place I did see was svn-hosting.com - has anyone had any experience with them? They seem to offer a reasonable basic plan for $5 a month, including bug/project tracking with Trac, but I was wondering if anyone knew anywhere else decent I could have a look at, or any more free hosting services - though I don't mind paying a reasonable amount, just some places seem to charge a minimum $20 a month for facilities I would only use a fraction of. Or does anyone advise against using something like this for such a project?
  15. Quote:Original post by xMcBaiNx Quote:Original post by Xgkkp Okay Okay so technically It's not soviet russia, but the title sounded good: Reverse Air-rage on Russian Jet In fact to be honest the article isn't that interesting but as I said, the title was neat. I'll be quiet now... Xgkkp UH.. are you guys like... taking this from other forums or is it just a coincidence ? :P 2004-07-20 19:05:51 Bacon: In Soviet Russia flight attendants beat up you! http://www.sundaytimes.news.com.au/common/story_page/0,7034,10200252%255E401,00.html Well It doesn't seem inconcievable that two seperate people could read... a news site... and come to the same conclusion. It's not even like it's an uncommon cliche phrase on the internet. Also, when "quoting" other forums, it helps to post a link to it too. >:(
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!