Author Topic: Upgrading The Interface Format  (Read 4240 times)

0 Members and 1 Guest are viewing this topic.

Offline DocClox

  • Dev Team
  • *****
  • Posts: 1867
  • Messing Around With Python
Upgrading The Interface Format
« on: October 17, 2009, 04:08:59 AM »
Here's an idea. Make the Interface files use XML, and have WYSIWYG editor for them. Sound like a lot of work? Well, yes, but...

Suppose the XML format we adopt is XHTML? Then we could use any old web page editor to design screens, so long as it outputs valid XHTML, and then just ignore anything we don't like (like hyperlinks).

The problem, of course, is that the really cool stuff for screen design would be CSS, and that's not XML based

XML might be the way to go, anyway however. Currently you've got (it seems) a set of fields that are order dependant, which is a bit fragile, and makes it a real bugger to do things like allowing modders to add floating images. We could do that with XML and have  a bit more flexibility.

Need to write our own editor, in which case, though.

Other options might be to use Webkit or Xulrunner, although that really turns the game into a webapp, and opens up some security issues we'd probably sooner stayed closed.

Anyway, that's my tuppence ha'penny's worth on the subject. Anyone else?

Offline trex

  • Donator
  • *****
  • Posts: 143
Re: Upgrading The Interface Format
« Reply #1 on: October 18, 2009, 07:53:38 PM »
Well something I would like is the addition to resize the screen. Fullscreen would be nice, but an option to manually size the window would be just as good.

Anything that lets modderrs improve the games sounds great, the UI is an area modding would make a great difference. I guess it just comes down to the priority of recoding something that works ok as is, over adding/ bug killing.

Offline Dagoth

  • Administrator
  • *****
  • Posts: 617
Re: Upgrading The Interface Format
« Reply #2 on: October 18, 2009, 11:18:41 PM »
Really, he could just have any lines past the main known ones to be considered as an image. The line format could be the same, with the addition of a filename field on the end. Like so:
8 48 584 480 brothelback2.jpg

You could then add as many images as desired like that, each on their own line. If necessary, they could be prefixed with a number indicating how many such images to process (like is done for processing traits and such in the other files).
The images would preferably be added in the background behind everything else (placed before everything else if that's needed to get the order correct) in the order that they're given in the file. That way, they could be used as background images for text and other controls.

I doubt I'd actually use that much myself, but it would still be quite handy.

EDIT: a more detailed example, using BrothelScreen.txt as an example:
Code: [Select]
16 20 768 576 1 WINDOW - XPos, YPos, WIDTH, HEIGHT, BORDERSIZE
600 258 160 32 Girl Management BUTTON - XPos, YPos, WIDTH, HEIGHT
600 298 160 32 Staff Management BUTTON - XPos, YPos, WIDTH, HEIGHT
600 338 160 32 Upgrades BUTTON - XPos, YPos, WIDTH, HEIGHT
600 398 160 32 Dungeon BUTTON - XPos, YPos, WIDTH, HEIGHT
600 458 160 32 Visit town BUTTON - XPos, YPos, WIDTH, HEIGHT
184 536 160 32 Save BUTTON - XPos, YPos, WIDTH, HEIGHT
600 536 160 32 Next Day BUTTON - XPos, YPos, WIDTH, HEIGHT
432 536 160 32 Turn summary BUTTON - XPos, YPos, WIDTH, HEIGHT
8 536 160 32 Quit BUTTON - XPos, YPos, WIDTH, HEIGHT
600 208 72 32 Prev BUTTON - XPos, YPos, WIDTH, HEIGHT
688 208 72 32 Next BUTTON - XPos, YPos, WIDTH, HEIGHT
8 48 584 480 Image - x,y,width,height
600 48 160 152 10 Brothel Details text - xpos, ypos, width, height, fontsize
16 8 900 64 20 Brothel Name text - xpos, ypos, width, height, fontsize
3
8 48 584 480 brothelback2.jpg
8 248 584 480 brothelback3.jpg
8 448 584 480 brothelback4.jpg

Another interface request:
Give us the ability to change the height of listbox entries, or alternately necno could simply change the size himself; they're currently too tall really, wasting space which could used to display more entries.
« Last Edit: October 18, 2009, 11:21:26 PM by Dagoth »

Offline necno

  • Core Developer
  • ******
  • Posts: 385
Re: Upgrading The Interface Format
« Reply #3 on: October 19, 2009, 07:20:50 PM »
Resolution change will be implemented once i finish finalizing the interfaces (as i finalize i create the txt document for editing).

I can implement images as Dagoth (Elder Scrolls ref?) stated its not difficult to do.

As for a separate editor for interfaces and XML format. Well i just don't see it as needed especially vs the time to code, i just use Photoshop to design interfaces (although i always do a rush job). Only takes a little longer to copy the x/y stuff into the text file.
Click here to donate
After you do so please pm me the email address you used so I can add you to the donation forum.

Working on:
Whoremaster II (Official)
Birthright (Now a commercial rougelike)

Offline DocClox

  • Dev Team
  • *****
  • Posts: 1867
  • Messing Around With Python
Re: Upgrading The Interface Format
« Reply #4 on: October 20, 2009, 05:40:09 AM »
I can implement images as Dagoth (Elder Scrolls ref?) stated its not difficult to do.

It's a workaround, certainly.  It's still fragile, though and I just think the current approach is going to scale  well. Sooner or later, I think you'll need something a bit more sophisticated.

[edit]

If we do it that way, we'll need some way to handle Z-Ordering. As it stands, items at the bottom are going to be painted on top of everything else. That means we can't use them as sight-screens for text, or to group UI elements.

You can change that so end-of-file images are always on the bottom of course, but then you can't do things like create image frames that partially cover the picture area.

As for a separate editor for interfaces and XML format. Well i just don't see it as needed especially vs the time to code, i just use Photoshop to design interfaces (although i always do a rush job). Only takes a little longer to copy the x/y stuff into the text file.

I agree about pasting in the numbers; I was just thinking that XHTML would give us a free editor, in effect. Certainly a home made wysiwyg editor is way too much work for the benefit derived.

As for the XML format itself, if the work involved is the only objection, I'd be happy to take a crack at it for you. I'd use TinyXML to do the hard work of parsing the files. After that, it's just a case of packing the UI information into the structures you use currently.
« Last Edit: October 20, 2009, 09:13:57 AM by DocClox »

Offline necno

  • Core Developer
  • ******
  • Posts: 385
Re: Upgrading The Interface Format
« Reply #5 on: October 20, 2009, 05:04:07 PM »
hmmm, well as your one of the people that will be getting a copy of the code once i get the new way buildings operate finished your more then welcome to do so. ;D
Click here to donate
After you do so please pm me the email address you used so I can add you to the donation forum.

Working on:
Whoremaster II (Official)
Birthright (Now a commercial rougelike)

Offline DocClox

  • Dev Team
  • *****
  • Posts: 1867
  • Messing Around With Python
Re: Upgrading The Interface Format
« Reply #6 on: October 22, 2009, 05:41:12 PM »
In which case, a couple more things I might look at.

One of them would be allowing user buttons and text fields to go with the images. Allow buttons to be hooked up to scripts, so the can actually do something. Do that, and the modders can really go to town on the interface.

The other thing I quite fancy doing is adding Lua as a script engine. It's small, free, widely used, and emerging as an industry standard for scriptable games. Plus, I already have a working prototype I wrote for another project :)