Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: PGD Annual 2007 - Questions to Sascha Willems

  1. #1

    PGD Annual 2007 - Questions to Sascha Willems

    In order to make communication between the entrants and myself easier I open up this thread were you can ask questions directd at my judging and system. I'll also try to later on report and answer to problems that entries cause on my system, so you have a direct feedback during the competition.

    Note : Please refrain from discussing the competition itself here, we have different threads for that, only questions directed at me in here please

    Specifications of my main desktop system which I'll mostly use for testing your entries, the second one will only be used if there are problems. Please read the notes when appropriate, it'll maybe spare you some troubles :

    CPU : AMD Athlon 64 X2 4200+
    [size=9px]Note : This is a Dual-Core CPU. So it's possible that when you use time-based movement it'll have problems on dual cores and cause choppy or wrong movement. So please try to use hi-speed timers like QueryPerformanceCounter as they work. If you're unsure about this please ask, and I'll tell how to use that one for proper timing[/size]
    Memory : 1 GByte
    Graphics : Leadtek GF 7900GS with 256 MBytes of VRAM
    [size=9px]Note : I always use the newest drivers available. The card itselfs supports Shaders up to SM3.0 and also glSlang[/size]
    Monitor : BenQ FP202W 20.1" Widescreen(!) TFT
    [size=9px]Note : The native resolution is 1680x1050 at 32BPP with 60Hz. This has a ratio of 16:10 (usual monitors are 4:3), so please add a form of widescreen support to your game, cause otherwise everything will looked stretched which isn't good looking. So either detect 16:10 and make your game have black bars when running at that res or better make it also look right at that resolution (e.g. changing FOV in a 3D-game)[/size]
    Sound : Soundblaster X-Fi! Extreme Music
    [size=9px]Note : It's connected to a nice 5.1 surroundsetup (with a Yamaha RX-V457) so I'd love to "see" some nice music and sound with a high bitrate. Bad sounds sound even worse on a good setup, please keep that in mind. The soundcard also supports all new standards, up to EAX5.0 and OpenAL.[/size]
    OS : Windows XP Pro with SP2
    Gamepad : Logitech Cordless Rumblepad 2
    [size=9px]It has one digital Pad, 2 analog pad (which means 3 axis), 6 buttons on the front and 4 shoulder buttons. It supports force feedback, though rarely any PC game uses it.[/size]
    Joystck : Saitek Cyborg Evo
    [size=9px]More-or-less standard stick (except it can be adjusted in all weird ways) with a Coolie-Hat, 12 Buttons and 3 axis. It also has a throttlecontrol as a fourth axis.[/size]

    Specs of my second system :
    Athlon XP 2600+, 1GByte of Memory, Leadtek GF6800 (256 MBytes), 22" CRT (4:3) with desired res of 1600x1200 at 85Hz (32BPP), Sound is NForce Soundstorm (which is actually very advanced for onboard sound). OS is the same as above, input devices too.

    And since I'm from germany please take a look at this thread if you want to make a game that is e.g. set in World War 2. We have strict laws about most third reich symbols so make sure you comply to the above thread or otherwise I'm not allowed to download your entry.

  2. #2

    PGD Annual 2007 - Questions to Sascha Willems

    Hey there!

    Here is your first question:

    Quote Originally Posted by you
    Note : This is a Dual-Core CPU. So it's possible that when you use time-based movement it'll have problems on dual cores and cause choppy or wrong movement. So please try to use hi-speed timers like QueryPerformanceCounter as they work. If you're unsure about this please ask, and I'll tell how to use that one for proper timing
    and Im not sure what you mean.
    I usually write games in this type of set up in the main loop:
    Code:
    ...
    gettime(...);
    timenow := s100 + sec*100 + min*100*60 + hr*100*60*60;
    if timenow-timebefore >= timedelay then 
    begin
     Move_Guy;
     timebefore:=timenow;
    end;
    ...
    Is this what I'm NOT supposed to do, or is it something completely different?

    Cheers

  3. #3

    PGD Annual 2007 - Questions to Sascha Willems

    The method you use is not time-based movement, with time-based movement you don't wait for a certain time to pass but update movements each frame based on time between the current and the last frame. And many people still use functions like GetTickCount which are not fine-grained enough for measuring speeds at high frame rates (GetTickCount works on milliseconds and with frametimes below 10ms won't give you correct results) and may cause troubles on modern multi-core systems.

    So I added the above note, as I also had some problems with correct timing after switching to a dual-core system, as it's possible that your thread get's moved to another core without noticing and you then could have a time-gap. So I e.g. stopped using the OnIdle-Event but rather start up my own loop after game init and do timing only with high-performance funtions like QueryPerformanceCounter.

    If you need more information, take a look at this link from Microsoft that shows how to do correct timing on multi-core systems.

  4. #4

    PGD Annual 2007 - Questions to Sascha Willems

    Ok I get the idea.
    The routines described in tht link, are they for DirectX only? Is it the same for OpenGL? Or does it actually use neither and I'm just making a fool of myself? ops:

  5. #5

    PGD Annual 2007 - Questions to Sascha Willems

    They are from the Windows API and are in no way linked to any graphics API. So as long as you use windows the functions in that article can be used.

  6. #6

    PGD Annual 2007 - Questions to Sascha Willems

    Ok :roll:
    I jst thought I'd ask because their is a large DirectX sign at the top of the page...but tht's probably jst some advertising

  7. #7

    PGD Annual 2007 - Questions to Sascha Willems

    Quote Originally Posted by Sascha Willems
    So I added the above note, as I also had some problems with correct timing after switching to a dual-core system, as it's possible that your thread get's moved to another core without noticing and you then could have a time-gap.
    Sorry if it's a little off-topic, but... on dual-core when running a single process that tries to take 100% of the CPU, in Task Manager I see that the total CPU usage is 50% (ok, one core is used fully) but both cores are used at 25%! Is Windows constantly switching the process between two cores? Because if I set affinity to only one CPU, then indeed it gets used to 100% while the other one being idle. Is this true? If yes, then what is the reason for this constant switching?

    [size=9px]P.S. The above happens on my Intel Core 2 Duo...[/size]

  8. #8

    PGD Annual 2007 - Questions to Sascha Willems

    What you see also happens on my AMD Dualcore, but only after installing the dual-core optimizer from AMD. Otherwise (if I remember correct) without that one and the CPU driver a single-threaded app only runs on one core.
    But with a specialized driver, the workload will get split between the CPUs, though I can't tell how that's exactly done. It also does that in most of the games that use only one core where they then only take up 50% CPU time on each of the cores. So I think it's a driver thing.
    But actually this doesn't change any behaviour within the application itself, so except for correct timing you don't need to take care for multi cores.

  9. #9

    PGD Annual 2007 - Questions to Sascha Willems

    As I know QueryPerformanceCounter sometimes doesn't work correctly on Athlon 64 X2 processors. AMD has released a driver update to fix this issue. But I'm not sure that this update was installed by all my users.

    I use the following code and had no problems(Globals.CurrentMs uses GetTickCount()):

    Code:
      const Interval = 30; // 30 ms
    ...
      while LastProcessingMs + Interval <= Globals.CurrentMs do begin
        Process&#40;&#41;;  // some processing
        Inc&#40;LastProcessingMs, Interval&#41;;
      end;
    As you can see I do not compare GetTickCount results.

  10. #10

    PGD Annual 2007 - Questions to Sascha Willems

    Here's what I wrote for my engine:
    [pascal]
    var
    QPCFrequency: Int64;
    QPCEnabled: Boolean;
    CurrentTime, LastTime, CurrentDeltaTime, TotalTime: Single;

    procedure UpdateDeltaTime;
    var
    Time: Int64;
    begin
    if QPCEnabled then
    begin
    QueryPerformanceCounter(Time);
    CurrentTime := (Time / QPCFrequency);
    if LastTime = 0 then
    CurrentDeltaTime := 0
    else
    CurrentDeltaTime := CurrentTime - LastTime;
    end
    else
    begin
    CurrentTime := TimeGetTime;
    if LastTime = 0 then
    CurrentDeltaTime := 0
    else
    CurrentDeltaTime := (CurrentTime - LastTime) / 1000;
    end;
    gDeltaTime := CurrentDeltaTime;
    LastTime := CurrentTime;
    TotalTime := TotalTime + CurrentDeltaTime;
    end;
    [/pascal]

    I check for QueryPerformanceCounter/Frequency on initialization phase and use it if possible, if the check fails then I use TimeGetTime which seems to work quite well even on my AMD Athlon X2.
    If you develop an idiot proof system, the nature develops better idiots.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •