RII - Resolution Independent Interface [UPDATE :RII v4f][message #204918]
|
Fri, 26 December 2008 01:39
|
|
BirdFlu |
![](/images/ranks/master_sergeant.png) |
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
Downloads :
[2009.09.18] bugfix release ja2v113_rii_alpha_v4f.7z . Fixes the main menu buttons offset computation bug.
[2009.09.10] download file ja2v113_rii_alpha_v4d.7z , see install instructions in INSTALL.TXT.
Edit: fixed clipping bug; re-uploaded as ja2v113_rii_alpha_v4e.7z
[2009.09.07] RII Light v1, extract archive in your install directory (lua script has to be in the vfs root directory = in "\Data" or "\Data-1.13" or "\Profiles\UserProfile_JA2113" etc.)
[2009.06.21] Alpha V.4c, set this in ja2.ini to configure VFS for this mod[Ja2 Settings]
VFS_CONFIG_INI = vfs_config.RII.ini
[2009.04.11] Alpha V.4b : here or here ( = V4 + patched exe)
[2009.03.21] Alpha V.4
[2009.03.19] Alpha V3.1 = V3 + small fix
[2009.03.18] Alpha V3, based on SVN revision 2624 : here , details see here
Alpha V2 : here
Alpha V1 : here
######################################################
Hi,
it is constantly asked whether any additional resolutions could be added to the game. Especially for widescreen displays this would mean a significant improvement.
The good news is that is quite simple to set any resolution. The tactical view supports that without any apparent problems. The bad news is that the user interface doesn't play so nice. What we see are misplaced buttons and generally speaking wrongly positioned interface elements.
![http://img361.imageshack.us/img361/6834/ja23jj9.th.png](http://img361.imageshack.us/img361/6834/ja23jj9.th.png)
And because it is exhausting to create interface images for any possible resolution and also use them in the code in the right way, it is much simpler to take the images for existing resolutions and just position them correctly. All we need is a system that can handle different resolutions in a simple and flexible way.
This is what the Resolution Independent Interface (RII) project is about.
I was working on this this for the last couple of days and i think that what i have by now is already quite usable. There are still some misplaced elements, especially because i have worked mostly on the strategic map interface.
I will release the first alpha version today, because my testing capabilities are quite limited (i basically have no savegames that go beyond Omerta). What i need you (and you) to do is to download the file and test if everything behaves at it should behave. There are still some (many) issues to be resolved and i need to know which of them are most annoying or just plainly deal-breaking. I can then fix these issues in the 'correct' order.
What you have to do is the following :
- Download the file [http://www.turboupload.com/files/get/ph9Aii8Ine/ja2-rii-alpha-v1.7z] and copy it to the other ja2 binaries.
- Open ja2.ini and insert the following lines at the end of the file
[RII]
#WIDTH = your preferred window width
#HEIGHT = your preferred window height
#for example
WIDTH = 1440
HEIGHT = 960
This defines the "outer" or the window resolution. The old resolution selection (0=640x480, 1=800x600, 2=1024x768) determines the size of ingame interface image sizes (as it did before too). Defining an outer resolution smaller than the inner resolution can (but doesn't have to) result in a crash, so be warned.
- play the game
- have fun
- report bugs
Edit :
1. this version is build on top of SVN revision 2460 and thus requires up to date data files
2. it doesn't break savegames (of the otherwise 'unmodded' and up-to-date game), so feel free to try it out
[Updated on: Fri, 18 September 2009 02:07] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: RII - Resolution Independent Interface[message #204987]
|
Sat, 27 December 2008 12:19 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
Logisteric |
![](http://thepit.ja-galaxy-forum.com/images/avatars/default/mistery_man.png) ![](/images/ranks/captain.png) |
Messages:3199
Registered:December 2008 Location: B |
|
|
KaerarWould a High resolution interface be a preferred replacement? I'm sure I could come up with something to solve that issue. Also a new font pack to go with it so you might save some money of glasses?
when you're are at it, how about a scrollbar or whatsoever for playing manymercs (32 mercs) on 1024x? it anoys me that whenever i want to select one of the last mercs i get that truck. i know, i can solve that by sorting my mercs, but in 80% i try to get through without it => truck selected.
[Updated on: Sat, 27 December 2008 12:19] by Moderator Report message to a moderator
|
Captain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: RII - Resolution Independent Interface[message #205392]
|
Fri, 02 January 2009 14:53 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
BirdFlu |
![](/images/ranks/master_sergeant.png) |
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
KaerarThe basic idea was to have a set of High Res files that can be resized down in their native size (so one set for widescreen and one for normal). This is for resolutions higher than the ones already ingame.
I don't think images are the problem here. They are more or less just background images. But there are also a lot of other elements, like buttons or various text labels, and they all have to fit. So, for every resolution we need the offsets and sizes of those elements (can be described in the XML files). And since we are having an own set of configuration files for every resolution, creating a fitting background image should not be that big a deal.
One possibility is to think about a set of representative configuration files for every aspect ratio (4:3, 5:4, 16:10) and scale them to the according screen size. But scaled images always look worse than original images, even with AA. And it is even worse for high-contrast images, like fonts.
And there is another problem with scaling. While you can scale rgb images quite well, you can generally not scale paletted images. And sti images are paletted images.
KaerarThe thing with the resizing is to get the grids to be in the same position so maybe having an alpha layer with grid locations that can resize too (the code looks to the positioning of the alpha layer grid which isn't visible to the player).
I'm not sure i understand you. Do you mean the actual strategic map when saying grid and why would you need this alpha layer with grid locations exactly?
Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: RII - Resolution Independent Interface[message #205522]
|
Sun, 04 January 2009 14:01 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
Tron |
![](http://thepit.ja-galaxy-forum.com/images/forums/ranks/AIM_tron.png) ![](/images/ranks/sergeant_1stclass.png) |
Messages:225
Registered:August 2007 Location: Germany |
|
|
BirdFluOh. My intention was actually to say that resizing of paletted images could be hard. Once it is done, blending can indeed be easy. But, as there is no real alpha value in the images and in the 16bpp buffer, real alpha blending could be a little problematic. You can always take an alpha value of 0.5, though.
I just mentioned alpha blending as example, which is already there and uses paletted input data (actually one paletted pixel + one direct colour pixel get blended), but produces direct colour as result. Colour interpolation for resizing uses pretty much the same calculations as alpha blending.
Quote:And since you are here anyway. Lets assume someone wants to replace the original window with a SDL window. How much work would that be? How many files would that change affect? Would it be only the file sgp.cpp where the window is created, or would it also affect Event processing too? I guess the HVOBJECT creation and handling code would have to touched too.
Look at how JA2-Straciatella works. It has all been done already: I replaced all Windows-specific parts by SDL. This includes not only video (formerly DirectDraw), but also input (formerly Windows event handling) and sound (formerly Miles Sound System). Especially sound does not depend on FMOD (which JA2-1.13 uses currently), which has only very limited portability.
From writing the Makefile to compile the program to the first time seeing the main menu took about a week. Of course this was only the start and many more aspects (input, sound, more blitters - for the main menu you need three, but all in all several dozens are used) had to be implemented. You can read all this in the SVN log of JA2-Stracciatella.
The code is much shorter and easier to maintain now. I also simplified many of the internal interfaces in the source code, because they were horribly complicated. Further error handling is much more consistent, robust and shorter now.
If you seriously consider using SDL and in general improving portability, maintainability, extensibility and robustness of JA2-1.13, then I recommend you use JA2-Stracciatella as basis and incorporate features into JA2-Stracciatella.
Also have a look at the Changelog, to see how many bugs from the vanilla game have been fixed (just look for the word "vanilla" in the Changelog!) and how many improvements have been done.
Quote:But the blitters could stay as they are, right?
I replaced the code of all (used) blitters, which were written in inline assembler as understood by MSC, by implementations in plain C. Lesh used this very code - a few thousand lines of code - to make his Linux version work.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
Re: RII - Resolution Independent Interface[message #205530]
|
Sun, 04 January 2009 15:33 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
BirdFlu |
![](/images/ranks/master_sergeant.png) |
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
TronI replaced the code of all (used) blitters, which were written in inline assembler as understood by MSC, by implementations in plain C. Lesh used this very code - a few thousand lines of code - to make his Linux version work.
Actually, i already tried to copy Leshs blitters to a relatively new 1.13 revision a couple of months ago and it worked (why shouldn't it?). Even without SDL. So, i guess, my actual question was whether the replacement of inline assembler code with C code was done only for portability or also because of other reasons?
To rephrase my question, can a transition to SDL be done for every single module (first window, then event handling, then sound, etc.) separately or does it has to happen at once?
Report message to a moderator
|
|
|
|
Re: RII - Resolution Independent Interface[message #205533]
|
Sun, 04 January 2009 16:09 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
Tron |
![](http://thepit.ja-galaxy-forum.com/images/forums/ranks/AIM_tron.png) ![](/images/ranks/sergeant_1stclass.png) |
Messages:225
Registered:August 2007 Location: Germany |
|
|
Quote:[...] i already tried to copy Leshs blitters [...]
I have to be a bit pedantic here: I wrote the C implementations of the blitters, not Lesh. He merely copied them for his JA2-1.13 Linux port.
Quote:So, i guess, my actual question was whether the replacement of inline assembler code with C code was done only for portability or also because of other reasons?
I rewrote them because GCC does not understand the MSC inline assembler syntax. I could have translated them to the GCC inline assembler syntax, but plain C is more portable. For example JA2-Stracciatella also works on ARM processors.
Quote:To rephrase my question, can a transition to SDL be done for every single module (first window, then event handling, then sound, etc.) separately or does it has to happen at once?
Of course SDL on Windows uses Windows event handling etc. internally, so it is not possible to just replace video output and leave the rest as is. As I mentioned earlier, you can see how all this was solved in JA2-Stracciatella and use it as basis.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
|
Re: RII - Resolution Independent Interface[message #205550]
|
Sun, 04 January 2009 20:46 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
BirdFlu |
![](/images/ranks/master_sergeant.png) |
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
TronI just mentioned alpha blending as example, which is already there and uses paletted input data (actually one paletted pixel + one direct colour pixel get blended), but produces direct colour as result. Colour interpolation for resizing uses pretty much the same calculations as alpha blending. I will stay by my statement that blending and resizing are essentially different. You can implement it so that they look similar, but the essential operations do not overlap. The essence of blending is being able to read a WRITE buffer, that is read a pixel from the WRITE or FRAME buffer, blend it with another pixel and finally write it again into the buffer. Where the other pixel comes from, being it a rgb or paletted source, doesn't matter. The essence of resizing is the computation of one new pixel from one or several source pixels. The way how you compute/interpolate the new pixel determines its quality and what you finally do with it, write it directly into a buffer or use it as input for a blending operation, again doesn't matter.
Now, you can nicely chain these operations, but on an essential level they have nothing to do with each other.
Tron Lesh used this very code - a few thousand lines of code - to make his Linux version work. TronBirdFlu[...] i already tried to copy Leshs blitters [...] I have to be a bit pedantic here: I wrote the C implementations of the blitters, not Lesh. He merely copied them for his JA2-1.13 Linux port. I thought that it was clear from your statement that Lesh took the code from you. But you are right, i should have given you credit.
TronAs I mentioned earlier, you can see how all this was solved in JA2-Stracciatella and use it as basis. Then i will just do that.
KaerarFor me as a gfx artist does this mean I can make 16bpp images and use them ingame? Does it allow for transparency? Or is 24bpp needed for that? I will carefully say "probably yes", because there already are some non-paletted images that are "brought on screen". But i think this would only make sense for interface images (not fonts) that have a non-varying palette, as there is a blit function call for every single GUI elements that is not 'shared' with other elements. Well, except for the character list maybe.
Report message to a moderator
|
|
|
|
Re: RII - Resolution Independent Interface[message #205558]
|
Sun, 04 January 2009 22:53 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
Tron |
![](http://thepit.ja-galaxy-forum.com/images/forums/ranks/AIM_tron.png) ![](/images/ranks/sergeant_1stclass.png) |
Messages:225
Registered:August 2007 Location: Germany |
|
|
BirdFluTronI just mentioned alpha blending as example, which is already there and uses paletted input data (actually one paletted pixel + one direct colour pixel get blended), but produces direct colour as result. Colour interpolation for resizing uses pretty much the same calculations as alpha blending. I will stay by my statement that blending and resizing are essentially different. You can implement it so that they look similar, but the essential operations do not overlap.
Both are weighted interpolation of pixels.
Quote:The essence of blending is being able to read a WRITE buffer, that is read a pixel from the WRITE or FRAME buffer, blend it with another pixel and finally write it again into the buffer. Where the other pixel comes from, being it a rgb or paletted source, doesn't matter. The essence of resizing is the computation of one new pixel from one or several source pixels. The way how you compute/interpolate the new pixel determines its quality and what you finally do with it, write it directly into a buffer or use it as input for a blending operation, again doesn't matter.
Now, you can nicely chain these operations, but on an essential level they have nothing to do with each other.
Map 8bpp source pixels to direct colour and resize the image, am I missing something?
Report message to a moderator
|
Sergeant 1st Class
|
|
|
Re: RII - Resolution Independent Interface[message #205562]
|
Sun, 04 January 2009 23:59 ![Go to previous message Go to previous message](/theme/Bear_Classic_Brown/images/up.png)
|
|
BirdFlu |
![](/images/ranks/master_sergeant.png) |
Messages:438
Registered:September 2007 Location: Lampukistan |
|
|
TronBoth are weighted interpolation of pixels. Yes, but when blending an image I with the FRAME_BUFFER FB, you take take a pixel from I with coordinates (x,y) and also take a pixel from FB with the exact same coordinates (x,y) and write the result again to the same coordinates (x,y) in FB. You could say you have a 1:1 relationship. During resizing (you can also take rotating) you have a more complex relationship (1:n) because the area of the new pixel usually overlaps multiple pixels from the old image that you have to consider now. You can, of course, restrict yourself to a 1:1 relationship, but you would loose information during the computation and the result could look really crappy (try to disable all texture filtering in 3D games).
Quote:Map 8bpp source pixels to direct colour and resize the image, am I missing something?
Map 8bpp source pixels to direct colour = apply palette on image indices
resize the image = use previously computed rgb image as input to the resizing process
am I missing something? = blending?
Btw, this is a chaining of operations and i never excluded it.
Report message to a moderator
|
|
|
|
|