• What are you working on? December 2011 Edition
    3,353 replies, posted
All OpenGL gurus, just a quick question, I'm writing some OpenGL code with C++ and I had originally planned to go with a separate Shader and ShaderProgram class, but it seems irrational and that if I put all the code in ShaderProgram it saves time and makes things a bit tidier. I'm not sure what to do, any advice?
[img]http://i.imgur.com/R5YpW.png[/img] :D That wasn't as hard as I expected :) still need to add return values though. Also, function arguments are passed globally, so calling a function in x sets x to the argument value everywhere it's referred to. I was thinking of a stack of dictionaries to complement the call stack, where new local var entries "obscure" those below? Would get pretty crazy though, I need to stop using VB :v: [editline]9th December 2011[/editline] It supports recursion as well, I'd show that but it's off to school now.
[QUOTE=amcfaggot;33638486]Box2D polygon, problem solved, name me your physics spirit[/QUOTE] [img]http://dl.dropbox.com/u/45554193/images/BOXES%20ARGGHHG.png[/img]
[QUOTE=ZenX2;33638560][img]http://dl.dropbox.com/u/45554193/images/BOXES%20ARGGHHG.png[/img][/QUOTE] Here's what we did for a game we were working on at work to solve this problem: [img]http://i.imgur.com/GuX1b.png[/img]
Does anyone else think this looks like an optical illusion? [img]http://i.imgur.com/8psxk.png[/img] They are perfectly straight. Only turned 45 degrees. [editline]9th December 2011[/editline] Fixed it btw. I'm building my own Isometric Tower Defense, instead of using the thing from the tutorial. His project is overcomplicated. [img]http://i.imgur.com/9xzSz.png[/img]
How do you guys stop from losing motivation? I know my game could be awesome if I worked at it but I just open the code, look at what needs to be done, sigh, and close it. It sucks.
[QUOTE=Asgard;33638926]Does anyone else think this looks like an optical illusion? [img]http://i.imgur.com/8psxk.png[/img] They are perfectly straight. Only turned 45 degrees. [editline]9th December 2011[/editline] Fixed it btw. I'm building my own Isometric Tower Defense, instead of using the thing from the tutorial. His project is overcomplicated. [img]http://i.imgur.com/9xzSz.png[/img][/QUOTE] Isometric is usually for ever 1px on the y axis you do 2px on the x axis, where as your's is 1px:1px. [QUOTE=Yogurt;33639043]How do you guys stop from losing motivation? I know my game could be awesome if I worked at it but I just open the code, look at what needs to be done, sigh, and close it. It sucks.[/QUOTE] I do the same most of the time, the only way I've been able to get any work done is by force, just be like, "nope, I'm fucking doing this shit now!" and keep saying it to yourself.
Having a lot of trouble getting sound into a webm file. I'm encoding it fine (I think). But the timings seem to be completely off. I have a feeling I have to multiply something by 1000000ULL (which I had to do to get the video working). But it's trial and error right now. blarghhh. You'd think since they wanted this to be the main codec for the web they'd have a working example that sets all this stuff up and does it. I mean, actually vp8'ing the video and then vorbising the audio and then putting it all in a webm. But they don't. Their only example is taking one webm file and making a new webm file out of it. Fuckers.
[QUOTE=TVC;33639078]Isometric is usually for ever 1px on the y axis you do 2px on the x axis, where as your's is 1px:1px. [/QUOTE] I too was looking at it... The sprite itself is fine, and I'm not doing anything weird when I am placing it. [editline]9th December 2011[/editline] Turns out, I am. Fixed! [editline]9th December 2011[/editline] This better? [img]http://i.imgur.com/Y1YT1.png[/img]
[QUOTE=ZenX2;33638458] *Image containing statements about troubles with slopes*[/QUOTE] Perhaps this may help a bit, I stumbled on this a while ago: [url]http://www.tonypa.pri.ee/tbw/tut24.html[/url] Note that this is a series of tutorials, so it may be easier if you went back to the previous sections and skim through them a bit. Hope this helps. ;D [editline]9th December 2011[/editline] [QUOTE=Yogurt;33639043]How do you guys stop from losing motivation? I know my game could be awesome if I worked at it but I just open the code, look at what needs to be done, sigh, and close it. It sucks.[/QUOTE] I have the same problem, so you're not alone. Some things that motivate me though are seeing other projects on here and reddit. As well as thinking about successful indie titles, and the work that had to be put in, no matter how boring or frustrating it had to have been. I also sometimes check out some of these things here: [url]http://www.reddit.com/r/GetMotivated/[/url]
[vid]http://dl.dropbox.com/u/4093439/textboximprovements.webm[/vid] Working on the UI some more. Textboxes can now "scroll" so instead of the text going off the edge, you just scroll ALL OVER THE PLACE. You can also copy-paste into textboxes. Next up is a horizontal scrollbar for Listboxes so that they don't just scale to fit the text inside of them. Then I'll make that little blinky thing inside textboxes moveable, so you can type in certain places. Then I'll make it so you can select whole areas of text. Fun. It feels REALLY good to finally get some stuff done again.
Which jars should I use for Slick?
[QUOTE=dije;33639496]Which jars should I use for Slick?[/QUOTE] I always build Slick from source from cokeandcode's SVN. [url]https://bob.newdawnsoftware.com/repos/slick/trunk/[/url]
100% in my AS Computing mock... 5% In my physics end of unit test... Think I need to prioritise. So, I'll post some content up this weekend possibly and then that'll be my coding gone for a little bit... Not that I post content in here anyway.
Working on lua controlled entities today. Never used lua much before, so i tried to mimic gmod :v: Is my code any good? [CODE]vy = 0 jumpSpeed = 10 direction = 0 function ENT:Init() self:setName("unnamed"); self:setTexture("resources/default/gfx/luigi.png"); self:move(150,150); self:setHeight(48); end function ENT:Update() if direction == 0 then self:moveR(1,0); end if direction == 1 then self:moveR(-1,0); end --Random chance between 1 and 50 to jump random = math.random(50) if vy > 0 then self:moveR(0, -vy) vy = vy - 1 end if random == 2 then print("Jump in da air"); vy = jumpSpeed self.inAir = true end --Random chance between 1 and 120 to change direction changeDirection = math.random(120) if changeDirection == 50 then if direction > 0 then direction = 0 end if direction < 1 then direction = 1 end print("Direction change"); end --change direction if close to end of level if self:getX() < 10 then direction = 0 end end[/CODE] In the game it looks like this (lua entity is luigi): [vid]http://olavthoresen.com/files/video/luaent.webm[/vid]
[QUOTE=Whitefox08;33621341]I just started learning C++ and quite frankly its great, Today's task was to learn Arrays and using Sort [cpp] #include<iostream> #include<algorithm> #include<time.h> using namespace std; int main() { // code sort(ar1,ar1+100); cout<<"Sorted: "; for(int v = 0;v < 100; v++) { cout<<ar1[v]<<" "; } // code } [/cpp] [/QUOTE] Woah, I never knew about the 'algorithm' library; thanks!
[QUOTE=Robber;33639760]I always build Slick from source from cokeandcode's SVN. [url]https://bob.newdawnsoftware.com/repos/slick/trunk/[/url][/QUOTE] What's Slick for Android like? Anyone tried it out? I had a great idea for a droid game the other day, and it'd be awesome if I could work with something I'm already comfortable using.
[QUOTE=olavst;33640758]Working on lua controlled entities today. Never used lua much before, so i tried to mimic gmod :v: Is my code any good?[/QUOTE] You're using globals instead of members. This means that if you make 2 of these entities they'll be controlled using the same variables. Also if you set direction to -1 if he's moving left, direction to 1 if he's moving right.. then you don't need the if's at the top.
A self-balancing (AVL-like) bounding volume hierarchy with a sort of volume-minimization heuristic for insertion. In Javascript + HTML5 (it's actually pretty nice for prototyping). [IMG_thumb]http://img853.imageshack.us/img853/5042/selfbalancingbvh.png[/IMG_thumb] [IMG_thumb]http://img27.imageshack.us/img27/7044/selfbalancingbvh2.png[/IMG_thumb] Most of the results are [i]OK[/i], but occasionally balancing the tree produces really sub-optimal results. Without the balancing it produces really excellent hierarchies for most inputs, but it's easy to find cases where it produces degenerate trees. :\
[QUOTE=garry;33640819]You're using globals instead of members. This means that if you make 2 of these entities they'll be controlled using the same variables.[/QUOTE] Correct: [vid]http://olavthoresen.com/files/video/luaent2.webm[/vid] :v: Edit: Using local variables fixed it [CODE]local vy = 0 local jumpSpeed = 10 local direction = 0[/CODE]
[QUOTE=Nigey Nige;33640809]What's Slick for Android like? Anyone tried it out? I had a great idea for a droid game the other day, and it'd be awesome if I could work with something I'm already comfortable using.[/QUOTE] I tried it out and never really got it working. :v:
[QUOTE=ROBO_DONUT;33640906]A self-balancing (AVL-like) bounding volume hierarchy with a sort of volume-minimization heuristic for insertion. In Javascript + HTML5 (it's actually pretty nice for prototyping). [IMG_thumb]http://img853.imageshack.us/img853/5042/selfbalancingbvh.png[/IMG_thumb] [IMG_thumb]http://img27.imageshack.us/img27/7044/selfbalancingbvh2.png[/IMG_thumb] Most of the results are [i]OK[/i], but occasionally balancing the tree produces really sub-optimal results. Without the balancing it produces really excellent hierarchies for most inputs, but it's easy to find cases where it produces degenerate trees. :\[/QUOTE] circles
Anyone else unable to load this page in Chrome? It works fine in Firefox but it causes Chrome to crash.
[QUOTE=ROBO_DONUT;33640906]A self-balancing (AVL-like) bounding volume hierarchy with a sort of volume-minimization heuristic for insertion. In Javascript + HTML5 (it's actually pretty nice for prototyping). [IMG_thumb]http://img853.imageshack.us/img853/5042/selfbalancingbvh.png[/IMG_thumb] [IMG_thumb]http://img27.imageshack.us/img27/7044/selfbalancingbvh2.png[/IMG_thumb] Most of the results are [i]OK[/i], but occasionally balancing the tree produces really sub-optimal results. Without the balancing it produces really excellent hierarchies for most inputs, but it's easy to find cases where it produces degenerate trees. :\[/QUOTE] Could you explain what it actually is? It looks really interesting
[QUOTE=ZenX2;33638458]* Stuff regarding slopes *[/QUOTE] [URL="http://www.mediafire.com/?3d6tk67ppq3h4lb"]This is the best SAT tutorial I've ever read.[/URL] The author basically walks you through all the phases of SAT and provides his solutions to them in the article. The only thing that is required is basic knowledge of the dot product and knowledge of basic vector math.(addition,subtraction,scale,normalize) In the article you are asked to make a convex hull class,you can generate the the convex hull either clock wise or counter clock wise. It is very important that you stick to one convention as the edge normals will change direction if you alternate between those two conventions.Sticking to one convention is VERY important if you want to write your own physics later. SAT is useful because it allows you to test pairs of convex polygons,however SAT is expensive , so i highly recommend that you implement some kind of neighbor searching algorithm to reduce the SAT calls. The article is simple to grasp and even if you dont understand SAT right away, you could still just copy the code in the article. After you write SAT a couple of times I guarantee you will start to understand how it works. There are still many optimizations for SAT for certain shapes like Boxes or Circles. There is a tutorial on SAT optimizations by the people who made the game (N+ or whatever its called). Just Google SAT and your bound to end up on their page.
[IMG]http://i.imgur.com/2Bw9I.gif[/IMG] The left paddle seems to disappear instead of moving with the mouse. At least its moving,just a matter of time.
[QUOTE=Robber;33641319]I tried it out and never really got it working. :v:[/QUOTE] So I actually have to learn to code without three layers of other people's libraries? [img]http://i.imgur.com/kQabS.jpg[/img]
[QUOTE=garry;33639088]Having a lot of trouble getting sound into a webm file. I'm encoding it fine (I think). But the timings seem to be completely off. I have a feeling I have to multiply something by 1000000ULL (which I had to do to get the video working). But it's trial and error right now. blarghhh. You'd think since they wanted this to be the main codec for the web they'd have a working example that sets all this stuff up and does it. I mean, actually vp8'ing the video and then vorbising the audio and then putting it all in a webm. But they don't. Their only example is taking one webm file and making a new webm file out of it. Fuckers.[/QUOTE] I found it massively impressive you were able to get just the video part working, really. That is, I'm assuming you used stock Source functions to get screen data and such, and then use that for the video part.
[QUOTE=Darwin226;33641680]Could you explain what it actually is? It looks really interesting[/QUOTE] [url=http://en.wikipedia.org/wiki/Bounding_volume_hierarchy]Bounding volume hierarchies[/url] are a structure used in collision detection and related problems. They can be used for [url=http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter06.html]occlusion culling in modern 3D games[/url], do k-nearest neighbor lookups, and they're used heavily in raytracing as a means to accelerate traces against complex polygonal models. I'm using BVHs in my game engine to store drawable items so that they can quickly be tested and culled when drawing. At the moment, though, my implemention is really lazy, so I'm prototyping and testing in Javascript before I incorporate anything into my actual code. BVHs can be constructed either by repeated partitioning/grouping of elements in a predetermined set (offline methods) or by inserting elements one-by-one (online method). Obviously the offline methods tend to produce better results, but the online method affords greater flexibility, so I'm trying a few different ideas I had for online construction of a BVH here.
[QUOTE=ROBO_DONUT;33642157][url=http://en.wikipedia.org/wiki/Bounding_volume_hierarchy]Bounding volume hierarchies[/url] are a structure used in collision detection and related problems. They can be used for [url=http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter06.html]occlusion culling in modern 3D games[/url], do k-nearest neighbor lookups, and they're used heavily in raytracing as a means to accelerate traces against complex polygonal models. I'm using BVHs in my game engine to store drawable items so that they can quickly be tested and culled when drawing. At the moment, though, my implemention is really lazy, so I'm prototyping and testing in Javascript before I incorporate anything into my actual code. BVHs can be constructed either by repeated partitioning/grouping of elements in a predetermined set (offline methods) or by inserting elements one-by-one (online method). Obviously the offline methods tend to produce better results, but the online method affords greater flexibility, so I'm trying a few different ideas I had for online construction of a BVH here.[/QUOTE] Does it perform better than a simple grid if the objects that can collide are smaller than a grid cell? Because as far sad I can see, the benefit is that it first tests a group of objects against another group and if there's no collision it doesn't cross test the children, but in a grid based system, the amount of objects culled if far greater.
Sorry, you need to Log In to post a reply to this thread.