Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

Having tested both 2D and STANDARD, how is 40d19 compared to 40d?

Faster, no (unknown) problems
Faster, problematic
Same speed, no (unknown) problems
Same speed, problematic
Slower, no other (unknown) problems
Slower, problematic
Doesn't work at all

Pages: 1 2 3 [4] 5 6 ... 34

Author Topic: FotF: Dwarf Fortress 40d19  (Read 163190 times)

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #45 on: March 05, 2010, 11:12:37 am »

Rafal99: The bugs are known, but just because they're late d#-specific doesn't mean I can do anything about them.

They're due to the input layer conversion being done a bit haphazardly on the DF side, and won't be around in DF2010.. that's about all I can say on the matter.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

Chrispy

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #46 on: March 05, 2010, 11:16:45 am »

With windows 7x64, plenty of ram, an i7 and dual 4850's.  Reformated 30 hours ago, no video card drivers installed except the defaults.

My save folder is ~58Mb, which might account for some crashes while saving?
SINGLE_BUFFER:NO for all unless stated.
Using the 'shader' option.
Spoiler (click to show/hide)

VBO:~93fps
FRAME_BUFFER: ~98fps
ACCUM_BUFFER: Blinks madly on the title screen, changes on resize, switching on-top-ness, locks up, ~110fps, (very hard to tell), massive flickering ingame, crashes on save
ACCUM_BUFFER and SINGLE_BUFFER:YES; ~100fps, crash on save again.
Partial and no causes flickering on the title screen
Partial:1 ~103 fps
Standard: ~97fps
2DASYNC:~102fps
Logged
Quote from: Toady
"This suggestion is very broad."
≡«+large yellow diamond+»≡
On the item is an exceptionally designed image of a diamond in yellow diamond.

Tellemurius

  • Bay Watcher
  • Positively insane Tech Thaumaturgist
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #47 on: March 05, 2010, 11:20:27 am »

i think version 16 should be implemented, it seems every update now the game gets more buggy.

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #48 on: March 05, 2010, 12:05:46 pm »

Not on linux, I hope.. *sigh*

You might be right. This way of developing isn't working out.. okay. I'm going to try making battle champs work again. I have a much better chance at fixing the various bugs if I can actually debug the code.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

jaked122

  • Bay Watcher
  • [PREFSTRING:Lurker tendancies]
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #49 on: March 05, 2010, 12:06:35 pm »

Honestly if there are those kinds of errors, i think we should find someone a little more competent to code the sdl/opengl part. Why the hell your even using opengl i dont know. Only need SDL. No reason to have opengl honestly.
You know, in FOSS world you either do it yourself or STFU.

If this guy knew what he was doing there would be no bugs right now :)

And i could easly setup SDL code, OpenGL no since df is never going to be 3d without a major rewrite. So theres no point in coding in opengl, sdl will work fine for graphics.

So yes i could easly teach toady how to use sdl, its not that hard to do :)
for the sake of god, if toady knew what he was doing, this entire branch wouldn't be necessary, there are multiple ways to do something, some are good for certain situations, some are good for others. some aren't good at all, but they all have merit, and a good fraction of them work, there is no way to 'know' how to do something until it has been done, the bugs have been revealed and understood. honestly I doubt that the best programmers could have done much better on this project, they didn't think of dwarf fortress, so they didn't do it.

that was a ramble.

Keizo

  • Bay Watcher
  • Proving dwarven motorcycle gangs are yankees too.
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #50 on: March 05, 2010, 01:07:33 pm »

Did anyone get the shaders to work? If so, is it possible for one of you kind folks to post screenshots of this feature in action? I don't know what a shader is for in the context of DF and I'm curious if this is a new feature I should be possibly excited about... thanks!
Logged
火族

TheSpaceMan

  • Bay Watcher
    • View Profile
    • http://www.digital-lifeform.com
Re: FotF: Dwarf Fortress 40d19
« Reply #51 on: March 05, 2010, 01:10:27 pm »

I have not replied for posts on the forum for ages. But seeing some of the lack of knowledge in the forum I just feel that I need to do a short post.

No excuse my language for a bit good folks.

First of all sdl is slow as FUCK, this is one of the main problems today, it's not about how big area you draw, if it's just "2d" etc. The costly part is the number of draw calls and what handles the actual drawing.

I am taking some of this data from my memory so stay with me. A non size changed Dwarf fortress screen is 80*25 units. Thats 2000 objects. In a simple SDL layout that would be roughly 2000 blit calls per frame with access to diffrent part of different textures containing the data needed. To keep a frame rate of 30 fps. thats 60 000 blits per second.

With sdl most of this is handled on cpu level, the logic is also handled on the cpu, if the rendering takes to long it will affect the logic and wise versa.

A modern computer in this day of age has a Graphical Processing Unit. This is called a GPU, in most cases it got it's own memory and this card is a master of floating point math operations. The card is built mostly for 3d operations, but it also got registers for 2d textures.

With something like OpenGL, you can transfer the workload of rendering, from the cpu to the gpu. We still need to know what we want to render where but the actual process of getting all our 2000 tiles on screen is now more of gpu issue.

I would like to try to do a full focused window version using the gpu as the workhorse as well. But i don't know if I have the time with current projects going on.

I am impressed and know the amount of work people have put in to this.

Quite simply, just doing it trough SDL won't cut it.

Sorry for my rambeling, and have a great weekend all you dwarf lovers out there.
By now someone have probably posted more things regarding this.

//TheSpaceMan
Logged
Poking around with a DFParser.
Bodypart names, creatures names in one easily overviewable place.

Oh my new (old) picture?

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #52 on: March 05, 2010, 01:18:50 pm »

Did anyone get the shaders to work? If so, is it possible for one of you kind folks to post screenshots of this feature in action? I don't know what a shader is for in the context of DF and I'm curious if this is a new feature I should be possibly excited about... thanks!

It doesn't make the game look different, it's just a different rendering path that should be faster for people with up-to-date video cards.
Logged

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #53 on: March 05, 2010, 01:19:17 pm »

Did anyone get the shaders to work? If so, is it possible for one of you kind folks to post screenshots of this feature in action? I don't know what a shader is for in the context of DF and I'm curious if this is a new feature I should be possibly excited about... thanks!
They look exactly the same as DF usually does. It's just faster, that's all. Well, when it works; the main reason for including them in this version was to see the errors when they don't.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

The-Moon

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #54 on: March 05, 2010, 01:22:23 pm »

Bug free version of drawing stuff with sdl, also included the text, but didnt bother with the audio, what was the big deal?

dont need much more then this code for dwarf fortress, no need for opengl :)

Linker : -lmingw32 -lSDLmain -lSDL -lSDL_ttf

Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <cstdlib>

#include "SDL\SDL.h" // main SDL header
#include "SDL\SDL_ttf.h"
//#include "SDL_mixer.h"

#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480

using namespace std;

int InitVideo();
void Draw_Surface(int locX, int locY, int surfX, int surfY, SDL_Surface *surface);
void Run_Game();
void Check_Keys();

FILE * ctt = fopen("CON", "w" ); //This is added in for rerouting the sdl log back to the console :)

SDL_Surface *screen; //This pointer will reference the backbuffer
SDL_Surface *tiles;
SDL_Event keyevent; //The SDL event that we will poll to get events.

struct Map_Data
{
    int Tile;
};

Map_Data Map[10][10];

int charX = 0, charY = 0, dir = 0;
int iCA = 0, iCB = 0;

int END_GAME = 0;

TTF_Font* font;

TTF_Font* loadfont(char* file, int ptsize)
{
  TTF_Font* tmpfont;
  tmpfont = TTF_OpenFont(file, ptsize);
  if (tmpfont == NULL){
    printf("Unable to load font: %s %s \n", file, TTF_GetError());
    // Handle the error here.
  }
  return tmpfont;
}

int main(int argc, char *argv[])
{
    if (InitVideo() == 0) {system("PAUSE"); return 0;}

    if (TTF_Init() == -1)
    {
        cout << "Cant init font\n";
        //printf("Unable to initialize SDL_ttf: %s \n", TTF_GetError());
    }

    font = loadfont("arial.ttf", 16);

    tiles = SDL_DisplayFormat(SDL_LoadBMP("tiles.bmp"));
    SDL_SetColorKey(tiles, SDL_SRCCOLORKEY, SDL_MapRGB(tiles->format, 255, 0, 255));

    if (tiles == NULL)
    {
        printf("Unable to load tiles: %s\n", SDL_GetError());
        return 0;
    }

    for (int iA = 0; iA < 10 ; iA++)
    {
        for (int iB = 0; iB < 10 ; iB++)
        {
            Map[iB][iA].Tile = 0;
        }
    }

    SDL_EnableKeyRepeat(1, 100);

    Run_Game();
    //ctt.close();

    SDL_FreeSurface(tiles);

    return 0;
}

void Run_Game()
{
    SDL_Color color = {150,150,150};
    SDL_Surface *text_surface;

    while (END_GAME == 0)
    {
        cout << "Loop\n";

        Check_Keys();

        for (int iY = 0;iY < 10;iY++)
        {
            for (int iX = 0;iX < 10;iX++)
            {
                if (Map[iX][iY].Tile == 0)
                {
                    Draw_Surface(200 + (iX * 16), 200 + (iY * 16), 0, 0, tiles);
                }
                else
                {
                    Draw_Surface(200 + iX * 16, 200 + iY * 16, 0, 16, tiles);
                }
            }
        }


        Draw_Surface(200 + (charX*16), 200 + (charY*16), 32, 0, tiles);


        if(!(text_surface=TTF_RenderText_Solid(font,"Hello World!",color)))
        {
        }
        else
        {
            SDL_BlitSurface(text_surface,NULL,screen,NULL);
            SDL_FreeSurface(text_surface);
        }

        SDL_Flip(screen);
        SDL_Delay(1);
    }

    return;
}

void Check_Keys()
{
    while (SDL_PollEvent(&keyevent))   //Poll our SDL key event for any keystrokes.
    {
        switch(keyevent.type)
        {
            case SDL_KEYDOWN:
                switch(keyevent.key.keysym.sym)
                {
                case SDLK_LEFT:
                    if (charX > 0 ) {charX--;}
                    break;
                case SDLK_RIGHT:
                    if (charX < 9 ) {charX++;}
                    break;
                case SDLK_UP:
                    if (charY > 0 ) {charY--;}
                    break;
                case SDLK_DOWN:
                    if (charY < 9 ) {charY++;}
                    break;
                case SDLK_ESCAPE:
                    END_GAME=1;
                    break;
                default:
                    break;
                }
//            case SDL_KEYUP:
//                switch(keyevent.key.keysym.sym)
//                {
//                    case SDLK_LEFT:
//                        break;
//                    case SDLK_RIGHT:
//                        break;
//                    case SDLK_UP:
//                        break;
//                    case SDLK_DOWN:
//                        break;
//                    default:
//                        break;
//                }

        }
    }
}

void Draw_Surface(int locX, int locY, int surfX, int surfY, SDL_Surface *surface)
{
    SDL_Rect src, dest;

    src.x = surfX;
    src.y = surfY;
    src.w = 16;
    src.h = 16;

    dest.x = locX;
    dest.y = locY;
    dest.w = locX + 16;
    dest.h = locY + 16;

    SDL_BlitSurface(surface, &src, screen, &dest);

    return;
}

int InitVideo()
{
    // Load SDL
    if (SDL_Init(SDL_INIT_VIDEO) != 0)
    {
        fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
        return 0;
    }

    freopen( "CON", "w", stdout ); //Set App back to using the console for text display

    atexit(SDL_Quit);

    screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_DOUBLEBUF);

    if (screen == NULL)
    {
        fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError());
        return 0;
    }

    return 1;
}
Logged
There is absolutely no time, to be taking time for granted. ~Busta Rhymes

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #55 on: March 05, 2010, 01:24:20 pm »

Now do it with minimal CPU use, at 20 frames per second, with a 180x85 grid, and support non-QWERTY and non-US keyboards.

And when you're done with that, I've got a couple dozen other requirements before it's very useful.

Or better yet, download the source code from the first post, and fix that. It's right there. The link beckons. What's stopping you?
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

The-Moon

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #56 on: March 05, 2010, 01:43:51 pm »

Now do it with minimal CPU use, at 20 frames per second, with a 180x85 grid, and support non-QWERTY and non-US keyboards.

And when you're done with that, I've got a couple dozen other requirements before it's very useful.

Or better yet, download the source code from the first post, and fix that. It's right there. The link beckons. What's stopping you?

Already practically at minimal cpu usage, code could be cleaned up more of course, i only posted that code to show how simple you could setup what was needed for df to draw graphics.

I have no knowledge of opengl :)

Wouldnt be much help there.
Logged
There is absolutely no time, to be taking time for granted. ~Busta Rhymes

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #57 on: March 05, 2010, 02:12:02 pm »

Battlechamps is a bust. There's no way I can make that work with the current codebase now.

Hm. OKay, so am I correct in assuming that nobody's having serious issues on linux? It's all basically windows or OS X?

..I've got to figure out a way to develop/debug on those platforms too. :-/
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #58 on: March 05, 2010, 02:24:01 pm »

The-Moon: Believe it or not, I did something like that once too. Mine used opengl, mind you.

And then I tried to actually link it with DF, and discovered that things were not as simple as they seemed.

They possibly *should* be, but I'm laboring under the restriction that I must not change any interface severely, under pain of the compiled code no longer working with the binary-only DF executable. I can also only test it or debug on linux.

This is admittedly a great improvement on what I had before 40d12, when the only way to test anything at all was to send the code to Toady, and have him compile it. Sometimes there'd be compilation errors.

Please, don't assume I don't know what I'm doing on the programming side of things. It's the interface side of things - DF and windows' notion of opengl - that are giving me nightmares.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

darkrabite

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #59 on: March 05, 2010, 02:25:36 pm »

Have you tried a virtual machine? vmware or virtual pc work pretty well in general, tho i've never tried to use df in one.

wish i could help with your development code-wise, but maybe i can help on this part.

=)
edit:
if its a matter of having toady compile using code only he has access to, it might be possible to make a blind version compile with some trickery. i'd have to know more about the tools toady is using to do his development (not the code itself), but this might make development of your half easier.

« Last Edit: March 05, 2010, 02:35:44 pm by darkrabite »
Logged
Pages: 1 2 3 [4] 5 6 ... 34