• What Are You Working On? V13
    5,003 replies, posted
[QUOTE=neos300;25615380]I know that about header files, but here is whats in the header file: -code snip- ALL of that stuff is in b2Body.h And whenever I call GetPosition it just crashes on me.[/QUOTE] That's not a problem, it just means the member function will be inlined for extra performance in tight loops etc. If the "crash" is happening when you call that method, make sure you're not dereferencing a null or dangling pointer, or dereferencing a dangling reference. Run the debugger to see what actually causes the crash (and to make sure that's the line which actually causes it), e.g., a segfault/access violation.
[QUOTE=neos300;25615380]I know that about header files, but here is whats in the header file: [cpp] class b2Body { //stuff const b2Transform& GetTransform() const; //more stuff }; //stuff inline const b2Vec2& b2Body::GetPosition() const { return m_xf.position; } //even more stuff [/cpp] ALL of that stuff is in b2Body.h And whenever I call GetPosition it just crashes on me.[/QUOTE] are you using a static lib for box2D? Sometimes c++ compilers will output inline functions into lib's and will cause some instabilities more so when mixing compilers ( like using a dynamic link lib compiled in vs2005 inside a vs2003 project ). Not sure if really that could be the issue. But the inline sticks out to me, as a give away. Good to use __forceinline or __attribute__((always_inline)) inline for gcc
[QUOTE=jA_cOp;25614953]He's restarting the timer between filling and iteration, though? Also, when you see code like: [cpp] int b2 = 0; while(b2 < 1000) { ... ++b2; } [/cpp] You should really just do: [cpp] int b2 = 0; for(int b2 = 0; b2 < 1000; ++b2) { ... } [/cpp][/QUOTE] Yeah. Someone said that while loops are faster. Decided not to use for loops any more. Later, someone said that they weren't faster but since it's in my habit to use while I never switched back. It's not like I'm losing readability of my code or anything since when you see int i = 0; while (i< something.Count) it's just as apparent that you are iterating over a collection as it would be with a for loop.
[QUOTE=Darwin226;25615640]It's not like I'm losing readability of my code or anything since when you see int i = 0; while (i< something.Count) it's just as apparent that you are iterating over a collection as it would be with a for loop.[/QUOTE] Well, a for loop is [B]instantly[/B] more readable in some situations. And for example traversing a STL container is just done more simply IMO by using a for loop.
[QUOTE=Darwin226;25615640]Yeah. Someone said that while loops are faster. Decided not to use for loops any more. Later, someone said that they weren't faster but since it's in my habit to use while I never switched back.[/QUOTE] It produces exactly the same code, except the for-loop probably opens for better aggressive optimizations. Even if there was a difference, you shouldn't value performance over clarity in the vast majority of code. [QUOTE=Darwin226;25615640]It's not like I'm losing readability of my code or anything since when you see int i = 0; while (i< something.Count) it's just as apparent that you are iterating over a collection as it would be with a for loop.[/QUOTE] I don't agree. By using the for-loop you formalize the entire loop in one place, on one line. You don't have to look to the end of the loop to see the step, and you don't get variables in the wrong scope. The for-loop exists for exactly these kind of loops, if it was just as obvious, why would anyone use it, and why would languages include the for loop?
[QUOTE=Torquil;25615382]Should be spelt 'Align' in the top bar. Other than that, line numbers would be a nice touch, although I recall they are difficult to do.[/QUOTE]..Fixed the spelling and added a different kind of line numbering: [img]http://filesmelt.com/dl/GrooveUpdate4.PNG[/img] How's that?
Hey guys. Since I've got no responses yet, I thought I'd just drop this web programming question link here: [url]http://www.facepunch.com/showthread.php?1018215-Secure-Sessions-%28PHP-MySQL%29-for-a-Browser-MMO[/url] Thanks.
Awesome. Managed to compile some Raknet code. :woop: Now to figure out exactly what it all means and implement it into my game...
Any more suggestions for Groove while I'm finally in the mood to work on it?
[QUOTE=VeryNiceGuy;25617242]Any more suggestions for Groove while I'm finally in the mood to work on it?[/QUOTE] Syntax highlighting. :v: Edit: Maybe a spell-checker?
Spellchecker seems good, I'll contemplate that. :v:
[img]http://i55.tinypic.com/9pup1s.png[/img] (This is Textcraft ONLINE.)
[QUOTE=jA_cOp;25615768]It produces exactly the same code, except the for-loop probably opens for better aggressive optimizations. Even if there was a difference, you shouldn't value performance over clarity in the vast majority of code. I don't agree. By using the for-loop you formalize the entire loop in one place, on one line. You don't have to look to the end of the loop to see the step, and you don't get variables in the wrong scope. The for-loop exists for exactly these kind of loops, if it was just as obvious, why would anyone use it, and why would languages include the for loop?[/QUOTE] Yeah there's really no reason not to use a for look in that case. It makes everything less obvious for no reason in the majority of cases where looping will happen.
[QUOTE=VeryNiceGuy;25615283]More progress on Groove. [img_thumb]http://filesmelt.com/dl/GrooveUpdate3.PNG[/img_thumb][/QUOTE] plz turn on cleartype
Why does printf("Tickrate=>%d", g_SVarHandler.Get("s_tickrate")->Data); corrupt g_SVarHandler?
I finally solved all my problems, turns out my b2Body was just nulled. So I wrote a hacky loop to reassign all the entitys with bodys from their userdatas. I think this is going to kill me later on.....
[img]http://i56.tinypic.com/2yor992.png[/img] That's TextCraft online, loading an online item and recipe list and saving to an online account with built in security features!
[QUOTE=geel9;25618261][img_thumb]http://i56.tinypic.com/2yor992.png[/img_thumb] That's TextCraft online, loading an online item and recipe list and saving to an online account with built in security features![/QUOTE] That looks awesome. When are you going to release it? Have you already released a singleplayer version?
[QUOTE=neos300;25618448]That looks awesome. When are you going to release it? Have you already released a singleplayer version?[/QUOTE] The singleplayer version is DJ's textcraft, he and I are working on getting it online. we just need to do one thing and it'll be released.
[QUOTE=VeryNiceGuy;25615283]More progress on Groove. [img_thumb]http://filesmelt.com/dl/GrooveUpdate3.PNG[/img_thumb][/QUOTE] I haven't red a lot and sorry but were can i download this program of yours? <rate me dumb>
[img]http://k.imgkk.com/i/0/3ObGMv11/0tc0-r.png[/img] Is this right for a box2d simulation? Somehow I imagined it tipping off the bottom block.. (its holding on by 3 pixels...)
[QUOTE=bobiniki;25618860]I haven't red a lot and sorry but were can i download this program of yours? <rate me dumb>[/QUOTE] You can download it right [url="http://filesmelt.com/dl/Groove5.zip"]here![/url]
[QUOTE=bobiniki;25618860]I haven't red a lot and sorry but were can i download this program of yours? <rate me dumb>[/QUOTE] There are some beta releases a few pages back, [url=http://www.facepunch.com/showthread.php?p=25517281#post25517281]here is one of them (i think it's the latest)[/url] It's an old version, but it works if you can't wait. [editline].[/editline] Fuck, i read your quote wrong :v: :saddowns: Thought you meant textcraft :sigh:
[QUOTE=neos300;25619373][img_thumb]http://k.imgkk.com/i/0/3ObGMv11/0tc0-r.png[/img_thumb] Is this right for a box2d simulation? Somehow I imagined it tipping off the bottom block.. (its holding on by 3 pixels...)[/QUOTE] You are probably not syncing the visual boxes with Box2D's boxes correctly, because the top box should definitely fall off from there.
[QUOTE=ZeekyHBomb;25612080] btw, no need to initialize dirp and direntp to NULL. In fact, you could initialize dirp straight away with opendir(path.c_str()). [/QUOTE] Actually, I can't. There's a bug with FreeBSD where initializing it inside of the if scope makes it unavailable to everything within it. It's extremely weird, but I did try it your way (it works, until you want to release some resources, then everything decides to go to the Bahamas, and never come back.)
[QUOTE=Z_guy;25620067]You are probably not syncing the visual boxes with Box2D's boxes correctly, because the top box should definitely fall off from there.[/QUOTE] Yeah, apparently I need to set the center of the SFML box to something else(default ain't good enough). Do you know what I need to set it too? Also I needed to convert degrees to radians for the rotation. Check my algorthims please? float rad = degrees * PI / 180; float deg = radians * 180 / PI;
[QUOTE=neos300;25620417]Yeah, apparently I need to set the center of the SFML box to something else(default ain't good enough). Do you know what I need to set it too? Also I needed to convert degrees to radians for the rotation. Check my algorthims please? float rad = degrees * PI / 180; float deg = radians * 180 / PI;[/QUOTE] The default "center" in SFML is (0,0), aka the top left corner of the sprite (the box in this case). You need to set it to the actual center, by doing box.SetCenter(box.GetSize()/2.f); where box is the name of the sprite. Your degree-radian algorithms are correct.
Speaking of textcraft, should we make time serverside, or clientside?
We've decided upon clientside, silly goose!
That was really gay geel.
Sorry, you need to Log In to post a reply to this thread.