Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

133 Neutral

About RunningInt

  • Rank
  1. RunningInt

    Sudoku Solver Class

    Quote:Original post by MVP This is just practice but I want to make sure it is cross platform and is over decent code, if you see anything wrong with it or something that should be made better let me know. MainFunctions.h *** Source Snippet Removed *** Sudoku.h *** Source Snippet Removed *** I took a quick glance and one thing I would change, and admittedly this isn't an important change, is that Power(int,int) function to use iteration instead of recursion. int Power(int x,int y) { int ret=1; for (int i=0;i<y;i++) ret*=x; return ret; } I just think it's generally better to avoid recursion when possible because it can easily lead to blowing the stack. Although in this case the problem of integer overload will likely crop up before that..
  2. Given a set of vertices connected in a ring to enclose a bounded 2D region: What method would be best to connect the vertices so that the interior of the shape was filled up with tesselating triangles? eg: At first I thought only the vertices mattered, and some simple algorithm could just taking each vertex one by one and connecting it to another vertex, making sure that triangles don't overlap. But the shape can be concave: Which leads to a few additional complications because some triangles created between vertices would be invalid: I have noticed that for N vertices N-2 triangles must be created to fill the interior of the 2D region. That's about the only nice consistant thing I have found in this problem. I am eventually looking for a nice simple algorithm (not necessarily a fast one). You know the kind you hit yourself on the head and go "argh why didnt I think of that". One of the sub-problems that I am interested in is: given any 3 of the vertices, how can you tell whether the triangle formed by those vertices falls inside, outside, or overlaps the bounded shape. I think that's at least half the battle. Of course I could do something nasty like use segment intersection tests all over the place, but that's precisely the kind of thing im trying to avoid..if I can. If anyone spots any useful starting ideas that would be very helpful! The reason I am after a solution for this problem is to use it to automatically fill in holes in a 3D mesh after a vertex has been removed. The vertices will be removed if the triangles they are connected to are relatively coplanar. Ie this is to be used to reduce redundant triangles in a model.
  3. RunningInt

    Pathfinding for flying creatures

    interesting problem. I'll think about it tonight
  4. I think Relativity is a bit over the top to implement for a game Then again adding the firer's velocity to the velocity of the bullet when it is fired is a good idea
  5. Anyone ever seen anything like this? if (!a) //check whether a exists (?!!) { } else if (a == true) //if true { } else if (a == false) //if false { } else //just in case!! { }
  6. RunningInt

    OpenGL _above_ a win32 control?

    you mean you want it too be fullscreen?
  7. Hi, I am looking at making a very simple 3rd person squad-based game using opengl. This will involve a static heightmapped terrain and various units which can be selected and moved across it. The units will be 3D models, but will be low quality models. I am strongly favoring quantity of units rather than quality of the models. I am going to use Milkshape3D to build and animate the models and will export them in ms3d format and then convert them into my own undecided format stripping any information out which I don't need. I am really looking at having to render these models very quickly, but this is the first time I have attempted this and am not sure what the best method would be. 1) Build the models and skeletal animations, then extract each frame of animation and store each frame as a static model. Ie this is basically converting a skeletal animated model into a series of non-skeletal animated model like the old quake2 format. This avoids calculating bone orientations at runtime, but takes up a lot of memory to store a model. I assume that if the models are low detailed enough I could fit each of the frames into a display list to render it really fast. 2) Milkshape3D does skeletal animation by attaching each vertex of the model to one joint. This means a triangle face can have each of it's 3 vertices belonging to different joints. Which means that a face can be angled dependant on the angle of two bones and not one. This makes the model look smoother at the seams, but I assume I cannot then use a display list for each bone as the vertex map for each bone is not static. 3) Build the models and animations so that each triangle face belongs to one bone. Store each bone's faces in a display list and just calculate each bone orientation in game and render its display list. This means the seams between different bones will overlap and won't be smooth. But if this method gives me a huge speed boost then I dont care. I wonder if anyone can spot any incorrect assumptions I have made here, or perhaps point out a better way of doing things. I really don't know the best method of rendering as many models as possible. My main question is over the issue of display lists. I have used them, but not very much. Would use of display lists allow me to put a lot more models on the screen at once than I would be able to do without using display lists? Or is the trade off so negliable as not to be worth it?
  8. The only two controls you really need to internally implement in detail are a textbox and image control. Any other type of control can be derived from these using higher level API functions or a scripting language depending how you design the library. For example a button is just an image control that changes image when clicked on. If you implement image controls to be reactive to mouse clicks, capable of binding to callback functions and also implement an internal animation system whereby you can instruct an image control to change its image after a specified delay then you have a button. Also its useful to allow controls to contain controls. This means implementing a control heirarchy. This allows prefab controls to be made and then "copy pasted" easily. For example a scroll bar control is actually a transparent image control which contains a child image control for the bar and another for the slider, and a textbox control for the value. All coordinated by top level scroll bar control. In all honestly it would be a nightmare to design any kind of decent looking menu that didn't allow controls to be imbedded in one another. Another thing that is necessary is a messaging system that allows messages such as mouse clicks to be passed up or down the control heirarchy until they are trapped by a control willing to process it (kind of like windows messaging). Haven't thought about keyboard messages as I have never done them before. Also it is absolutely critical to make a good control positioning system. You really need the ability to give widths and heights in percentages rather than pixels or else changing resolution will present problems. There is also a ton of hassle with getting text to align and clip to different sized textboxes. If you don't have a simple and solid positioning api then you will end up wasting tons of time repositioning controls using fiddly function calls wrapped in condition statements. Finally to really speed up development you can build a GUI editor that drives your api. There are so many GUIs in a typical game that its a huge huge waste of time trying to hardcode the positions of controls manually, even if you have got prefab composite controls. I consider GUI design to be a waste of my time personally and have reached the point where I won't do it unless I have an editor. I don't have an editor. **note case in point - the good-enough GUI system inbedded in doom3 only used images and textboxes if I recall correctly
  9. RunningInt

    Boost Serialization

    thanks man, good spot.
  10. Quote:I want execute a exe file from memory and not from disk, because i have contain of the exe file in a stream and in memory, if i want write the containt on disk other user can access it, i only want run it from memory. now i have the exe file in stream. I do not think there is a documented way of doing that in windows so it will be very tricky to accomplish and unstable. If you want to stop other users accessing the executable you could simply disguise the executable. This will work on the vast majority of users. To do this write the executable to disk as a file with a different extension. This way typical users will not be able to execute it by double clicking on it in explorer. They will have to rename it to .exe to do that and most will not think of this. If you write the executable to disk as filename.jpg then users will think it is an image file. If they double click to load it the image viewer will fail to open it. They will just think it is a broken jpg. They will not realise it is an executable. Using a well known extension lessens the likelyhood that more savvy users will try and open it in notepad where they will see "This program cannot be run in DOS mode" which kind of gives the game away. For this reason don't use an extension associated with a text viewer such as .txt or .log You can use CreateProcess to execute any file with any file extension. eg: STARTUPINFO si = {0}; PROCESS_INFORMATION pi; si.cb = sizeof(STARTUPINFO); //filename.jpg is an executable CreateProcess("filename.jpg",NULL,NULL,NULL,false,0,NULL,NULL,&si,&pi);
  11. I have decided to try learning the boost serialization library to try and make writing code to save and load game state to disk a lot faster. Maybe if I get more productive I might actually finish a game one day. After far too much time I finally managed to figure out how to compile the boost serialization lib. I am using gcc. Then I tried to compile a very simple example: #include <fstream> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/utility.hpp> class Test { private: friend class boost::serialization::access; int myint; template<class Archive> void serialize(Archive & ar, const unsigned int version) const { ar & myint; } public: Test(int myint) : myint(myint) { } }; int main(int argc, char *argv[]) { Test tt(5); std::ofstream ofs("filename.txt"); { boost::archive::text_oarchive oa(ofs); oa << tt; } system("PAUSE"); return EXIT_SUCCESS; } But I run into the following compile error: incomplete type `boost::STATIC_ASSERTION_FAILURE<false>' does not have member `value' This is caused by the following line in oserializer.hpp which gets called as part of the << operator being invoked above: BOOST_STATIC_ASSERT(check_tracking<T>::value); After a few wasted hours of trying to figure out what was going on I finally saw the comment just before that line in oserializer.hpp. It reads: // if your program traps here, it indicates taht your doing one of the following: // a) serializing an object of a type marked "track_never" through a pointer. // b) saving an non-const object of a type not markd "track_never) // Either of these conditions may be an indicator of an error usage of the // serialization library and should be double checked. See documentation on // object tracking. ***************** At this point I have wasted another 2 hours thinking that the above comment did not apply because i was serializing an int. I tried making the member int const and all kinds of stupid things. It was only in copy pasting the above comment into this post that I realized I am serializing a Test object, not an int. By changing the line of my code: test tt(5); to const test tt(5); it compiles and works. So do I really need to post this? Probably not, but like hell im going to delete everything I've typed so far. Fortunately I new questions. The serialization library is protecting me from some danger by forcing me to only use const objects. But I don't like having to declare all my objects as const. Obviously const_casting is just going to cancel out the protection and I doubt that is a good idea as I have very little idea what it is protecting me from. Is it normal practice to declare objects as const when using the boost serialization library, or dao people typically const_cast and turn off object tracking here and there? In other words do I have to actually understand the purpose of object tracking in order to use the serialization library? Thanks
  12. I am trying to make a scrabble game and need a way of validating words. I need a large dictionary file of valid words in the english language to do this. But I am having trouble finding a dictionary file or word list that contains enough words. All the ones I can find miss a lot of words out (or contain nonsense words). I don't mind about the format as I can re-arrange that myself. All I need is a file containing just about every word imaginable, preferably along with each word's type (ie noun, verb, adjective, etc). Surely there must be some kind of super dictionary file somewhere on the internet. I am amazed if there isn't one. What do all these puzzle word games in flash use to validate their words? Could I perhaps take the dictionary file in microsoft word to pieces somehow? thanks,
  13. Hi, I am trying to optimise my C++ A* algorithm but cannot find what I am after in the standard template library, but that might just indicate my lack of search skills. I need a container in which I can easily get the smallest element. The most efficient way to do this in my mind would be to use a sorted container. If I wasn't bothered about the speed I would just use an stl vector and use sort() each time I inserted an element. But I suspect it would be much more efficient to actually insert the element in the correct place. So vector is out of the question. I came across this STL compliant "sorted_vector": But it points out the fact that insertions are rather slow being that it is a vector and all. What would seem the best solution to me is a sorted linked list. This allows insertion in O(n) and obtaining the smallest element in O(1). But I am not aware of an STL implementation of a sorted linked list. Could write my own but there is always that luxury of knowing a container is properly optimised when it is official.
  14. Hi, I am trying to call the winapi function GetCursorPos from C# [DllImport("user32.dll"),CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall] public static extern int GetCursorPos(ref POINTL lpPoint); [StructLayout(LayoutKind.Sequential)] public class POINTL { public int x; public int y; } ... public POINTL test() { POINTL p = new POINTL(); GetCursorPos(ref p); return p.x; } However it throws a NullReferenceException, claiming that the "object reference has not been set to an instance of an object" (shouldn't that be instance of a class?) I largely followed a tutorial doing something very similar found here And cannot figure out what I am doing wrong.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!