• What Are You Working On? V13
    5,003 replies, posted
[QUOTE=geel9;25596013]——it's near impossible to cheat.[/QUOTE] Say, where have I seen this before?
[QUOTE=esalaka;25596185]Say, where have I seen this before?[/QUOTE] Somewhere where I didn't research it properly.
WHAT THE HELL Box2D is a fucking piece of shit. Their 'manual' isn't up to date and the code in it doesn't compile. Also, they make you intialize b2World in a ctor, and you can't do it in your own little init function. GAAHHHHH Is there anyway to reinit a object in a constructor? I have this [cpp] class blah { private: //blah b2World box_world; }; blah::blah() { box_world = new b2World(gravity, sleep); } [/cpp] Yet I just get some crap about the operator= only able to be assigned to a b2World. help
Oh god the AS3 docs are even worse. [editline]23rd October 2010[/editline] For Box2D, that is
Should I just switch to Chipmunk or something? Box2D is just a mess.
[QUOTE=neos300;25596816]WHAT THE HELL Box2D is a fucking piece of shit. Their 'manual' isn't up to date and the code in it doesn't compile. Also, they make you intialize b2World in a ctor, and you can't do it in your own little init function. GAAHHHHH Is there anyway to reinit a object in a constructor? I have this [cpp] class blah { private: //blah b2World box_world; }; blah::blah() { box_world = new b2World(gravity, sleep); } [/cpp] Yet I just get some crap about the operator= only able to be assigned to a b2World. help[/QUOTE] You are trying to assign a value of type b2World* (pointer to b2World) to a variable of type b2World. Line 5 should be: [cpp] b2World *box_world;[/cpp]
[QUOTE=MakeR;25597265]You are trying to assign a value of type b2World* (pointer to b2World) to a variable of type b2World. Line 5 should be: [cpp] b2World *box_world;[/cpp][/QUOTE] That kind of worked, except now whenever is use one of box_world's methods I have to use -> instead of . Is that going to mess me up?
[QUOTE=neos300;25598679]That kind of worked, except now whenever is use one of box_world's methods I have to use -> instead of . Is that going to mess me up?[/QUOTE] I can't see why you didn't just reinitialize it by box_world = b2World( gravity, sleep );
[media]http://www.youtube.com/watch?v=7nB6fXI87bQ[/media] tried to make a little video but it doesn't really show off everything I wanted to show :( the title and description isn't updating for some reason and it's not in wide screen, how long does that normally take? Oh, I must have captured on a smaller window.
[QUOTE=layla;25598987][media]http://www.youtube.com/watch?v=7nB6fXI87bQ[/media] tried to make a little video but it doesn't really show off everything I wanted to show :( the title and description isn't updating for some reason and it's not in wide screen, how long does that normally take?[/QUOTE] Very nice!
That's awesome! Are those textures from Source?
[QUOTE=esalaka;25598908]I can't see why you didn't just reinitialize it by box_world = b2World( gravity, sleep );[/QUOTE] I'm an idiot. Problem solved. Thank you very much! Fffffffffffff it didn't work. Still getting: error: no matching function for call to 'b2World::b2World()' note: candidates are: b2World::b2World(const b2Vec2&, bool) note: b2World::b2World(const b2World&)
This probably seems like nothing to you guys, but I finally managed to get DirectX to draw to a child window inside the main window. [IMG]http://i902.photobucket.com/albums/ac222/ScreenNamesSuck/ChildWindowSuccess.png[/IMG] I wrote most of my C++ code from scratch.
Just compiled a release version of my game: [quote]Unhandled exception at 0x7550b727 in RTAdventure.exe: Microsoft C++ exception: std::length_error at memory location 0x0041f888..[/quote] :eng99: I have no idea why this happens in release, but not in debug...
[QUOTE=neos300;25600047]I'm an idiot. Problem solved. Thank you very much! Fffffffffffff it didn't work. Still getting: error: no matching function for call to 'b2World::b2World()' note: candidates are: b2World::b2World(const b2Vec2&, bool) note: b2World::b2World(const b2World&)[/QUOTE] Okay, I noticed you don't seem to be using an initializer list, which will help you, so you [i]don't[/i] have to use "->" over "." (Though technically object->member is like doing (*object).member, but that's pedantry at this point). Here's an example. [cpp] class blah { public: /* I don't know what Box2D takes so I'm just guessing :V*/ explicit blah(const b2Vec2& gravity, bool sleep) : box_world(b2World(gravity, sleep)) { } private: b2World box_world; }; [/cpp] If that doesn't work, you can #include <memory> and make it an "auto_ptr<b2World> box_world". The wonders of C++. :smith: [QUOTE=BlkDucky;25600179]Just compiled a release version of my game: I have no idea why this happens in release, but not in debug...[/QUOTE] You should be able to add debug info for a release build. You won't get full introspection (am I using that word right? I've never had the opportunity), but you'll be able to see where it's happening.
[QUOTE=VeryNiceGuy;25600034]That's awesome! Are those textures from Source?[/QUOTE] Yeah but I wrote BLOCK 512 X 512 over them
[QUOTE=esalaka;25595804]This would be interesting if it could be used for open games that have no central servers. [editline]24th October 2010[/editline] Also, how about a P2P approach? :3:[/QUOTE] I don't really see how I could do a P2P approach could make it much more efficient, and it would make it a lot more complex.
[QUOTE=Chandler;25600270]Okay, I noticed you don't seem to be using an initializer list, which will help you, so you [i]don't[/i] have to use "->" over "." (Though technically object->member is like doing (*object).member, but that's pedantry at this point). Here's an example. code If that doesn't work, you can #include <memory> and make it an "auto_ptr<b2World> box_world". The wonders of C++. :smith:[/QUOTE] Neither worked. :smithicide: It still says: error: no matching function for call to 'b2World::b2World()' note: candidates are: b2World::b2World(const b2Vec2&, bool) note: b2World::b2World(const b2World&) when I have box_world = b2World(box_gravity, box_sleep);
[QUOTE=layla;25598987][media]http://www.youtube.com/watch?v=7nB6fXI87bQ[/media] tried to make a little video but it doesn't really show off everything I wanted to show :( the title and description isn't updating for some reason and it's not in wide screen, how long does that normally take? Oh, I must have captured on a smaller window.[/QUOTE] Thats fantastic! If you don't mind me asking, what engine/API did you use to write that?
[QUOTE=noctune9;25600349]I don't really see how I could do a P2P approach could make it much more efficient, and it would make it a lot more complex.[/QUOTE] Not necessarily efficient but decentralized. You would'n need to query some central server for every request when there's peers to share the information about servers to you.
[QUOTE=Kopimi;25600706]Thats fantastic! If you don't mind me asking, what engine/API did you use to write that?[/QUOTE] It's a custom built game using OpenGL.
[QUOTE=esalaka;25600772]Not necessarily efficient but decentralized. You would'n need to query some central server for every request when there's peers to share the information about servers to you.[/QUOTE] But you'd need a central server to find the peers.
[QUOTE=geel9;25600902]But you'd need a central server to find the peers.[/QUOTE] I know, but regardless of which method you use, you [B]still[/B] need a central server or few. It was just a suggestion.
[QUOTE=esalaka;25600997]I know, but regardless of which method you use, you [B]still[/B] need a central server or few. It was just a suggestion.[/QUOTE] Although I do get your point, lessen the main server load.
[QUOTE=neos300;25596816]WHAT THE HELL Box2D is a fucking piece of shit. Their 'manual' isn't up to date and the code in it doesn't compile. Also, they make you intialize b2World in a ctor, and you can't do it in your own little init function. GAAHHHHH Is there anyway to reinit a object in a constructor? I have this [cpp] class blah { private: //blah b2World box_world; }; blah::blah() { box_world = new b2World(gravity, sleep); } [/cpp] Yet I just get some crap about the operator= only able to be assigned to a b2World. help[/QUOTE] [cpp]class blah { public: blah():box_world(b2Vec(0, 0), true){} void init(const b2Vec &gravity, const bool sleep){ box_world = b2World(gravity, sleep); } private: b2World box_world; };[/cpp] Or if that doesn't work [cpp]class blah { public: void init(const b2Vec &gravity, const bool sleep){ box_world = new b2World(gravity, sleep); } private: std::auto_ptr<b2World> box_world; };[/cpp] and access b2World-members via -> or [cpp]class blah { public: void init(const b2Vec &gravity, const bool sleep){ box_world = std::auto_ptr<b2World>(new b2World(gravity, sleep)); } b2World& getWorld(){ return *box_world; } private: std::auto_ptr<b2World> box_world; };[/cpp] and access via getWorld().member.
Exceptions in C++ aren't the best. But sometimes, I question whether I should just use them. Otherwise I end up doing something reckless, and dangerous. :smithicide: [cpp] namespace { std::pair<std::vector<std::string>, std::vector<std::string> > get_items(const std::string& path) { /* once you herp, you just can't */ DIR* dirp = NULL; dirent* direntp = NULL; std::vector<std::string> file_list; std::vector<std::string> path_list; if (!(dirp = opendir(path.c_str()))) { goto finalize; } while (!(direntp = readdir(dirp))) { switch (direntp->d_type) { case DT_DIR: path_list.push_back(direntp->d_name); break; case DT_REG: file_list.push_back(direntp->d_name); break; case DT_LNK: char buffer[MAXPATHLEN + 1]; ssize_t length = readlink(direntp->d_name, buffer, MAXPATHLEN + 1); // symlink_list.push_back(std::string(buffer, length)); break; case default: break; } } finalize: return std::pair(file_list, path_list); } } /* internal linkage */ [/cpp] I may just end up throwing an exception instead :colbert:
[QUOTE=ZeekyHBomb;25601388][cpp]class blah { public: blah():box_world(b2Vec(0, 0), true){} void init(const b2Vec &gravity, const bool sleep){ box_world = b2World(gravity, sleep); } private: b2World box_world; };[/cpp] Or if that doesn't work [cpp]class blah { public: void init(const b2Vec &gravity, const bool sleep){ box_world = new b2World(gravity, sleep); } private: std::auto_ptr<b2World> box_world; };[/cpp] and access b2World-members via -> or [cpp]class blah { public: void init(const b2Vec &gravity, const bool sleep){ box_world = std::auto_ptr<b2World>(new b2World(gravity, sleep)); } b2World& getWorld(){ return *box_world; } private: std::auto_ptr<b2World> box_world; };[/cpp] and access via getWorld().member.[/QUOTE] The second method just gives me operator= errors
[QUOTE=Chandler;25601558]Exceptions in C++ aren't the best. But sometimes, I question whether I should just use them. Otherwise I end up doing something reckless, and dangerous. :smithicide: [cpp]/*codesnip*/[/cpp] I may just end up throwing an exception instead :colbert:[/QUOTE] [cpp]namespace { typedef std::pair<std::vector<std::string>, std::vector<std::string> > Itemspair; Itemspair get_items(const std::string& path) { /* once you herp, you just can't */ Itemspair itemspair; //construct the pair directly if (DIR* dirp = opendir(path.c_str()) { dirent* direntp; while (!(direntp = readdir(dirp))) //you sure you want to negate that expression? { switch (direntp->d_type) { case DT_DIR: itemspair.first.push_back(direntp->d_name); break; case DT_REG: itemspair.second.push_back(direntp->d_name); break; case DT_LNK: char buffer[MAXPATHLEN + 1]; ssize_t length = readlink(direntp->d_name, buffer, MAXPATHLEN + 1); // symlink_list.push_back(std::string(buffer, length)); break; case default: break; } } } //no need to destruct dirp? return itempair; } } /* internal linkage */[/cpp] :3? [editline]24th October 2010[/editline] [QUOTE=neos300;25601760]The second method just gives me operator= errors[/QUOTE] box_world = [b]std::auto_ptr<b2World>([/b]new b2World(gravity, sleep)[b])[/b]; } Also, from the looks of it you should read up a bit on pointers and heap allocation (operator new) as well as smart pointers.
Just wondering but is this book any good for learning OpenGL? [url]http://www.amazon.co.uk/OpenGL-Programming-Guide-Official-Learning/dp/0321552628/ref=sr_1_1?ie=UTF8&qid=1287875903&sr=8-1[/url]
[QUOTE=ZeekyHBomb;25601877][cpp]namespace { typedef std::pair<std::vector<std::string>, std::vector<std::string> > Itemspair; Itemspair get_items(const std::string& path) { /* once you herp, you just can't */ Itemspair itemspair; //construct the pair directly if (DIR* dirp = opendir(path.c_str()) { dirent* direntp; while (!(direntp = readdir(dirp))) //you sure you want to negate that expression? { switch (direntp->d_type) { case DT_DIR: path_list.push_back(direntp->d_name); break; case DT_REG: file_list.push_back(direntp->d_name); break; case DT_LNK: char buffer[MAXPATHLEN + 1]; ssize_t length = readlink(direntp->d_name, buffer, MAXPATHLEN + 1); // symlink_list.push_back(std::string(buffer, length)); break; case default: break; } } } //no need to destruct dirp? return itempair; } } /* internal linkage */[/cpp] :3? [editline]24th October 2010[/editline] box_world = [b]std::auto_ptr<b2World>([/b]new b2World(gravity, sleep)[b])[/b]; } Also, from the looks of it you should read up a bit on pointers and heap allocation (operator new) as well as smart pointers.[/QUOTE] There we go. Yeah the book I had for learning C++ basically said 'use references' Not much help.
Sorry, you need to Log In to post a reply to this thread.