Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


BrokenKingpin

Member Since 09 Apr 2007
Offline Last Active Yesterday, 08:33 AM

Topics I've Started

Roguelike UI Design

25 September 2012 - 04:29 PM

I am looking to creating a roughlike game with a graphical UI, and I am looking to get some input on the design. For those unfamiliar with roguelike games, they are turn based RPGs and are traditionally text based (ascii graphics), but a lot do have graphical front-ends now (for example NetHack). As I indicated above I am looking to have a graphical interface for my game.

I am looking to do the game in C# as that is what I work with everyday for my job. Now the question is what path should I take for the graphics. I know traditionally games like these might use an actual graphics or game library for the UI, such as SDL or XNA, but because of the nature of a roguelike game I am wondering if standard WinForms (or WPF) UI would be better.

Here are a few of my reasons why I am leaning towards WinForms or WPF:

1. Since the game is turned based, and the graphics and animations will be simplistic, it does not really need that high performance game loop. This has the added benefit of not needing to have a game loop that continuously run through and redisplay things, as it would only need to do anything once the player has selecting the next action/move.

2. Added flexibility in the way I can display data. WinForms or WPF already provides a large number of controls for displaying data (for example grids for displaying inventory). Also, I would be able to display data in different forms and windows. For example, you could have your main game window, and a separate window for displaying inventory or stats. This will also allow you to use multiple monitors. Basically with a graphics library I would be trying to emulate these controls, drag and drop, etc, so using this would avoid all that work.

I guess the disadvantage would be that I would not be able to support a lot of animations, and might be harder to display the tiles and sprites. Also doing it with all graphics will make it look more like a traditional game, and less like a desktop application. I am wondering if it would just be easier in the long run to go XNA and a traditional game loop.

Any input on this would be great, thanks!

Choppy Sprite Movement

22 August 2009 - 06:56 PM

I am having problems with moving my sprites smoothly. After reading this article I updated my game loop to the last one described (I also put the code below): http://dewitters.koonsolo.com/gameloop.html The sprits are moving at a constant speed regardless of frame rate, but fast moving sprites still look choppy. I have it so on every update_game() a car moves 10.0f. When the display_game() function is called I do the following:
car.x_view_pos = car.x_pos + (speed * interpolation)

Does anyone have any ideas on how to smooth this out? It is frustrating because the game is running at 100+ fps. Game Loop
    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 );
    }



How do I mirror sprite frames?

27 May 2009 - 05:58 AM

I have a sprite sheet of a character walking to the right, and I have that working fine. Now I need to make the character walk to the left. I can do that by duplicating the sprite sheet graphic, mirroring all the sprite tiles and switching the sprite sheet (or set of frames in a sheet) depending on which way the character is walking. My problem is I do not want to duplicate all the sprite sheets and mirror them with a graphics editor program. I was hoping there was a way to just mirror the frame in code. Here is the code I am using to load and display the sprites:
LPD3DXSPRITE sprite;
LPDIRECT3DTEXTURE9 image;

void Sprite::LoadSprite()
{
    //create sprite handler object
    D3DXCreateSprite(d3ddev, &sprite);

    //load texture with "pink" as the transparent color
    image = LoadTexture("graphics/spritesheet.bmp", D3DCOLOR_XRGB(255,0,255));

    //initialize the sprite's properties
    x = 20;
    y = 20;
    width = 50;
    height = 64;
    curframe = 1;
    lastframe = 7;
}

void Sprite::DisplaySprite(TileMap* map)
{
    //start sprite handler
    sprite-&gt;Begin(D3DXSPRITE_ALPHABLEND);

    //create vector to update sprite position
    D3DXVECTOR3 position( (float)x, (float)y, 0 );

    //configure the rect for the source tile
    RECT srcRect;
    int columns = 8;
    srcRect.left = (curframe % columns) * width;
    srcRect.top = (curframe / columns) * height;
    srcRect.right = srcRect.left + width;
    srcRect.bottom = srcRect.top + height;

    //draw the sprite
    sprite-&gt;Draw(
        image, 
        &srcRect,
        NULL,
        &position,
        D3DCOLOR_XRGB(255,255,255));
    
    //stop drawing
    sprite-&gt;End();
}

Any help on doing this would be great!

PARTNERS