Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 23

Author Topic: [PRINT_MODE:SHADER]  (Read 85254 times)

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
[PRINT_MODE:SHADER]
« on: October 09, 2011, 07:24:19 pm »

[ README | Download | Source code  ]
 

26 June 2013.

About half a year ago this project morphed from simply patching up graphics code to an all-out attempt to bring graphics, and all other supporting code up to date.

As of today, it reached feature-parity with the old code, some amount of bugs present nonwithstanding.

For more information please see the README link above, and read the tail of this topic.

Spoiler: Older message text (click to show/hide)







« Last Edit: June 26, 2013, 12:27:23 pm by lxnt »
Logged

NobodyPro

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #1 on: October 09, 2011, 09:54:17 pm »

Forgive me if I'm a little very suspicious what with your one post and gibberish username. In layman's terms, what is this and how have you done it?
Logged

magistrate101

  • Bay Watcher
  • That one kid.
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #2 on: October 09, 2011, 10:17:39 pm »

Forgive me if I'm a little very suspicious what with your one post and gibberish username. In layman's terms, what is this and how have you done it?
To answer the first half of your laymen's terms question, it is a program/script that uses a different renderer than regular df, and thus offloads graphics-related computations entirely onto the GPU (From what I can get out of it, anyways)
I have no idea HOW, as I am not a coder.
edit:
« Last Edit: October 09, 2011, 10:20:11 pm by magistrate101 »
Logged

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #3 on: October 10, 2011, 08:49:19 pm »

More development ensued.

Zoom/resize fixed to more-or-less playable state.
I made an attempt to save screen[] contents from being overwritten with creatures, so that in graphics mode they can be drawn on top of floors, grass, etc. Not guaranteed to work in all cases. It would be much better if the core game did not overwrite screen[] array with characters for creatures if in graphics mode and there's something to put into screen_texpos[].
Putting 'action animation' code into yet another layer would be even better.

As for what this thread is about: yes, it's about making graphics snappy, especially when zoomed out.

As for how I did it - I used OpenGL point sprites instead of two triangles per tile, and I moved whatever graphic-related calculations were done on CPU to the GPU. These were - calculating offsets (in the single texture image) for each tile and uploading each tile individually (with about 3700 tiles that was slow) - on each resize. This particularly slowed down loading a saved game.

Calculating and uploading colors and texture coordinates for each tile, or, alternatively, finding out which tiles changed. Uploading triangle data - 6x number of tiles. Both done to draw each frame. Either way, when zoomed out to 256x256 tile screen this was way too slow too.

Result: zoom in/out feels much better. Also you can see barrels behind dwarves that drink from them.


Question for developers: what is textures::clone_texture() for?
« Last Edit: October 10, 2011, 09:00:51 pm by lxnt »
Logged

magistrate101

  • Bay Watcher
  • That one kid.
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #4 on: October 10, 2011, 10:44:30 pm »

Code: [Select]
Traceback (most recent call last):
  File "C:\df_opengl\t3.py", line 422, in <module>
    loader = FrameLoader(sys.argv[1])
IndexError: list index out of range
what?

edit: using windows8 (df works fine on it, and so does python), using python 2.6.6.
edit2: I don't get a single hit offa google for your question on "textures::clone_texture()"  ???
« Last Edit: October 10, 2011, 11:04:37 pm by magistrate101 »
Logged

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #5 on: October 11, 2011, 06:38:38 am »

The error you encountered means that it expected an argument (three actually) but did not get one.

usage: ./t3.py <screendump-filename> <desired-fps> <start_frame>

It also expects texdump0002.png and shaders in the current directory.
A screendump and texdump are supplied, erm, were supplied in previous version (forgot it this time), so get it and try running it like :

./t3.py screendump 10 0

screendump was generated by dumping every 4th or 5th frame, so playback is jerky.

Controls: mouse wheel - zoom, left mouse button and space - pause/unpause, right mouse button drag - panning, esc - quit


textures::clone_texture() is an internal df function that gets called from core game, so the question was directed more at people familiar with code we don't get to see, i.e. Toady.
« Last Edit: October 11, 2011, 07:00:33 am by lxnt »
Logged

magistrate101

  • Bay Watcher
  • That one kid.
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #6 on: October 11, 2011, 04:37:45 pm »

The error you encountered means that it expected an argument (three actually) but did not get one.

usage: ./t3.py <screendump-filename> <desired-fps> <start_frame>

It also expects texdump0002.png and shaders in the current directory.
A screendump and texdump are supplied, erm, were supplied in previous version (forgot it this time), so get it and try running it like :

./t3.py screendump 10 0

screendump was generated by dumping every 4th or 5th frame, so playback is jerky.

Controls: mouse wheel - zoom, left mouse button and space - pause/unpause, right mouse button drag - panning, esc - quit


textures::clone_texture() is an internal df function that gets called from core game, so the question was directed more at people familiar with code we don't get to see, i.e. Toady.
Thanks, and the information is nice to know, I suppose :P

edit: zooming crashes it, and all I see is grey with white and black dots :\
« Last Edit: October 11, 2011, 04:44:46 pm by magistrate101 »
Logged

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #7 on: October 12, 2011, 06:46:29 am »

Testbed's code somewhat lagged behind c++ code, so crashes are not that surprising.

I'll be releasing a version later this week that would have all functionality standard print_mode has, both in c++ and python code. Then will be time for thorough testing.

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #8 on: October 16, 2011, 09:21:50 am »

bump. see top post.

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #9 on: October 16, 2011, 02:32:27 pm »

This is quite interesting.
Would you be able to make it so that zooming only affects the world view and not the menus?
Logged
<3

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #10 on: October 16, 2011, 05:39:05 pm »

Would you be able to make it so that zooming only affects the world view and not the menus?

I'm not sure if it's impossible. Seems like the entire interface is drawn through the code in g_src/interface.cpp,
and if it's in fact so, this is what I'll be doing after I fix zoom/resize.

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #11 on: October 16, 2011, 05:41:33 pm »

Oh my godddd the implications of this...

EDIT: just to be sure: my dream is for the interface to be displayed at 16x16 px (can be downscaled 32x32px, I don't mind) while the world view would be displayed at 32x32px (and using 32x32px icons, not upscaled 16x16 ones).
« Last Edit: October 16, 2011, 05:46:30 pm by Mike Mayday »
Logged
<3

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #12 on: October 17, 2011, 07:53:51 am »

EDIT: just to be sure: my dream is for the interface to be displayed at 16x16 px (can be downscaled 32x32px, I don't mind) while the world view would be displayed at 32x32px (and using 32x32px icons, not upscaled 16x16 ones).

I have separating map and interface zoom and fonts in plans - see the readme file for what exactly I do plan.

However, I'm no artist, someone would have to actually draw tile/graphics sets in resolutions you want.

kingofthescots

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #13 on: October 17, 2011, 09:13:56 am »

I hope someone compiles this for windows soon. This looks like quite an interesting development, and I'd like to see it in action.
Logged

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #14 on: October 17, 2011, 10:33:22 am »

EDIT: just to be sure: my dream is for the interface to be displayed at 16x16 px (can be downscaled 32x32px, I don't mind) while the world view would be displayed at 32x32px (and using 32x32px icons, not upscaled 16x16 ones).
I have separating map and interface zoom and fonts in plans - see the readme file for what exactly I do plan.
However, I'm no artist, someone would have to actually draw tile/graphics sets in resolutions you want.

That would be yours truly.
Logged
<3
Pages: [1] 2 3 ... 23