• What are you working on? May 2012
    2,222 replies, posted
[QUOTE=Maurice;36079526]You mean, like, the map? [img]http://i.imgur.com/T7FYn.gif[/img] Like this? (Keep in mind this is not supposed to be splitscreen, just a marker to show where remote players are. It doesn't need to be playable)[/QUOTE] Seems like centering or scaling is a bit off. Shouldn't the ground in the circle and the ground in the main screen be the same height if they're at the same y position?
Currently trying to get A* to work. Made my own [URL="http://pastebin.com/UAjyL8cc"]Coordinate class[/URL] too. Am I doing anything wrong? I haven't really done any exception handling and operator overloading before. Edit: Added a z coordinate and corresponding functions.
[QUOTE=Armandur;36082305]Currently trying to get A* to work. Made my own [URL="http://pastebin.com/UAjyL8cc"]Coordinate class[/URL] too. Am I doing anything wrong? I haven't really done any exception handling and operator overloading before.[/QUOTE] I wish you luck, I wrestled with A* for a while and when I finally got it all working well it was a very satisfying feeling. Let me know if you have any questions on A* specifically, unfortunately can't help too much with C++ side of things.
[QUOTE=Armandur;36082305]Currently trying to get A* to work. Made my own [URL="http://pastebin.com/UAjyL8cc"]Coordinate class[/URL] too. Am I doing anything wrong? I haven't really done any exception handling and operator overloading before. Edit: Added a z coordinate and corresponding functions.[/QUOTE] You storing x,y,z as double and in your == operator you just comparing them with == which is wrong in floating point number comparison because of the precision stuff. Instead use an epsilon thing. like if ( x - other.x > epsilon ) return false;
if you handle the exception in the same method it doesnt really make sense to throw it, just put the cout in the else block [code] double Coordinate::operator[](int i) { try { if(i == 0) { return x; } else if(i == 1) { return y; } else if(i == 2) { return z; } else { throw "Coordinate index is out of bounds"; } } catch (char *str) { std::cout << str << std::endl; return -1; } } [/code]
Does anyone know if there is any openGL command or way to force Software rendering?
[QUOTE=burak575;36082573]You storing x,y,z as double and in your == operator you just comparing them with == which is wrong in floating point number comparison because of the precision stuff. Instead use an epsilon thing. like if ( x - other.x > epsilon ) return false;[/QUOTE] What is wrong with me storing x,y and z as doubles? Shouldn't I be able to have coordinates like {1.2, 3.0,5.5} Could you elaborate on how the epsilon comparison works?
Oh hey, since open.gl is up (I know I'm late, shush), I could finally try game deve-- [img]http://s.horsedrowner.net/NANO/Capture/201205242256096471-847x372.jpg[/img] Oh well, at least I got the base compiling and running with SDL and GLEW. Not with Unicode but that's probably something else I'm doing wrong. [img]http://s.horsedrowner.net/NANO/Capture/201205242257191271-486x138.jpg[/img] Looking forward to the next part if/when it comes. Until then, I'll get back to not working on other projects.
I redid my rightclick menus to include real elements (like scrollbars, checkboxes and buttons), added multiple input support for entities and redid the linktool (it's now part of the rightclick menu). [img]http://i.imgur.com/YQHm0.png[/img] The code for that rightclick menu is [code]rightclickmenues["funnelright"] = {{t="text", value="speed:"}, {t="scrollbar", starti=funnelminspeed, endi=funnelmaxspeed}, {}, {t="checkbox", text="reverse"}, {t="checkbox", text="default off"}, {}, {t="linkbutton", value="link reverse", link="reverse"}, {t="linkbutton", value="link power", link="power"}}[/code] Simple enough.
Hm looks like my climbing code isn't working properly yet, [video=youtube;aqRUHA5Y1QE]http://www.youtube.com/watch?v=aqRUHA5Y1QE[/video]
[QUOTE=Richy19;36082720]Does anyone know if there is any openGL command or way to force Software rendering?[/QUOTE] Of course, simply disable hardware acceleration by choosing a pixel format that doesn't support it. This can be done with the [url=http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt]WGL_ARB_pixel_format[/url] extension.
[QUOTE=Armandur;36082734]What is wrong with me storing x,y and z as doubles? Shouldn't I be able to have coordinates like {1.2, 3.0,5.5} Could you elaborate on how the epsilon comparison works?[/QUOTE] Its not the problem storing, problem is only in comparing operator. Floating point operations are not yields same stuff all times. like some times you can get 4.500001 sometimes 4.4999999 comparing these two values with regular == operator will return false. by comparing with an epsilon you just subtract these two numbers like 4.500001 - 4.4999999 result will be 0.0000011 . so you will pick a small number like 0.000001 or how much precision you want in your comparing. and compare if this value is bigger than the epsilon you picked. in this case in your code comparing 4.500001 with 4.4999999 will yield false. but 4.500001 - 4.4999999 > 0.0001 will yield true. if you planning to have negative numbers you should compare it too. in your case I would do this; [CODE] double Distance( const Coordinate& other ) { double dx = x - other.x; double dy = y - other.y; double dz = z - other.z; return sqrt( dx * dx + dy * dy + dz * dz ); } and in operator == double dist = Distance( other ); if ( dist > epsilon ) { return false; } return true; [/CODE] IIRC there was optimized stuff but this is probably work in most platforms without problems. Although it maybe become slower if you going to compare mllions of cordinates per second. more read: [URL]http://stackoverflow.com/questions/10334688/how-dangerous-is-it-to-compare-floating-point-values[/URL] [URL]http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html[/URL]
[QUOTE=burak575;36083168]Its not the problem storing, problem is only in comparing operator. Floating point operations are not yields same stuff all times. like some times you can get 4.500001 sometimes 4.4999999 comparing these two values with regular == operator will return false. by comparing with an epsilon you just subtract these two numbers like 4.500001 - 4.4999999 result will be 0.0000011 . so you will pick a small number like 0.000001 or how much precision you want in your comparing. and compare if this value is bigger than the epsilon you picked. in this case in your code comparing 4.500001 with 4.4999999 will yield false. but 4.500001 - 4.4999999 > 0.0001 will yield true. if you planning to have negative numbers you should compare it too. in your case I would do this; IIRC there was optimized stuff but this is probably work in most platforms without problems. Although it maybe become slower if you going to compare mllions of cordinates per second.[/QUOTE] Thanks :) Is that what is called the Manhattan distance (or something), by the way?
Absolute epsilon comparisons are not a good idea, especially with coordinates. Have a look at [url=http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm]this[/url] page for better ways.
[QUOTE=Armandur;36083213]Thanks :) Is that what is called the Manhattan distance (or something), by the way?[/QUOTE] No, his is a variation on the Euclidean distance. Manhattan distance just adds the differences along each of the dimensions.
[img]http://puu.sh/wzPL[/img] I like chiptunes. Unfortunately, the format of the ModArchive torrent is so chaotic. It goes like this: \Year\<first letter>\<first and second letter>.zip\<full name of music module>.mod.zip Not to mention the pack was made on *nix, meaning I have case insensitive files like 1992.mod.zip and 1992.MOD.zip causing problems. I just put those in a temp folder and hope I don't have triples. There's 122,177 tunes in the 2007 folder alone.
[QUOTE=AntonioR;36080852]Imagine German+Japanese genes... überefficiency.[/QUOTE] Danke arigato, Mr. Roboto.
Haven't posted in the thread for a while, but I'm trying to figure out collisions for the first time - here's today's progress :L Currently using two methods - one to push out any overlaps instantaneously while the circles intersect, second to use inverse Newtonian physics to repel the spheres when they are inside each other. Webm: [vid]http://dl.dropbox.com/u/26379807/javaw%202012-05-24%2022-53-33-67.webmvp8.webm[/vid]
[QUOTE=Overv;36083221]Absolute epsilon comparisons are not a good idea, especially with coordinates. Have a look at [url=http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm]this[/url] page for better ways.[/QUOTE] I think, it depends. If your coordinate system uses metric unit like 1.0f is equal to 1 meter, a millimeter precision is good enough for most applications. Which is 0.001 for epsilon. But yeah relative comparison is better. and here is another algorithm from c++ faq: [CODE] inline bool isEqual(double x, double y) { const double epsilon = /* some small number such as 1e-5 */; return std::abs(x - y) <= epsilon * std::abs(x); // see Knuth section 4.2.2 pages 217-218 } [/CODE] [url]http://www.parashift.com/c++-faq-lite/new/floating-point-arith.html[/url]
How on earth did floating point numbers manage to become the dominant datatype when fixed point numbers are more accurate and don't require special hardware?
I prefer fixed point numbers more too, but with floats you can represent a more accurate small number (something a lot of people might find beneficial for some reason).
Got an 'Introduction to Programming' exam tomorrow. I think I might be okay if I do a decent amount of revision. Anyway adding water to the San Andreas world viewer. Just remembered to my dismay that you can get waves.
Phyzicle Sandbox is featured in BlackBerry App World :eng101: [img]http://i.imgur.com/GbqkU.jpg[/img]
[QUOTE=Ziks;36083737]Got an 'Introduction to Programming' exam tomorrow. I think I might be okay if I do a decent amount of revision. Anyway adding water to the San Andreas world viewer. Just remembered to my dismay that you can get waves.[/QUOTE] Same here, mine is in python and is literrally intro stuff, like write down a program that counts all vowels in a string or something like that. Had my OOP test last tuesday and that was java and harder but also went pretty well :D [editline]24th May 2012[/editline] BTW has anyone used or even know of Poco library? [url]http://pocoproject.org/[/url] it seems to have lots of varied and useful classes. I found it while looking for a networking library
[QUOTE=Richy19;36083847]Same here, mine is in python and is literrally intro stuff, like write down a program that counts all vowels in a string or something like that. Had my OOP test last tuesday and that was java and harder but also went pretty well :D [editline]24th May 2012[/editline] BTW has anyone used or even know of Poco library? [url]http://pocoproject.org/[/url] it seems to have lots of varied and useful classes. I found it while looking for a networking library[/QUOTE] Didn't used but investigated a little bit, looks promising and class names are like .net framework's.
[QUOTE=Maurice;36082820]I redid my rightclick menus to include real elements (like scrollbars, checkboxes and buttons), added multiple input support for entities and redid the linktool (it's now part of the rightclick menu). [img]http://i.imgur.com/YQHm0.png[/img] The code for that rightclick menu is [code]rightclickmenues["funnelright"] = {{t="text", value="speed:"}, {t="scrollbar", starti=funnelminspeed, endi=funnelmaxspeed}, {}, {t="checkbox", text="reverse"}, {t="checkbox", text="default off"}, {}, {t="linkbutton", value="link reverse", link="reverse"}, {t="linkbutton", value="link power", link="power"}}[/code] Simple enough.[/QUOTE] It's like your trying to make all my cool features obsolete Just make sure there's text entries and buttons that run functions
Got a silly question, but how do you hook keyboard input for a directx game screen or whatever the heck needs to be done? I want to send key numpad 4 and 6 to a game. Feel free to rate me dumb, exactly how I feel right now because I've never ever attempted to do any hooking whatsoever.
[QUOTE=false prophet;36084130]Got a silly question, but how do you hook keyboard input for a directx game screen or whatever the heck needs to be done? I want to send key numpad 4 and 6 to a game. Feel free to rate me dumb, exactly how I feel right now because I've never ever attempted to do any hooking whatsoever.[/QUOTE] Two ways, use DInput which is not recommended or the WinAPI. Recommended way is the WinAPI.
[QUOTE=false prophet;36084130]Got a silly question, but how do you hook keyboard input for a directx game screen or whatever the heck needs to be done? I want to send key numpad 4 and 6 to a game. Feel free to rate me dumb, exactly how I feel right now because I've never ever attempted to do any hooking whatsoever.[/QUOTE] Some of these stuff were involving DLL injecting. If this is a steam game it could be vac banned if considered as cheat. Other than that you could find window with FindWindow api and window name like "Garry's Mod" from window name parameter. and send key down and key up messages via SendMessage api. Things you should look over msdn; FindWindow SendMessage WM_KEYDOWN WM_KEYUP Theoretically, it [I]should[/I] work if game is taking input from window event loop. Didn't tried before.
I've tried Send and PostMessage, didn't work. Spy++ says it was posting WM_KEYDOWN but whenever I would send the key nothing happened.
Sorry, you need to Log In to post a reply to this thread.