don't click here

Special Stage Development

Discussion in 'Sonic 2 HD (Archive)' started by Canned Karma, Mar 22, 2010.

Thread Status:
Not open for further replies.
  1. GerbilSoft


    RickRotate'd. Administrator

    Code (Text):
    1. fixme:win:EnumDisplayDevicesW ((null),0,0x32f714,0x00000000), stub!
    2. fixme:d3d:swapchain_init Add OpenGL context recreation support to context_validate_onscreen_formats
    3. fixme:d3d9:Direct3DShaderValidatorCreate9 stub
    4. r300: Max size of the constant buffer is 256*4 floats.
    5. wine: Unhandled page fault on read access to 0xffffffff at address 0x7dd81b8c (thread 0009), starting debugger...
    6. Register dump:
    7.  CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
    8.  EIP:7dd91b8c ESP:0032ee78 EBP:0032ef90 EFLAGS:00010286(  R- --  I S - -P- )
    9.  EAX:00000003 EBX:7df92ff4 ECX:00000000 EDX:f0000000
    10.  ESI:00000001 EDI:7c7c5288
    11. Stack dump:
    12. 0x0032ee78:  7c7c4474 7dd91780 0032ef60 00000000
    13. 0x0032ee88:  00000000 00000000 00000000 00000000
    14. 0x0032ee98:  00000000 00000000 00000000 00000000
    15. 0x0032eea8:  00000000 00000000 00000000 00000000
    16. 0x0032eeb8:  00000000 00000000 00000000 00000000
    17. 0x0032eec8:  00000000 00000000 00000000 00000000
    18. Backtrace:
    19. =>0 0x7dd91b8c in (+0x40b8c) (0x0032ef90)
    20.   1 0x7dd8a952 in (+0x39951) (0x0032f000)
    21.   2 0x7dd841de in (+0x331dd) (0x0032f170)
    22.   3 0x7dd84ec2 in (+0x33ec1) (0x0032f1f0)
    23.   4 0x7dd7c63f in (+0x2b63e) (0x0032f210)
    24.   5 0x7debeb39 in (+0x16db38) (0x0032f230)
    25.   6 0x7de9f5b3 in (+0x14e5b2) (0x0032f260)
    26.   7 0x7de9c384 in (+0x14b383) (0x0032f2c0)
    27.   8 0x7de6b559 in (+0x11a558) (0x0032f660)
    28.   9 0x7de94260 in (+0x14325f) (0x0032f6e0)
    29.   10 0x7de943e6 in (+0x1433e5) (0x0032f720)
    30.   11 0x7de268fe in (+0xd58fd) (0x0032f750)
    31.   12 0x7e02ad2c glDrawElements+0x3b(mode=0x32f054, count=0x7c7c01a8, type=0x32f030, indices=0xb76701ec) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f000)
    32.   13 0x7dd8a952 in (+0x39951) (0x0032f170)
    33.   14 0x7dd84ec2 in (+0x33ec1) (0x0032f1f0)
    34.   15 0x7dd7c63f in (+0x2b63e) (0x0032f210)
    35.   16 0x7debeb39 in (+0x16db38) (0x0032f230)
    36.   17 0x7de9f5b3 in (+0x14e5b2) (0x0032f260)
    37.   18 0x7de9c384 in (+0x14b383) (0x0032f2c0)
    38.   19 0x7de6b559 in (+0x11a558) (0x0032f660)
    39.   20 0x7de94260 in (+0x14325f) (0x0032f6e0)
    40.   21 0x7de943e6 in (+0x1433e5) (0x0032f720)
    41.   22 0x7de268fe in (+0xd58fd) (0x0032f750)
    42.   23 0x7e02ad2c glDrawElements+0x3b(mode=0x7c7c01a8, count=0x3518, type=0x7c596798, indices=0xb7747380) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f170)
    43.   24 0x7dd841de in (+0x331dd) (0x0032f1f0)
    44.   25 0x7dd7c63f in (+0x2b63e) (0x0032f210)
    45.   26 0x7debeb39 in (+0x16db38) (0x0032f230)
    46.   27 0x7de9f5b3 in (+0x14e5b2) (0x0032f260)
    47.   28 0x7de9c384 in (+0x14b383) (0x0032f2c0)
    48.   29 0x7de6b559 in (+0x11a558) (0x0032f660)
    49.   30 0x7de94260 in (+0x14325f) (0x0032f6e0)
    50.   31 0x7de943e6 in (+0x1433e5) (0x0032f720)
    51.   32 0x7de268fe in (+0xd58fd) (0x0032f750)
    52.   33 0x7e02ad2c glDrawElements+0x3b(mode=0x7c7231e0, count=0xffffffffb767069d, type=0x32f220, indices=0x7de37c77) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f1f0)
    53.   34 0x7dd84ec2 in (+0x33ec1) (0x0032f210)
    54.   35 0x7debeb39 in (+0x16db38) (0x0032f230)
    55.   36 0x7de9f5b3 in (+0x14e5b2) (0x0032f260)
    56.   37 0x7de9c384 in (+0x14b383) (0x0032f2c0)
    57.   38 0x7de6b559 in (+0x11a558) (0x0032f660)
    58.   39 0x7de94260 in (+0x14325f) (0x0032f6e0)
    59.   40 0x7de943e6 in (+0x1433e5) (0x0032f720)
    60.   41 0x7de268fe in (+0xd58fd) (0x0032f750)
    61.   42 0x7e02ad2c glDrawElements+0x3b(mode=0x7c7231e0, count=0x7c5968b8, type=0x0040, indices=0x7df92ff4) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f210)
    62.   43 0x7dd7c63f in (+0x2b63e) (0x0032f230)
    63.   44 0x7de9f5b3 in (+0x14e5b2) (0x0032f260)
    64.   45 0x7de9c384 in (+0x14b383) (0x0032f2c0)
    65.   46 0x7de6b559 in (+0x11a558) (0x0032f660)
    66.   47 0x7de94260 in (+0x14325f) (0x0032f6e0)
    67.   48 0x7de943e6 in (+0x1433e5) (0x0032f720)
    68.   49 0x7de268fe in (+0xd58fd) (0x0032f750)
    69.   50 0x7e02ad2c glDrawElements+0x3b(mode=0x7c720968, count=0x7c5968b8, type=0x7c7bb678, indices=0xe2cc64) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f230)
    70.   51 0x7debeb39 in (+0x16db38) (0x0032f260)
    71.   52 0x7de9c384 in (+0x14b383) (0x0032f2c0)
    72.   53 0x7de6b559 in (+0x11a558) (0x0032f660)
    73.   54 0x7de94260 in (+0x14325f) (0x0032f6e0)
    74.   55 0x7de943e6 in (+0x1433e5) (0x0032f720)
    75.   56 0x7de268fe in (+0xd58fd) (0x0032f750)
    76.   57 0x7e02ad2c glDrawElements+0x3b(mode=0x7c71c400, count=0xffffffffb7745ff4, type=0x32f348, indices=0x7de3f52f) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f260)
    77.   58 0x7de9f5b3 in (+0x14e5b2) (0x0032f2c0)
    78.   59 0x7de6b559 in (+0x11a558) (0x0032f660)
    79.   60 0x7de94260 in (+0x14325f) (0x0032f6e0)
    80.   61 0x7de943e6 in (+0x1433e5) (0x0032f720)
    81.   62 0x7de268fe in (+0xd58fd) (0x0032f750)
    82.   63 0x7e02ad2c glDrawElements+0x3b(mode=0x7c71c400, count=0x0010, type=0x7c7bb678, indices=0x7de3f52f) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f2c0)
    83.   64 0x7de9c384 in (+0x14b383) (0x0032f660)
    84.   65 0x7de94260 in (+0x14325f) (0x0032f6e0)
    85.   66 0x7de943e6 in (+0x1433e5) (0x0032f720)
    86.   67 0x7de268fe in (+0xd58fd) (0x0032f750)
    87.   68 0x7e02ad2c glDrawElements+0x3b(mode=0x7c6f9320, count=0x7c71ef54, type=0x32f6a4, indices=0x1) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f660)
    88.   69 0x7de6b559 in (+0x11a558) (0x0032f6e0)
    89.   70 0x7de943e6 in (+0x1433e5) (0x0032f720)
    90.   71 0x7de268fe in (+0xd58fd) (0x0032f750)
    91.   72 0x7e02ad2c glDrawElements+0x3b(mode=0, count=0xffffffffffffffff, type=0xffffffff, indices=0x150) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f6e0)
    92.   73 0x7de94260 in (+0x14325f) (0x0032f720)
    93.   74 0x7de268fe in (+0xd58fd) (0x0032f750)
    94.   75 0x7e02ad2c glDrawElements+0x3b(mode=0x0004, count=0x0150, type=0x1405, indices=0x1dd050) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f720)
    95.   76 0x7de943e6 in (+0x1433e5) (0x0032f750)
    96.   77 0x7e02ad2c glDrawElements+0x3b(mode=0x0004, count=0x0150, type=0x1405, indices=0x1dd050) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032f750)
    97.   78 0x7de268fe in (+0xd58fd) (0x0032f770)
    98.   79 0x7e744cad drawPrimitive+0x10c(iface=0x4, index_count=0x0150, StartIdx=0x1405, idxSize=0x1dd050, idxData=0x258) [/var/tmp/portage/app-emulation/wine-1.2_rc2/work/wine-1.2-rc2/dlls/wined3d/drawprim.c:43] in wined3d (0x0032f770)
    99.   80 0x7e02ad2c glDrawElements+0x3b(mode=0x156618, count=0x0150, type=0, indices=0x4) [/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999/src/mapi/glapi/../../../src/mapi/glapi/glapitemp.h:1657] in (0x0032fa30)
    100.   81 0x7e744cad drawPrimitive+0x10c(iface=0x156618, index_count=0, StartIdx=0x0150, idxSize=0x32fab4, idxData=0x7e7d1820) [/var/tmp/portage/app-emulation/wine-1.2_rc2/work/wine-1.2-rc2/dlls/wined3d/drawprim.c:43] in wined3d (0x0032fa80)
    101.   82 0x7e7210b1 IWineD3DDeviceImpl_DrawIndexedPrimitive+0xc0(iface=0x14d488, startIndex=0x0004, index_count=0) [/var/tmp/portage/app-emulation/wine-1.2_rc2/work/wine-1.2-rc2/dlls/wined3d/device.c:6149] in wined3d (0x0032fae0)
    102.   83 0x7e8205a6 IDirect3DDevice9Impl_DrawIndexedPrimitive+0xd5(iface=0x7e825a40, PrimitiveType=2122447360, BaseVertexIndex=0x7e823070, MinVertexIndex=0x7e822ff0, NumVertices=0x7e822e80, startIndex=0x7e825600, primCount=0x7e8266c0) [/var/tmp/portage/app-emulation/wine-1.2_rc2/work/wine-1.2-rc2/dlls/d3d9/device.c:1900] in d3d9 (0x7e83dce0)
    103.   84 0x00419147 in s2tube-win32 (+0x19146) (0x7e825bb0)
    104. 0x7dd91b8c:
    It looks like the fault is in, which is the Radeon R300 3D driver. I'm using r300g, the new Gallium3D driver, so I'll try classic Mesa and see if that works.

    EDIT: Classic Mesa works correctly. I'll report a bug to the r300g developers. (There is occasional flickering though. Not sure if this is the fault of the s2tube program or classic Mesa.)
  2. Very well done Synergy! My Comments:

    * As someone already mentioned, the jump is a bit high
    * MaximusDM (As usual) is spot on with his analysis RE: stick zones
    * Perhaps it's already been discussed, but I'd consider putting fog near the far plane. Check out for more info. EXP2 looks pretty good with a low density IIRC, but if you want that crisp 100% look you can also do linear and set the start distance pretty close to the far plane. I think the normal far plane distance is pretty much perfect, but fading into it will both A) look better (IMO) and B) pull in the distance at which you start to see mines and rings, which seems a bit too soon right now. Disregard all of this if you're already using fog.

    Just some thoughts - again super job Synergy; it's really coming along!
  3. Hamneggs


    Official Breakfast of S2HD Member
    Networked lighting
    Why not put that stupid wall at a set distance, like in the original? Just to see how it looks. I hate culling fog a tad more than that wall. (I am assuming you are talking about using fog in a similar fashion to the several large maps in Medal of Honor: Allied Assault, which ran on the q3 engine)
    Why not somehow integrate the track into the diamond pattern of the actual background? Like have the track pass through the center hole of the diamonds? That would block one from seeing the track being drawn, and also add another dimension to the SS, sprucing it up just as with the rest of S2HD.
    Ill work on a mockup, if anyone wants it.
  4. MaximusDM


    Sonic 2HD - Concept Artist Member
    The fog idea sounds like the best plan for resolving it. And leaving a wall there isn't a good idea. I like the tracks to feel spontaneous. And having a wall there could possibly bring up functionality issues of not being able to clearly see mines and rings as clear as they should be because of contrast. And then you would also need to have rings and mines already rendered there or you would see those pop in as well.

    I don't really see the fog idea as necessarily a dense noticeable fog, but rather an opacity/gradient type device to mask the curve before it is actually about to come up and to cover up the obviousness of it rendering right in front of you.
  5. Hamneggs


    Official Breakfast of S2HD Member
    Networked lighting
    So no comment on the other idea...

    Sorry, but I did this in a hurry, and in Google Sketchup. I know that everyone hated my mine that I made in sketchup, so here goes nothing.
    Shows how the track can go through the background, hiding the area that is currently being drawn.
  6. This is actually how it's working right now from what I can tell. This is why when the mines fade in they appear to grow from the center of the mine (as if the ball comes partially into view before all into view).

    I think this is overkill, but others are welcome to disagree.

    Just to be clear, I wasn't talking a dense fog. I'd make a case for a linear fog set fairly close to the far plane (at least for a first try). Since S2HD is trying to keep the crisp, clean style of the original, fog stemming from the camera might not look right. If you put the fog far enough back, you can still get that crisp image throughout all but a small window of the screen, and that small window should fade fairly sharply so as not to be an eyesore on the rest of the geometry.

    Anyway, it's only about 10 lines to test it out. If I had the source (or the wherewithall/time to reverse engineer that wonderful tech demo) I'd whip it up myself, but it's basically just adding the following:

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
    float Start = 45.0f, // Something close to the farplane
    End = 50.0f; // or whatever your farplane is

    // Enable fog blending.
    g_pd3dDevice->SetRenderState(D3DRS_FOGENABLE, TRUE);

    // Set the fog color. Alpha is ignored here.
    g_pd3dDevice->SetRenderState(D3DRS_FOGCOLOR, D3DCOLOR_RGBA(128, 128, 128, 0));
    // Could also just pass 0x00808080 to the above as the second param (the highest 8 bits are ignored)

    // Set fog parameters. Probably will support more graphics cards with vertex mode. Required if you're using vertex shaders
    g_pd3dDevice->SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR);
    g_pd3dDevice->SetRenderState(D3DRS_FOGSTART, *(DWORD *)(&Start)); // this takes a DWORD instead of a float
    g_pd3dDevice->SetRenderState(D3DRS_FOGEND, *(DWORD *)(&End));

    Interesting thought, though I'm a little worried how it would deal with turns and inclines. They'd have to clip through the background...
  7. kazade


    A 2D Physics Engine
    Hi Synergy,

    Just thought I'd let you know it works fine for me under Wine as well (needed to get a native d3dx9_36.dll). It runs really well too, one thing I noticed though is if you get hit by a mine you seem to get stuck and then get hit repeatedly, I haven't got S2 with me so I can't check but I think there is a short period after getting hit where you can't get hit again, I could be wrong though.

    Just out of curiosity, how do you make the levels for it? Do you use a model editor?


    EDIT: Ignore me, just read the controls.txt :p
  8. Synergy


    I used exp2 fog purely on the half-pipe shader for the original screenshot when I first posted here in order to darken the tube in the distance, as the original game does (link to screenshot), but I turned it off for this build because with the sky sphere in place it doesn't look particularly good, and figured I'd leave that until we'd got an overall lighting scheme/style sorted.

    [Edit] Don't know why I didn't think of it before, but we can set the alpha for the tube pixels being rendered based on distance to the camera in the pixel shader, then set the blend function in render state. Should fade in nicely in the distance, and won't interrupt the sky. I'll give it a go when I get my dev computer back up and running.

    I mentioned earlier to steveswede I think it was, that I'm scaling the objects and tube decorations based on distance to the camera, which is why if you choose the extended draw distance option they scale further away.

    Hamneggs, I don't see how that hides the track being drawn. You're still going to see the very end of the tube whether it goes through a wall of diamonds or not. And as lotharstar points out, you'd have issues with turns and so on. As for having a section of wall at the end, it might work as a bit of a hack by just placing a left/right piece at the very end each time the tube mesh is updated in order to form a wall, but I had wondered what you would do when going multiple-straights followed by a down piece: the wall would just have to disappear at some point.

    Hoping to get a new power supply today so I can get back to making sure it works for those with problems.
  9. Hamneggs


    Official Breakfast of S2HD Member
    Networked lighting
    Part A: What about a fog that's the same color as the background, aka, LuckyCharmFart mode? But I don't think that would be the most efficient way of doing things, given...
    Part B: your second idea, which is the best so far.
    if it is that easy to access the alpha term of the tube, what about the translucency idea from so long ago?
    That old mockup of mine:
    looking at it, Synergy, you don't have too much further to go. Just the character models spheres rods and background. That's it. (err, maybe not)
  10. Synergy


    Oh, it's certainly possible, but I have my doubts whether it will look good or not: we'll see when we get to that point. :) 'Gradient fog' would still block the stars and diamonds, so you'd still see upcoming pieces even if it would be a little bit better masked. I've two solutions for fading, one more expensive but potentially better looking than the other, so we'll see how they look later on when in-engine.
  11. Sonic Hachelle-Bee

    Sonic Hachelle-Bee

    Taking a Sand Shower Tech Member
    Lyon, France
    Sonic 2 Long Version
    So, instead of a fog, make the tube and objects slowly more and more translucent, so that they become totally invisible in the far distance and blend into the background?
  12. Synergy


    Yes, at the very distance: operating the same way the linear fog does, with a start and end point, so it can be tweaked for the best result.
  13. I assume you're turning off fog for the sky sphere and turning it on for your other rendering elements correct? If you disable it while rendering your sky box and then enable it afterward that ought to look better.
    Very similar to the linear fog idea. A fair thought - might take a little bit longer to code than the above. Could produce a nice effect though!

    Really dumb idea but I just realized something (a bit slow to the plate). One of the key ways the S2 tube hides the transitions into turns is to have the background actually have part of the tube. There would have to be some special logic done, but basically anytime you're rendering a straightaway where an entire turn isn't visible, you render a wall at the end of the tube which makes it look closed off (and going off into infinity). Now this probably won't work AT ALL in 3D (especially not at 1920x1080), but it might be worth a shot in the dark. See the attached programmer art for ref.

  14. Canned Karma

    Canned Karma

    S2HD Project Manager Member
    Sonic 2 HD, various 3D work
    Now that I have a working build, I'd like to see the fog idea worked in some how. On a related note, Synergy, will it be possible to import an animated model to replace the orbs? I have a 3D model I built a couple months ago that just needs to be rigged and put to an animation cycle, and then we'll have Sonic ready for demonstration as well.
  15. Hamneggs


    Official Breakfast of S2HD Member
    Networked lighting
    Now, when I said it everyone, including yourself I believe, hated it.
  16. Endgame


    Formerly The Growler Member
    As I have been suggesting in the General Project Thread:

    What about if you want to have a "Super" hard mode, you could speed things up a little and play as Super Sonic in the Special Stages (just NOT his theme tune, that would drive anyone up the wall after long enough!)

    To which test-object replied:
  17. Synergy


    Important: Could anyone still having problems please run the DirectX End-User Runtime setup from Microsoft's website to ensure they have the latest DirectX files. Two users who have had the same issue have resolved the problems by doing this and are now able to run the standard build without problems.
  18. steveswede


    Ask my hand
    Fighting against the Unitary State of Europe
    You know it could be worth pointing this out as well in the future when the game is complete for new gamers. Or some kind of notice in the installer to let them know that they must have the latest DirectX.
  19. Canned Karma

    Canned Karma

    S2HD Project Manager Member
    Sonic 2 HD, various 3D work
    The OP has been updated to include the latest build Synergy has released, as well as his recommendation on the DirectX Runtime update.
  20. HeartAttack


    is a smug hipster, brah! Member
    Perhaps the installer (in the future) could include a link to the DX runtime update download on Microsoft's website? Or possibly even a redistributable version included in the installer? Perhaps I'm looking too far into the future, but I meant the installer for the full game itself once that comes around :p
Thread Status:
Not open for further replies.