Would this work? Created 1 year ago2023-01-18 15:40:43 UTC by CaptainQuirk26 CaptainQuirk26

Created 1 year ago2023-01-18 15:40:43 UTC by CaptainQuirk26 CaptainQuirk26

Posted 1 year ago2023-01-18 15:40:43 UTC Post #347235
So I'm creating a set of widescreen menu backgrounds for Half-Life and the two Steam expansions. I decided to squish the widescreen image into the used image size and let the game stretch it back out. However, the app I use to create the splashes can create a higher resolution image, and now I'm wondering if I could alter the background layout txt file in order to cause the higher resolution image to load. Would this work, and if so, could someone show me how to do this?
CaptainQuirk26 CaptainQuirk26AKA laurarvix
Posted 1 year ago2023-01-19 08:15:43 UTC Post #347236
Sure thing. I have a custom widescreen background for most of my GoldSrc games and they generally have their BackgroundLayout.txt like:

resolution 1920 1080

resource/background/1920_1080_0_0.tga scaled 0 0
resource/background/1920_1080_0_1.tga scaled 256 0
resource/background/1920_1080_0_2.tga scaled 512 0
resource/background/1920_1080_0_3.tga scaled 768 0
resource/background/1920_1080_0_4.tga scaled 1024 0
resource/background/1920_1080_0_5.tga scaled 1280 0
resource/background/1920_1080_0_6.tga scaled 1536 0
resource/background/1920_1080_0_7.tga scaled 1792 0

resource/background/1920_1080_1_0.tga scaled 0 256
resource/background/1920_1080_1_1.tga scaled 256 256
resource/background/1920_1080_1_2.tga scaled 512 256
resource/background/1920_1080_1_3.tga scaled 768 256
resource/background/1920_1080_1_4.tga scaled 1024 256
resource/background/1920_1080_1_5.tga scaled 1280 256
resource/background/1920_1080_1_6.tga scaled 1536 256
resource/background/1920_1080_1_7.tga scaled 1792 256

resource/background/1920_1080_2_0.tga scaled 0 512
resource/background/1920_1080_2_1.tga scaled 256 512
resource/background/1920_1080_2_2.tga scaled 512 512
resource/background/1920_1080_2_3.tga scaled 768 512
resource/background/1920_1080_2_4.tga scaled 1024 512
resource/background/1920_1080_2_5.tga scaled 1280 512
resource/background/1920_1080_2_6.tga scaled 1536 512
resource/background/1920_1080_2_7.tga scaled 1792 512

resource/background/1920_1080_3_0.tga scaled 0 768
resource/background/1920_1080_3_1.tga scaled 256 768
resource/background/1920_1080_3_2.tga scaled 512 768
resource/background/1920_1080_3_3.tga scaled 768 768
resource/background/1920_1080_3_4.tga scaled 1024 768
resource/background/1920_1080_3_5.tga scaled 1280 768
resource/background/1920_1080_3_6.tga scaled 1536 768
resource/background/1920_1080_3_7.tga scaled 1792 768

resource/background/1920_1080_4_0.tga scaled 0 1024
resource/background/1920_1080_4_1.tga scaled 256 1024
resource/background/1920_1080_4_2.tga scaled 512 1024
resource/background/1920_1080_4_3.tga scaled 768 1024
resource/background/1920_1080_4_4.tga scaled 1024 1024
resource/background/1920_1080_4_5.tga scaled 1280 1024
resource/background/1920_1080_4_6.tga scaled 1536 1024
resource/background/1920_1080_4_7.tga scaled 1792 1024


I thought there was or would be an application by now that will export the images and the BackgroundLayouts.txt for whichever resolution you wanted :confused:
Posted 1 year ago2023-01-20 00:01:33 UTC Post #347237
Tbh, I don't understand just from looking at this what size to make my .tgas. Could someone just tell me what resolution and part of the image each chunk is? If necessary, I'm perfect fine with a link to another site explaining it.
CaptainQuirk26 CaptainQuirk26AKA laurarvix
Posted 1 year ago2023-01-20 02:46:50 UTC Post #347238
Sorry, I was under the impression you already had your image sizes sorted out. There isn't a catch all solution as far as I know. It entirely depends on your chosen resolution. If it was 1999, you'd be working with all 256x256 images easily. Widescreen is a bit more complicated.

I believe the max size for each TGA remains 256x256 and you can otherwise have most of your modern widescreen background be covered in those, but it won't completely fit without some oddly sized pieces. For example, at 1920x1080 like above, you can get away with most images being 256x256, while the remainder must be lesser seen multiples like 128x256 or 128x56. It doesn't actually matter as long as it fits together at the end.

Let's revisit the above for more clarification.

resource/background/1920_1080_0_0.tga scaled 0 0

This first piece is sized 256x256, and is placed at coordinates 0,0.
Instead of starting the coordinates at your typical X/Y in the middle, it actually starts from the top left of the screen.

resource/background/1920_1080_0_1.tga scaled 256 0

Therefore the next piece, also 256x256, is placed 256 units over to the right of the previous.

So starting from the top left (0,0) it goes left to right, row by row.

It's very confusing and a very hacky way to overcome a menu system that just doesn't natively care about widescreen. I have looked through a few widescreen backgrounds in my mod folder and they're all done differently. You could make every TGA 24x24 and have hundreds of entries on the BackgroundLayouts.txt and as long as the coordinates all match, it would probably work.

I also looked through my GoldSrc tools and the only background generators I found only work with earlier resolutions up to x1024. There really should be an updated one to streamline such a mundane and under documented task.
Posted 1 year ago2023-01-20 16:06:25 UTC Post #347239
This is good enough for me to figure the rest out on my own. Thanks. Your images are actually way larger than mine, my background images are all 1365x768, and I had been cramming them into the native 800x600 image and letting goldsrc stretch them back out to the original aspect ratio. I thank you for telling me how to make this work. What software would you reccomend for converting my png images to tgas and then subsequently editing them if necessary?
CaptainQuirk26 CaptainQuirk26AKA laurarvix
Posted 1 year ago2023-01-23 03:09:37 UTC Post #347246
Hah! I figured everyone would want 1080p at least these days. I used to do the same. It's far easier than figuring it out by hand.

I suppose you would cut the background on a grid laid out in Photoshop/GIMP. If I recall correctly there are a few old templates floating about that have different resolutions marked out in a grid already that you can use as an overlay, but this is still needlessly tedious work in my opinion.

As I banged my head against the wall trying to remember and explain this stupid process I decided to see if I could figure out a nifty way to do this all automatically for any resolution.

So I did it!
magic!magic!
You'd just drag the background you want onto the .exe or specify its path in a cmd window. I tested with a few different resolutions (including yours) and it all gets perfectly cut up & converted into whatever amount of .tga's are needed, placed in a resource/background folder. It also of course writes to BackgroundLayout.txt and then you'll have a GoldSrc background ready for use!

I haven't tested on any other computers and still have to tidy a few things up if I were to release this fully. But if my madness somehow produces something that truly works, I imagine this is all you'll need to convert backgrounds in the future. Hurray!?!
Posted 1 year ago2023-01-23 06:39:13 UTC Post #347247
Funny, I guess you beat me as I had the same idea and cooked something up yesterday which basically does the same. Wanted to clean it up today ans then push it to Github.

Yours has the nicer logo though 😁
Posted 1 year ago2023-01-23 17:26:33 UTC Post #347248
This is AWESOME! Thank you! I eagerly await the release of this program, and I suppose that technically, it was kinda made for me? Regardless, this will deal with a significant amount of pain that remastering Half-Life has caused me. You are a beautifully creative person, and I thank you for leading me through this. I am relatively new to the modding process, so I need more help like this than I can usually get. Thank you SO MUCH.
CaptainQuirk26 CaptainQuirk26AKA laurarvix
You must be logged in to post a response.