Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


utilae

Member Since 08 Dec 2004
Offline Last Active Feb 05 2013 08:14 PM

Topics I've Started

Vector Errors during compile in Visual Studio 2008

12 August 2008 - 08:17 PM

Hi, I am using C++ and am compiling my code in Visual Studio 2008 on Windows XP. Previously my code compiled fine in Visual Studio 2003, but now in VS2008 it gives me the following two errors. Maybe I don't have visual studio 2008 setup right. Any ideas. Thanks.
1>error C2440: 'initializing' : cannot convert from 'int' to 'std::_Vector_iterator<_Ty,_Alloc>'
1>        with
1>        [
1>            _Ty=RECT,
1>            _Alloc=std::allocator<RECT>
1>        ]
1>        No constructor could take the source type, or constructor overload resolution was ambiguous


1>error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_Vector_iterator<_Ty,_Alloc>' (or there is no acceptable conversion)
1>        with
1>        [
1>            _Ty=RECT,
1>            _Alloc=std::allocator<RECT>
1>        ]
1>        c:\program files\microsoft sdks\windows\v6.0a\include\guiddef.h(197): could be 'int operator !=(const GUID &,const GUID &)'
1>        c:\program files\microsoft visual studio 2008\vc\include\vector(214): or       'bool std::_Vector_const_iterator<_Ty,_Alloc>::operator !=(const std::_Vector_const_iterator<_Ty,_Alloc> &) const'
1>        with
1>        [
1>            _Ty=RECT,
1>            _Alloc=std::allocator<RECT>
1>        ]
1>        while trying to match the argument list '(std::_Vector_iterator<_Ty,_Alloc>, int)'
1>        with
1>        [
1>            _Ty=RECT,
1>            _Alloc=std::allocator<RECT>
1>        ]


Setup Visual Studio 2008 Project for Unmanaged/Native Code - How?

11 August 2008 - 11:32 PM

Hi, I am using C++ and on Windows XP. I am new to Visual Studio 2008 having previously used Visual Studio 2003. How do you setup the project to use native / unmanaged code. Thanks

When moving object around it moves smoothly but with jaggies and refresh artifiacts

21 February 2008 - 07:04 PM

Hi, I am using C++ and Direct3D9. When I move an object around on the screen at speed, I get the jaggies and refresh artifacts (possible blurring). Putting Vertical Sync on fixes this and makes it smooth, but everything is slow and the mouse movement is 'late' in terms of where you direct it. So V_Sync is not an option. I am working on a laptop with a good graphics card. The refresh rate is at 60Hz and I notice that when I move a notepad window around in windows xp sp2 it also does the same thing. But when playing games, ie guild wars, its perfect, no jaggies etc. So is this common for laptops? Would all games made for laptops do this. Or is there some way to cater for those on laptops. Edit: ok Guild Wars is using wait for vertical sync, but it is not as slow as my program when my program uses vertical sync. Help?

Frame Rate Independent Game Loop Article Question

19 February 2008 - 07:16 PM

Hi, I just read this article cause I want to make my game loop frame rate independent as described in the article, but I only just reaslised a problem. http://dewitters.koonsolo.com/gameloop.html Aren't the update and render sections of code mean't to be separate. In the article it is separate, but as he explains, the render function is used to update the cars position. 1) So here in this code I have taken from the article, it is updating the car in the display_game( interpolation ) section of code. I would have prefered to do this somehow in the update_game() section of code. What changes would be made, if any? 2) Also how would this game loop work on slow computers? Any suggestions?
    const int TICKS_PER_SECOND = 25;
    const int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
    const int MAX_FRAMESKIP = 5;

    DWORD next_game_tick = GetTickCount();
    int loops;
    float interpolation;

    bool game_is_running = true;
    while( game_is_running ) {

        loops = 0;
        while( GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP) {
            update_game();

            next_game_tick += SKIP_TICKS;
            loops++;
        }

        interpolation = float( GetTickCount() + SKIP_TICKS - next_game_tick )
                        / float( SKIP_TICKS );
        display_game( interpolation );
    }


About the interplation bit:
Quote:
Take this example: I have a car that moves every game tick like this: position = position + speed; If in the 10Th gametick the position is 500, and the speed is 100, then in the 11Th gametick the position will be 600. So where will you place your car when you render it? You could just take the position of the last gametick (in this case 500). But a better way is to predict where the car would be at exact 10.3, and this happens like this: view_position = position + (speed * interpolation) The car will then be rendered at position 530. So basically the interpolation variable contains the value that is in between the previous gametick and the next one (previous = 0.0, next = 1.0). What you have to do then is make a "prediction" function where the car/camera/... would be placed at the render time. You can base this prediction function on the speed of the object, steering or rotation speed. It doesn't need to be complicated because we only use it to smooth things out in between the frames. It is indeed possible that an object gets rendered into another object right before a collision gets detected. But like we have seen before, the game is updated 25 frames per second, and so when this happens, the error is only shown for a fraction of a second, hardly noticeable to the human eye.

Game Loops - Frame Rate Independance, Whats the best method?

26 January 2008 - 12:24 PM

Hi, I am using C++ and windows xp os. I have a game loop I am using, but it is standard, so I want to make it frame rate independant or time based. I want to make it have a max frames per second. Updates to be updated every x frames. Rendering to be done every y frames. Also it would be nice to have it run smoother on old machines by skipping frames and take advantage on newer machines by rendering more etc. I have seen many examples as a result of searching the forums and have noticed that there appear to be different types eg Euler Game Loop and Canonical Game Loop. What are the differences, advantages and disadvantages between these types. Anyway, any suggestions on what would be an ideal game loop to use?

PARTNERS