Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old May 9, 2016, 12:50   #1
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Reworking the UI

New thread - it's gone well beyond X11 tile support

Unfortunately, my term rework came about as a consequence of the X11 rework, but ultimately I plan to separate the two.

The concepts are pretty well summed up in takkaria's NextUI.

The idea is that each 'term' will be a proper 'virtual terminal', each encompassing a specific game function (message bar, status bar, player info bar, cave area, mini-map, etc). These 'virtual terminal' can then be mapped to physical 'displays' at will - So you could have virtual terminals mapped to individual windows, or you might map basic and extra player stats to the same window (using a y-offset for one to keep them separate, or maybe toggle between them)

The upshot is all about the 'cave' term - the end-goal is that the grid sizes of the cave tile and the text tiles are completely separate.

My work so far has focused on ditching the global 'Term' variable - all term related functions now take a term * argument.

There have been some 'collateral damage'
  • The screen save and load code has been axed - I think it best to trash this and create a better mechanism
  • text_out_to_file() - The global text_out_hook is a horrible hack, so sorry, but out she goes. It's ONLY used for creating the artifact spoiler files anyway
  • There's probably going to be more - we'll see

What I'm doing isn't going to break existing front ends - It will completely shatter them. And I'm sorry, but X11 is the only front end I'm keen to work on at the moment. I can't do Windows or Mac, and I have no idea about the ncurses API - so X11 it is.

I'll TRY to push stuff into my x11-rework branch as often as possible. Once things have stabilised, I'll create a new branch focused on UI

EDIT: I'm just going to dump a todo list here
  • Monster and object tile support in text block

Last edited by calris; May 9, 2016 at 13:20.
calris is offline   Reply With Quote
Old May 9, 2016, 12:51   #2
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Menus will probably be split out into a virtual terminal as well

EDIT: Correction - I think menus will be tied to specific virtual terms like panels and text blocks

Last edited by calris; May 9, 2016 at 14:58.
calris is offline   Reply With Quote
Old May 9, 2016, 14:50   #3
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
So we have struct term, struct panel, and struct textblock these are really well defined constructs that tie in very nicely with each other - i.e. textblocks and panels created arbitrarily and (currently) plotted into a term structure.

Now the term structure is very heavy - maybe we could make panels and text blocks a kind of 'sub term' - i.e. they are intrinsically tied to a term with a specified x/y offset and inherit all of the term's attributes to keep them light.

I'm thinking slightly bigger picture here - how do we support file exports seamlessly?

File I/O is a hodgepodge at the moment. What if we add a file output hook to the term structure? We can have a type flag (text/html) which can dump the contents of a term to file. I've trashed the existing file dump for artifact knowledge, maybe we just create a virtual terminal, hook it into the 'raw text file output' renderer and boom - we're done

Last edited by calris; May 9, 2016 at 15:28.
calris is offline   Reply With Quote
Old May 9, 2016, 14:53   #4
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 53
Posts: 7,223
Donated: $60
Nick is on a distinguished road
If you get all this working for x11, I'm guessing (or at least hoping) we should be able to adapt the other front ends. And I believe this is the direction we want to be heading.

I hope the best thing I can do is stay out of your way, because I'm not getting much Angband time at the moment.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old May 9, 2016, 15:32   #5
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Correction - textblocks are not tied to a specific 'term' - They could be output to the main term, or they could be output to a dedicated term (monster lore for example) - So what we have, in essence, is a 'lite term' - a term that contains attr/char pairs that can be display on any term at will.

Should panels be the same? Panels are slightly fancier text blocks - they contain an array of 'lines', each of which have a label (printed using the basic foreground attribute) and a value (printed using the specified attribute). I see no reason (EDIT: not) to have panels as 'lite terms' that get tied to a term at will - Thus we can have a panel displayed on multiple 'terms' simultaneously.

I see great potential here - Take the 'player extra' term - there are three 'panels' (or are they text blocks?) for resistances and abilities - If you create a tall term window, you can display all three panels vertically. You can put the 'stats' panel(s) in a separate term (if you want to see them)

So basically I see that we have:
  • Panels, Text Blocks, and Menus are are lowest level 'configurable' entities - they are 'lite terms'
  • A 'term' has Text Blocks, Panels, and Menus rendered onto it
  • The 'cave map' and 'cave mini map' are 'special' terms - they are the only terms that 'can' be 'graphical' (NOTE: currently the graphical UIs allow for displaying the player's equipment using graphical tiles, also the monster and object recall need to support displaying a graphical tile)
  • A 'window' has multiple 'terms' mapped to it

The really neat thing about X11 (and I'm sure other graphical front ends) is that we can render terms to a 'virtual window' (XImage) and then just plaster them together in the window - will be HEAPS more efficient when we display a menu and then exit from it - we don't need to redraw any tiles, just redraw the whole XImage

Last edited by calris; May 9, 2016 at 16:04.
calris is offline   Reply With Quote
Old May 11, 2016, 05:20   #6
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,014
Donated: $40
Pete Mack is on a distinguished road
The slow part of the redraw is the cave data. The various text panels redraw too fast to see the change. And pretty much all of them use two canvases for fast (blitted) redraw.

Quote:
Originally Posted by calris View Post
The really neat thing about X11 (and I'm sure other graphical front ends) is that we can render terms to a 'virtual window' (XImage) and then just plaster them together in the window - will be HEAPS more efficient when we display a menu and then exit from it - we don't need to redraw any tiles, just redraw the whole XImage
Pete Mack is offline   Reply With Quote
Old May 11, 2016, 05:30   #7
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,365
AnonymousHero is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
The slow part of the redraw is the cave data. The various text panels redraw too fast to see the change. And pretty much all of them use two canvases for fast (blitted) redraw.
AFAICT the X11 code is Xlib which is... drumroll: synchronous. If the vanilla X11 frontend is anything like the T2 one (which it seems to be given some of the stuff in this thread) it's drawing each single tile using an X11 blit command. Even for a 80x50 grid the delay can be quite noticable and you'll want to draw into an off-screen bitmap. (Plus this also helps avoid the "half-drawn" flicker effect.)

(IME this is noticable both for the "cave" portion of the main window and the "messages" window. YMMV.)

Any optimization that happens inside the "term" structure (I recall it trying to do "diff"-type patchups, only modifying lines flagged as "modified" in the backing structure, etc.) are probably completely swamped by these round-trip delays.

(I imagine it's similar for the other frontends, but haven't looked at the code.)
AnonymousHero is offline   Reply With Quote
Old May 11, 2016, 06:39   #8
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,014
Donated: $40
Pete Mack is on a distinguished road
@AnonymousHero
Ugh. No, all the terms do differential updates on character moves, monster drops, etc. But on full redraws, the other terms all use double-buffering. Without double-buffering, gfx just won't work, and even pure-text will be ugly. That's really bad.
Pete Mack is offline   Reply With Quote
Old May 11, 2016, 07:05   #9
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,365
AnonymousHero is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
@AnonymousHero
Ugh. No, all the terms do differential updates on character moves, monster drops, etc. But on full redraws, the other terms all use double-buffering. Without double-buffering, gfx just won't work, and even pure-text will be ugly. That's really bad.
I think you're assuming something I'm not saying. I wasn't arguing against double-buffering. One should just double-buffer bitmaps and not try any fancy tile-based diffing and such[1]

[1] At best it's completely wasted on modern CPUs and at worst it's a pessimization since modern CPUs thrive on prefetching.
AnonymousHero is offline   Reply With Quote
Old June 13, 2016, 11:58   #10
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
This is relevant to my interests Any news about it?
t4nk is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
RFC: Reworking sound sub-system calris Development 125 April 19, 2016 17:04
Reworking the entire magic system (yay)! TricksterWolf Development 8 September 20, 2015 21:22


All times are GMT +1. The time now is 03:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.