Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Oct 2005
Offline Last Active Nov 28 2015 10:19 AM

#5220751 Anyone got any ideas where 4k a sec is coming from?

Posted by deftware on 01 April 2015 - 12:04 PM

you're not loading that explosion every frame are you?

#5219915 From scratch vs Unity

Posted by deftware on 28 March 2015 - 11:44 PM


 When you use an existing engine your creative freedom is confined to the engine designer's conception of what a game consists of. It's using a "solution". It is formulaic, and predictable because it is generalized to encompass common methods and techniques for producing a game experience. This is great for a few things, such as learning how games work and what goes on behind the scenes. Also it is great for someone with experience and know-how who can really 'work' an existing engine and produce something of professional quality in a time-efficient manner.


 Ultimately, those who do their own thing will be the ones who are most capable, and well-situated to actually make things move forward. They will evolve the conception of what a game can be, and then everybody will follow suit.


 Case-in-point: Minecraft popularized the voxel-esque block-world concept, and then suddenly everybody and their mom was making a block-world game. Correct me if I am wrong but I imagine that virtually all available engines at the time of Minecraft's development were confined to the world being some sort of heightmap or BSP tree. This is the type of limitation that stifles one's ability to think and create freely, outside the confines of someone else's idea of what a game is made of, or how it works.


 All-in-all, it comes down to preference. What someone wants to do, and how they want to do it.

#5212959 How do I know if I'm an intermediateprogramming level?

Posted by deftware on 25 February 2015 - 02:50 PM


#5199377 A few general questions to point me in the right direction

Posted by deftware on 21 December 2014 - 02:10 AM

the glow effect is usually either a part of a sprite texture (additively blend a blurred version with the texture) and then the texture is just rendered additively to the scene.


alternatively, for a more dynamic and 'present' glow a fragment shader is used, where the scene is rendered into a framebuffer texture and this texture is then fed into the shader via fullscreen quad, this shader then additively blends the original texels with blurred texels. typically a box-blur is used because of its speed (and thus, two passes for horizontal/vertical). Another approach is using the prefix sum via Summed Area Table (related http://docs.nvidia.com/gameworks/content/gameworkslibrary/graphicssamples/d3d_samples/d3dcomputefiltersample.htm)

#5199376 Compute Fog of war with unit Line-of-sight

Posted by deftware on 21 December 2014 - 01:58 AM

 My first suggestion is to only check a fixed number of tiles per frame. Secondly, group units together that are near one-another using some clustering algorithm, and then use the largest visibility radius of those units to do the visibility check for all of them as if they are one unit. This will reduce what is mostly redundant checking.


 Thirdly, perhaps use a lower-resolution FOW map than what the actual map tiles are at. Maybe FOW tiles are 2x2 game tiles. This will speed everything up 4x. Using a separate map to represent FOW simplifies rendering as another pass over the scene.


 Oh, and another idea is not to trace lines from each unit to each tile, or vice-versa, but to find all occlusion-tiles (non-pathing tiles) and cast FOW 'shadows' outward from them away from units. This would basically be starting with all tiles within view radius, then subtract hidden tiles - instead of tracing lines to all of them. Make sure you don't cast FOW shadows into another unit's visible area, though.


 Good luck.





 A quick way to roughly check if one tile is within another's shadow is to use the dot product of the vector from the unit to the non-pathing tile and the vector from the unit to the tile you are checking for visibility. Check that the dot product of these two vectors is *close* to 1.0, in that, they are almost the same (but not demanding exact).. The more margin (epsilon?) you allow for, the less likely your FOW will have holes behind occluders, but the more likely that occluders will cast larger FOW 'shadows'. I hope this all makes sense.

#5197919 Weird particle lag?

Posted by deftware on 12 December 2014 - 09:17 PM

enabling/disabling GL_VERTEX_ARRAY for each single particle is a red flag.


using individual VBOs for each particle is a red flag.


Update the positions of all your particles and dump that to a single VBO in a single glBufferSubData call. Then render all of them with one single DrawElements call. Doing all these state changes and stuff for each individual particle is not going to work.

#5195263 Super Cool Effects

Posted by deftware on 28 November 2014 - 04:51 PM

particle systems and blending.

#5191742 Can't load .wav files with SDL

Posted by deftware on 07 November 2014 - 07:21 PM

The Windows operating systems (Vista, Win7, Win8, etc...) by default hides the file extensions to prevent less computer-savvy users from accidentally changing the extension and confusing programs trying to open them.


I couldn't believe when they started doing this, I believe it was after 98/ME... and, yes, I used ME between 98 and XP, once upon a time.

#5191609 Can't load .wav files with SDL

Posted by deftware on 06 November 2014 - 07:45 PM

Actually, the error message should be "Mix_LoadWAV_RW with NULL src", shouldn't it? Did you accidentally copy the error message wrong? wacko.png


Are you positive your filepath is correct? Could you post the filepath you are using? It seems to be saying it that Mix_LoadWAV() isn't even receiving the raw binary data from the file. It's not a parsing issue, or anything like that - it's not even getting the file data.


Try logprinting your fileName.c_str() to make sure it's correct.


In these cases sometimes I actually dive into SDL's actual code to see what causes certain errors.

#5188342 Mouse OnClick with explosion effects

Posted by deftware on 21 October 2014 - 11:30 AM

create a little array of explosions that contains their position, and lifetime, or time of creation. Then every frame you just draw all the active explosions in the array that haven't burned up yet. When you click, you find an empty/dead explosion slot in the array and fill it with the mouse position and current time.

#5187759 Looking for cheap AO baking solutions

Posted by deftware on 17 October 2014 - 07:26 PM

I'm working on a 3D tile game (NOT blocky minecraft worlds) and have had good success using a distance transform (aka distance field) of the world for performing ambient occlusion approximation.



#5183593 generating branching structures without recursion

Posted by deftware on 28 September 2014 - 07:13 PM

 I thought I had this figured out, but now I'm starting to believe that I was mistaken. I'm working on generating simple branching structures (trees, basically) using a simple command scripting language that supports looping, but not recursion. There is also a stack that I can use the push/pop commands to save the current branch state and load it back to continue working from.


 I'm very limited with what I can do with this scripting system, and for some reason I thought I had this figured out, but apparently I don't. Either I can't remember what I thought of, or what I thought of was totally wrong. My original 'aha' solution involved using two nested loops, and I keep thinking I had some clever use of the push/pop orientation stack that let the loops properly generate branches on branches to a defined depth, but I just can't remember or see what I was going to do.


 Is it even possible? Am I just going mad?

#5181739 glViewport Makes no sense

Posted by deftware on 20 September 2014 - 12:05 PM

What's happening is you are setting your glViewport the 2nd time, rendering to an FBO, and then doing whatever with the FBO to actually get it to the screen while your glViewport is still the right half of the screen. So the FBO gets dumped to just that area.


EDIT: add another glViewport for the entire screen before you draw the stereo FBO to the screen.

#5181073 BSP trees with modern OpenGL

Posted by deftware on 17 September 2014 - 12:56 PM

I just iterate through everything (game objects) I know that I know are visible and throw them into a separate binary tree (every frame) using their squared distance as each node's value with a pointer to the object. Then when I render, I just walk through the binary tree from furthest to nearest. FYI: The reason I used a squared distance to populate the tree is to avoid using a sqrt.

#5180013 BSP portal visibility

Posted by deftware on 13 September 2014 - 12:12 AM



The inner nodes of the tree only describe splitting planes, and the leaves themselves are the geometry formed by all the splitting planes. Convex hulls are formed, and where they are missing a polygon (a splitting plane is there instead) that is the portal shared with another convex hull.