Sanctimonia: OpenGL Help Wanted

As he notes on Twitter, Kevin Fishburne could use a hand with some OpenGL code issues:

I’m not quite sure exactly what the issue he’s encountering is, and unfortunately his attempt to post it in a comment here didn’t end well for reasons that I haven’t been able to identify. But at any rate, if OpenGL is one of your comfort areas, why not introduce yourself?

8 Responses

  1. Jc says:

    I know I’ve been extra swamped by work for Backtoroots but I should have a bit of time in the near future to help out. Though I’m no OpenGL expert so perhaps it will be for naught. Kevin stil has my email I believe so he can just send me the problem and we can go from there

  2. Sanctimonia says:

    Much to my own amazement I actually figured out the problem this evening (billboarding using only matrix transformations), though I dangerously (as usual) still don’t understand the underlying logic of the math.

    I would however like to say that WtF posting this article and Jc’s response are deeply appreciated and inspired something I rarely feel in my effort to create this game; a sense of community. Like friends unexpectedly bumping shoulders on the battlefield, it felt great.

    @Jc/Fearyourself I actually started writing you an email last night but stopped because I thought you might think I was an asshole for hitting you up out of the blue about a programming issue. Glad to be wrong this time. Also happy BtR is still under heavy development. One of the more serious/badass projects around these parts.

  3. Jc says:

    Yeah, you can, as anyone always can, just send me an email with your question and ill either know the answer or redirect you to someone who does :-). Anytime and I won’t take offense 😉

    I’m happy you got it to work ! It’s always better if you do by yourself because of the learning experience !

    I’m currently stuck in implementing the renderer for the U4 dungeon viewer. I have not done it in so long (I’ve done similar implementations in the past) that I really just need to sit down and calmly write the code. Hopefully ill get it nailed down soon!

    Good luck,
    Jc

  4. Sanctimonia says:

    The billboarding matrix stuff was so crazy I barely remember how I got it to work, but it does work well. Enabling depth testing, which I had long put off, is forcing me to shape things up all around; it’s the final frontier in rendering for me.

    I know the feeling. I took a five day vacation (without my computer) and when I came back it took a few days to get back into the project. Didn’t like that at all, and tonight was the first work since getting back that was solid and useful.

    An U4 dungeon viewer would be the ultimate opportunity to make its dungeons look awesome. Imagine the original perspective and controls but each wall segment would be rendered as an 8×8 grid of billboarded quads. The walls would look like a higher density After Burner or Thunder Blade:

    http://youtu.be/El1VOoVcPVI

    The ceiling, floor and background could be totally black, with just the walls rendered as grids of billboarded quads. The normal of the wall segment could be applied to each quad in its grid so light sources would work on the billboards. Making the only light source positional and attached to the player would cause distant passages to become darkened. Damn I want to do a dungeon. Dungeons are awesome.

    • WtF Dragon says:

      I know the camera angle in Sanctimonia is fixed (apart from rotation), so the following is only partly applicable, but you really should study the dungeons in Ultima 9 if you have any intent of adding dungeons to your game.

      The dungeon design in U9 is just wild; each one has its own unique visual flavour, layout style, and audio theme & cues. And even though some (Hythloth!!!!!!!) are annoying as hell to play through, the actual design nevertheless shines through.

      You wouldn’t be able to exactly translate dungeons of this sort into your own engine, but in terms of giving an example of how to give each hole in the ground its own distinct flavour and unique sense of dread, you couldn’t ask for better.

      • Sanctimonia says:

        For me the main trick for me would be the actual hole in the ground. One may not teleport, so there would have to be some separate geological threshold where you breached the other side, effectively teleporting up or down a layer/level. Maybe like Ultima VI dungeons but scaled 1:1? I’d have to make digging up from a dungeon permit escape and reentry (flooding is out of the question for now), but I’m not trying to program Minecraft or Dwarf Fortress here.

        Having dungeons that are designed will be the approach of my next game, which will be an exploratory platformer (Zelda II-like, but more realistic). Until then, I’m thinking dungeons could be rendered as dimly-lit tunnels with backculling enabled. The player would carve new tunnels, finding open pockets of air and other resources like water, blind fish, translucent crustaceans, plants and mushrooms. Skiffs too, maybe. 😉

  5. Sanctimonia says:

    Just sent this to Jc/Fearyourself:

    “Hey Jc, thanks for the offer for help, as I definitely need it though for a different issue this time.

    Here’s the context: I add items to a “render queue” which includes each item’s distance from the camera. When it’s time to render I sort the queue by their camera distance which then allows me to render the queue in the proper order from farthest to nearest item. All this works great, but despite having sane near and far clipping planes items that are too close together cause depth testing problems. My proposed solution is to keep track of the camera distance of the previously rendered item relative to that of the item currently being rendered and if that distance is below a certain threshold I decrease the distance of the current item by the threshold (move it slightly closer to the camera) and update the “last item distance”, referenced again by the next item render.

    The calculation I can’t figure out is how to move the item closer to the camera. The known variables are (call them whatever you want for brevity):

    ItemX, ItemY, ItemZ
    CameraX, CameraY, CameraZ
    Threshold

    So let’s say we have a render queue item which is at 0,0,0 and the camera is at 1,1,1 and we want to move the item 0.5 units closer to the camera. I have a few procedures which do things similar to this but in 2D. As with most math I’m sure it’s surprisingly simple, but as good as I am with so many things, this stuff always just kills me. I’m sure Sin and Cos functions do the trick here, somehow. :/”

    If anyone knows what’s up with this equation/algorithm, do tell.

    I put crafting on hold for a moment in favor of getting the rendering logic in order, as Sanctimonia was originally envisioned to be 2D but has since developed into a generally 3D application. What’s interesting is that since I’m keeping player, PWO and fauna items 2D I’ve fallen into an unenviable position where maintaining a believable presentation requires the creation of a continuous optical illusion. While the thought of enabling depth testing and cleaning up the aftermath pretty much scared the shit out of me for the last year, so far the results have been surprisingly good. When the major kinks are ironed out (hopefully soon) I’ll put up another gameplay video so show things off.

    I think the final effort that will crystallize what I’m trying to do visually will be the addition of polygonal PWOs, namely walls and doors. Anyone have ideas about gameplay mechanics for designing buildings? I was thinking about having a blueprint editor using quill/ink and parchment with a designated cornerstone, then having the player start construction relative to the blueprint’s marked cornerstone. Everything would still require manual construction, but could follow the blueprint to avoid major mistakes.

  6. Sanctimonia says:

    Found this, which appears to be the exact question I’m asking:

    http://stackoverflow.com/questions/1436720/determine-point-coordinates-in-3d

    It even contains answers, some of which are probably correct. Apparently the sins of my past are coming back to haunt me, as I don’t know what the hell they’re talking about. Can anyone interpret the equations in a way friendly to my basic algebra brain?

    I don’t always feel stupid, but when I do, I FUCKING HATE IT. 😉