Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

674 Good

About dcosborn

  • Rank
    Advanced Member
  1. dcosborn

    Exponential shadow maps

    Hey, thanks Marco. Yes, I'm not currently doing any prefiltering at all. This is certainly the cause of the poor quality in the screenshot. I have the ln-filtering shader implemented, I just need to integrate it...
  2. dcosborn

    Phun with Loo-ah

    Ah, thanks for that link!
  3. dcosborn

    Phun with Loo-ah

    Quote:Original post by Aph3x Hmm yeah that sounds fine as long as your Lua calls don't 'block' (i.e. execution doesn't stay in a lua routine for more than one frame). See e.g. this thread. I feel like the only problem here (in the link) is how to serialize the execution context (such as the instruction pointer). However, this can undoubtedly be done by wading through the lua source code and finding enough information to allow you to properly serialize lua_State. Quote:Original post by Aph3xAre you going the 'non-blocking' route? I feel a lot of the power & flexibility of scripting is lost when taking that route :-/ Well... that's a long story. Its always been my intention to have multiple scripts running at once, which means each script is a coroutine. The scripts run until they reach the end, so execution does stay in the script across multiple frames, at least for a given execution context. But blocking is a separate issue... I was originally going to make all operations block. Then I would have a fork function for handling asynchronous operations, such as walking to a target while saying things and making hand gestures. I think that this would require too much forking too often, which could make the code hard to follow. My current strategy is to avoid blocking operations, but provide functions for checking goal completion. You may have noticed I have a coroutine.wait function. The idea is that you initiate various non-blocking operations and call coroutine.wait with a string containing whatever conditions need to be met before continuing, such as arriving at the current destination or finishing speaking the current sentence. I'm still keeping the fork function though. player.walk(target) coroutine.wait('player.condition.arrived()')Taking this a bit further, you could have each operation return a function that can be queried to see if the operation has completed. Then, if coroutine.wait receives a function, it should poll it until it evaluates true. So you could write something like this: coroutine.wait(player.walk(target))But what about the logical combiners, and and or? Well... I considered replacing the condition functions with userdata and overriding the logical operators in the metatable, but you can't override the logical operators in Lua [sad]. So another solution is something like this: coroutine.wait(condition.and(player.walk(target), player.say('Hello there!')))But that's pretty verbose. Another solution is this: coroutine.wait(player.walk(target), condition.and, player.say('Hello there!'))...where condition.and is a special sentry constant. This is (exactly) as verbose as the previous solution, but with less bracket nesting. *But* it doesn't allow for explicit operation ordering via brackets. Unless you go too far and implement this: coroutine.wait({player.walk(target), condition.or, player.say('Hello there!')}, condition.and, player.jump())LOL. Its convoluted, but I think I could live with syntax like that.
  4. dcosborn

    Phun with Loo-ah

    Hey, thanks for bringing this up. Honestly, I hadn't thought about how Lua would interact with saved games yet. But I think I'll serialize the state of all running scripts (coroutines), in the manner described here. I'll have a separate mechanism for serializing the C++ game state. And the third thing is to store the mapping of the Lua objects to their C++ counterparts so that we can recreate the userdata at load time. This is because, in the registry, I have a table that maps each Lua object to its userdata, which stores a C++ object pointer and a deleter, with a __gc metamethod. Do you have any other ideas how to approach this?
  5. dcosborn

    AO, Self-critique/self-reflection, Schedule

    I think I know what you mean. Nobody could draw from top-left to bottom-right like a raster because most of us don't have a clear enough image of the drawing in our minds. Which is why we have to consider the image as a whole; otherwise, we'll detail one part, only to find out that it doesn't match the proportions of another part. [There's no question that I'll come to you when I'm ready to move into the content creation stage.]
  6. dcosborn

    Median filtering

    I appreciate your comments, regardless. I'm trying to move onto gameplay as quickly as possible, but the graphics are constantly in need of improvement. Nevertheless, I hope to focus more on scripting in the coming posts, which should be more generally relevent. After all, why have a journal if its not relevent to the readers?
  7. dcosborn

    AO, Self-critique/self-reflection, Schedule

    Really nice RPG tiles! The right team could do some great work with art like that. If you have a tendency to focus on the image as a whole, that's really good. As would certainly you know (better than me), painters often start with large blobs of color to define the overall composition, and refine the image into ever smaller details over multiple passes. But each pass always refines the whole image to an equal level of detail, so that no one part receives more attention than another. Even if some parts are compositionally meant to receive more detail than others, it still happens through a layering of passes. Maybe this is one reason why your paintings are so good.
  8. dcosborn

    Exponential shadow maps

    In another ShaderX6 article, Macro Salvi presents "Exponential Shadow Maps". Like variance shadow maps, they can be hardware filtered, but they only require storing a single moment. They're also faster, with a simpler depth comparison equation. ...but... to avoid overflow issues when storing the exponential depth, the paper stores linear depth instead, deferring the exponential until the depth comparison and using ln to recover the proper value for filtering. This means emulating (separable) filtering in a shader. :( Nevertheless, my current implementation uses regular hardware filtering with linear depth, which is likely the cause of the massive light bleeding when the occluder is near the receiver, and poor filtering when they're far apart. In the depth comparison, ek(o-r), where k is the slope coefficient, which can be raised to reduce light bleeding at the expense of poorer filtering, k=32 for the above screenshot. [wow] uniform sampler2D shadowSampler; varying vec4 shadowCoord; const float k = 32; float GetInvShadowImpl() { float moment = texture2D(shadowSampler, shadowCoord.xy).r; return clamp(exp(k * (moment - shadowCoord.z)), 0, 1); } I saved 8ms per frame by using this algorithm, so it shouldn't be a big deal to sacrifice a few of those ms to emulate filtering for better quality.
  9. dcosborn

    Median filtering

    I implemented 3x3 median-filter post-processing (yes, I'm jumping all over the place). I hope you can see the slightly more fluid appearance of the screenshot below. I'm using the method presented by Morgan McGuire in ShaderX6. You may remember that I had image-space outlines a while ago. There's a big problem with such outlines: because they overlay the rendering, they can occlude the precious screen-space of small objects. A better solution might be rim highlights (used in some form by Valve), where the fragment brightens as the normal approaches perpendicularity with the eye vector. For additional contrast, you can use drop-shadows, calculated from the depth-difference of a fragment neighbourhood. It makes sense that receeding fragments should be darker and occluded by brighter advancing fragments. I already have some form of rim-highlights (could be better though). I plan to swap the existing (but broken) outline code for drop-shadows soon. Fun fact: the following is valid code. Call me a n00b, but I didn't know you could pass a class template name as a template argument like this. template struct A { typedef T type; }; template struct B { typename T::type value; }; int main() { B b; }
  10. dcosborn

    Phun with Loo-ah

    I've made the leap into Lua scripting (finally). This has been the biggest hole in the project for a long time. So, here's what I have now: That guy stuck in the ground is an NPC(!). The exclamation mark is because he's the first ever NPC in the engine. He's at position [0,0,0] because I haven't implemented the Character.position property in Lua yet. He might be participating in collision detection, so I'm really not sure at the moment why he's in the ground. Here's the Lua script that makes this happen: print("Hello world!", _VERSION) coroutine.yield() print("this is the second frame") local Fred = Character:new("character/male-1/male.char"); coroutine.wait("false"); print("we should never get here") Quit() Anyway its really beautiful outside, so I'm leaving to enjoy it!
  11. dcosborn

    Update so far

    hey, looks good Sorry, I couldn't resist. XD
  12. dcosborn

    Eh I think he's a pretty cool guy

    Nice! River City Ransom is a fun game. I look forward to watching the progress of your variation on that theme.
  13. dcosborn


    Yeah, it sounded excellent; nice and clean recording too. Where did you record it, or what sort of setup do you have?
  14. dcosborn

    Coroutines in C

    I was looking into the same thing recently. This series of articles might be of interest. The second page presents the idea of using Win32 Fibers to implement coroutines. Apparantly the idea has been successfully applied to Lua, allowing one to yield in the middle of a C function. You might look to Boost.Coroutine for implementation ideas, even if you're using C. Notwithstanding the above, to actually get work done, I would suggest going with something like Lua, AngelScript, or another scripting language with built-in support for coroutines.
  15. dcosborn

    Sweep picking makes you a man

    I enjoyed getting together with both of you. We should do it again sometime; hopefully sooner than next year this time, IMHO. I've lost my desire to encur wrath in the Linux/Windows thread. [wink] Some people have made some good points already.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!