Home » MODDING HQ 1.13 » v1.13 Coding Talk » RII - Resolution Independent Interface [UPDATE :RII v4f]
RII - Resolution Independent Interface [UPDATE :RII v4f][message #204918] Fri, 26 December 2008 01:39 Go to next message
BirdFlu is currently offline BirdFlu

 
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

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

Master Sergeant
Re: RII - Resolution Independent Interface[message #204922] Fri, 26 December 2008 02:05 Go to previous messageGo to next message
Marlboro Man

 
Messages:1159
Registered:October 2005
Location: USA
Neat. Smile

Report message to a moderator

Sergeant Major

Re: RII - Resolution Independent Interface[message #204929] Fri, 26 December 2008 03:51 Go to previous messageGo to next message
orko_oskar is currently offline orko_oskar

 
Messages:72
Registered:April 2007
Location: Sweden
This would be a realy good addition.

Report message to a moderator

Corporal
Re: RII - Resolution Independent Interface[message #204951] Fri, 26 December 2008 22:04 Go to previous messageGo to next message
lockie is currently offline lockie

 
Messages:3721
Registered:February 2006
Location: Scotland
Is it usable for UB and associated mods ?

Report message to a moderator

Captain

Re: RII - Resolution Independent Interface[message #204952] Fri, 26 December 2008 23:22 Go to previous messageGo to next message
tais

 
Messages:656
Registered:February 2008
Location: NL
just played on 1680x1050 and no problems except misaligned images in strategic and tactical view but that's normal at this stage.
if this project is gonna catch on i'm gonna be forced to buy some glasses, i can't read it at this resolution...

Report message to a moderator

First Sergeant

Re: RII - Resolution Independent Interface[message #204962] Sat, 27 December 2008 01:43 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
lockie
Is it usable for UB and associated mods ?

Is the source code for UB available? If not, then it won't work. Many positions and offsets and sizes are hardcoded, and if i don't have access to the code, then i cannot change it.

Tais

just played on 1680x1050 and no problems except misaligned images in strategic and tactical view but that's normal at this stage.
if this project is gonna catch on i'm gonna be forced to buy some glasses, i can't read it at this resolution...

What was the problem? The size of the interface elements (button text etc.)? Or was the world view too small (tiny mercs and weapons and houses etc.)?

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #204968] Sat, 27 December 2008 09:20 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
Would 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?

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #204969] Sat, 27 December 2008 10:28 Go to previous messageGo to next message
lockie is currently offline lockie

 
Messages:3721
Registered:February 2006
Location: Scotland
if it can be made to run 1024 x 768 , THAT would be ......... ok Smile

Report message to a moderator

Captain

Re: RII - Resolution Independent Interface[message #204970] Sat, 27 December 2008 11:15 Go to previous messageGo to next message
BallerDave

 
Messages:72
Registered:April 2008
Location: Ze land of ze sheep, Dubl...

ha so its not impossible to play on widescreen resolutions after all. gonna try this soon as im home

thanks a lot!!!

Report message to a moderator

Corporal
Re: RII - Resolution Independent Interface[message #204986] Sat, 27 December 2008 12:12 Go to previous messageGo to next message
tais

 
Messages:656
Registered:February 2008
Location: NL
the font is tiny and sharp, mercs are like ants on this res

Screenshots Smile
http://img71.imageshack.us/my.php?image=32551298or6.png
http://img291.imageshack.us/my.php?image=82781681qa9.png
http://img265.imageshack.us/my.php?image=11967642xn4.png
http://img181.imageshack.us/my.php?image=99256445pn4.png
http://img181.imageshack.us/my.php?image=77890985lc3.png
http://img181.imageshack.us/my.php?image=49815508br4.png

others are to big for image hosting so i zipped them all and placed them here
http://rapidshare.de/files/41219768/screenshots1680-1050.zip.html

Report message to a moderator

First Sergeant

Re: RII - Resolution Independent Interface[message #204987] Sat, 27 December 2008 12:19 Go to previous messageGo to next message
Logisteric

 
Messages:3199
Registered:December 2008
Location: B
Kaerar
Would 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 #205082] Sun, 28 December 2008 15:53 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Kaerar
Would 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?

Do you want to just increase the interface images, or do you have any advanced plans for that high resolution interface?

lockie
if it can be made to run 1024 x 768 , THAT would be ......... ok \:\)

So, is the source code for UB available?

Tais
... images ...

Thanks for the images.

I kind of like the larger resolutions and i don't mind the 'ant' soldiers. Now i can finally overlook the combat area. There is one problem though. The mercs seem not to hit each other when they apparently stand so close together (on the screen). At least i get this impression in the early stage of the game.

BTW, can someone give me a savegame that contains at least one vehicle. I think i don't handle them correctly at the moment. Or at least tell me how to get a vehicle within 5 or 10 minutes and without much fighting.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205085] Sun, 28 December 2008 16:53 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
Hamous near Chitzena normally. Two sectors left of San Mona Kingpin's bar sector. He has Ice Cream Truck but its a random possibility. Would send a save but I haven't got a current release game going yet.

As for the High Resolution interface I was going to make a 1600x1200 one up and if you can resize it then you just reduce the size of the high res images rather than increase the size of small ones. Dunno if its possible. I was gonna do fonts too (otherwise it would look a tad odd) but unless it could be implemented I was a little hesitant to start on it. If you can manage it then by all means let me know and I'll have a crack at it.

May need someone to do a higher res map too (not sure I can do that Wink )

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205120] Mon, 29 December 2008 12:51 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Kaerar
As for the High Resolution interface I was going to make a 1600x1200 one up and if you can resize it then you just reduce the size of the high res images rather than increase the size of small ones. Dunno if its possible. I was gonna do fonts too (otherwise it would look a tad odd) but unless it could be implemented I was a little hesitant to start on it. If you can manage it then by all means let me know and I'll have a crack at it.

I guess you may want to wait until the next release (that will come out in the next couple of days).

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205249] Wed, 31 December 2008 06:11 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
Looking forward to it mate Wink

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205281] Wed, 31 December 2008 16:09 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Kaerar
Looking forward to it mate Wink

OK, almost done. Don't know if i will manage to bring it out today. You will have it tomorrow at the latest. But as you are australian, it will be 'tomorrow' for you anyway.

Happy new year to everyone.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205289] Wed, 31 December 2008 20:27 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
Happy new year mate and don't worry there is no rush Smile

We've been at this 10 years already a day or two won't matter Very Happy

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205291] Wed, 31 December 2008 21:17 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
OK, found a little spare time.

Here is the new version Alpha V2.

There are two small fixes.
1. Old inventory in Map Screen works better
2. Buttons in Sector Inventory are in the correct place now.

There is also a big change. I added a couple of XML files that are located in Data-1.13/TableData/Gui. I won't talk much about them for now. Just open the files and play a little around with them. I will explain details later. Questions are of course welcome.


See ya later.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205294] Wed, 31 December 2008 22:47 Go to previous messageGo to next message
zilpin is currently offline zilpin

 
Messages:63
Registered:October 2007
excellent!

Report message to a moderator

Corporal
Re: RII - Resolution Independent Interface[message #205312] Thu, 01 January 2009 05:32 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
Thanks BirdFlu will check it out. If I can do what I have in mind I think it may be liked.

Can this RII resize larger images down to smaller ones? AA may be necessary for good results though.

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205346] Thu, 01 January 2009 17:25 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Kaerar
Can this RII resize larger images down to smaller ones? AA may be necessary for good results though.

RII doesn't handle rendering or image processing at all, so it can not resize images. RII only handles placement of GUI elements.
What you can do is provide a file with a resized image and reference that file in the right place in the right XML file.

PS.Kaerar
If I can do what I have in mind I think it may be liked.
If you tell me what you have in mind, then maybe i can tell you how to do it or implement what is missing,

[Updated on: Thu, 01 January 2009 20:26] by Moderator

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205377] Fri, 02 January 2009 05:25 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
The 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.

The 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).

Problem is that alpha layers aren't supported Sad

Would be so much easier if the images were PNG

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205392] Fri, 02 January 2009 14:53 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Kaerar
The 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.

Kaerar
The 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

Master Sergeant
Re: RII - Resolution Independent Interface[message #205426] Sat, 03 January 2009 07:57 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
When you resize down it can work relatively well if the resize isn't that large (say 1600x1200 down to 1280x960). That's why I thought if it was done in say the 3 main aspect ratio's and then resized dynamically then it may work. When below a certain threshold (1024x768) it reverts to the STI's that are currently available. What I would be after though is being able to use PNG files rather than STI's. Don't know if that's possible at the moment.

For the Alpha layer it basically sets the grid for all buttons and sections that are live on the image(s). This allows for easy coordinates for the interface to work from. Also would be scalable without too much extra effort (though I have no idea from a coding pov whether it would be easier or harder).

At the end of the day if I have to make each interface separately then so be it, but it would have been nice to just make some really good Hi-Res stuff and reduce the size ingame (like done with most game interfaces now).


Oh and if you could remove the overlap from the different STI's from the current interfaces that would be helpful as currently there is overlap that make's integrated camo and other effects really hard to line up.


P.S. Is there any way we can alter the grids a little for 800x600 and up? Basically cos they leave absolutely no room around the edge of the interface which is really making it hard to make the interface I have in mind. I'll be finishing my old camo one first before the next one (in all current flavours) but for the next one having the grids redone would be a massive help. Plus if I get to make it true Hi-Res then I get to play with some nice pixel effects Wink

[Updated on: Sat, 03 January 2009 16:07] by Moderator

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205457] Sat, 03 January 2009 16:08 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Kaerar
When you resize down it can work relatively well if the resize isn't that large (say 1600x1200 down to 1280x960).
The problem with resizing is this. Imagine you want to determine the color for a pixel in the new (resized) image. You would have to consider the pixel values of the according pixels in the old image. For the sake of simplicity let's say these are only two pixels and that we have to take the average value/color of these pixels. In paletted images the pixel values are indices to the palette. So when take the average of two old pixels
 0.5 * value(P1) + 0.5 * value(P1), value(P1)=10, value(P2)=17
       LightRed          DarkRed
we get a new value
 = 27/2 = 13.5 = 13
that may have a completely different color (like yellow).

When we compute rgb values first and then interpolate then, the result may be a color that was not in the palette before. And if we are unlucky we get a new color for every new pixel and eventually run out of free places in the palette (if there were any at all).

So there is much work to do it right for very questionable results. An image processing program can do it much better. So, why not just load a well (pre)made image.

Quote:
but it would have been nice to just make some really good Hi-Res stuff and reduce the size ingame (like done with most game interfaces now).

Most game interfaces use actual rgb images that can be scaled reasonably well.

Quote:
Oh and if you could remove the overlap from the different STI's from the current interfaces that would be helpful as currently there is overlap that make's integrated camo and other effects really hard to line up.
Hmm, .. what? Do you have screenshots?

BTW, did anyone looked into the XML files and tried to modify them?

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205460] Sat, 03 January 2009 17:18 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
The overlap is like 1 maybe 2 pixels. Mapscreen and charinfo are two culprits. TBH its annoying to the maker not the gamer. Like you just spent ages making sure that all was aligned right. Go ingame and its a pixel out in places.

I know what you mean on the palettised section which screws up resizing. Just wish we could employ the true colour from Wildfire and remove the palettes.

Back to reality, I will finish off the 800x600 version of my camo interface. Only alters interface and nothing else at the moment. Will include a laptop mod at a later date. On a side note is there any way to increase the size of the laptop screen loading anim (zooming from wherever it does) as it would help with the replacement laptop borders.

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205468] Sat, 03 January 2009 18:55 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
BirdFlu
When we compute rgb values first and then interpolate then, the result may be a color that was not in the palette before. And if we are unlucky we get a new color for every new pixel and eventually run out of free places in the palette (if there were any at all).


Only the images in the data files are paletted. For display 16bpp Highcolour is used.

Report message to a moderator

Sergeant 1st Class
Re: RII - Resolution Independent Interface[message #205478] Sat, 03 January 2009 21:14 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
BirdFlu
When we compute rgb values first and then interpolate then, the result may be a color that was not in the palette before. And if we are unlucky we get a new color for every new pixel and eventually run out of free places in the palette (if there were any at all).


Only the images in the data files are paletted. For display 16bpp Highcolour is used.

Well, if my memory doesn't fail me, we have 16bpp buffers (FRAME_BUFFER and guiSAVEBUFFER, or so) and the paletted images are blitted directly into these buffers by going over the lines of the image, applying the palette on the index values and writing the resulting color value into the buffer.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205488] Sat, 03 January 2009 23:11 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
BirdFlu
Well, if my memory doesn't fail me, we have 16bpp buffers (FRAME_BUFFER and guiSAVEBUFFER, or so) and the paletted images are blitted directly into these buffers by going over the lines of the image, applying the palette on the index values and writing the resulting color value into the buffer.

That's how you translate indexed image data to direct colour. What's your point?

Report message to a moderator

Sergeant 1st Class
Re: RII - Resolution Independent Interface[message #205493] Sun, 04 January 2009 01:54 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
Only the images in the data files are paletted. For display 16bpp Highcolour is used.
Tron
That's how you translate indexed image data to direct colour. What's your point?

I don't know, what is yours?

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205506] Sun, 04 January 2009 10:03 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
You stated it is impossible/hard to blend pixels for zooming, because the game is palette based. For display purposes the game is not palette based, but uses direct colour, so blending is easily possible. In fact there are some blending effects, e.g. explosions - this is not for zooming, but alpha blending, the calculations are pretty much the same though.

Report message to a moderator

Sergeant 1st Class
Re: RII - Resolution Independent Interface[message #205518] Sun, 04 January 2009 13:15 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Oh. 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.

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. But the blitters could stay as they are, right?

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #205522] Sun, 04 January 2009 14:01 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
BirdFlu
Oh. 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 messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
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.

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

Master Sergeant
Re: RII - Resolution Independent Interface[message #205533] Sun, 04 January 2009 16:09 Go to previous messageGo to next message
Tron

 
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 #205542] Sun, 04 January 2009 18:10 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2022
Registered:January 2003
Location: Australia :D
For 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?

Remember I am not a coder Very Happy

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #205550] Sun, 04 January 2009 20:46 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
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.
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.
Tron
BirdFlu
[...] 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.

Tron
As 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.

Kaerar
For 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

Master Sergeant
Re: RII - Resolution Independent Interface[message #205558] Sun, 04 January 2009 22:53 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
BirdFlu
Tron
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.
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 messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Tron
Both 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

Master Sergeant
Re: RII - Resolution Independent Interface[message #205564] Mon, 05 January 2009 00:09 Go to previous messageGo to previous message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
This is pointless.

Report message to a moderator

Sergeant 1st Class
Previous Topic: Learning how the tactical AI works
Next Topic: Folding Stock Revamp
Goto Forum:
  


Current Time: Fri Mar 29 08:22:19 GMT+2 2024

Total time taken to generate the page: 0.02385 seconds