Stupid Scripting Tricks

Discuss map ideas, techniques, and give help.

Stupid Scripting Tricks

Post Sep 9th '18, 22:21

Rather than squirreling my queries away in project threads that aren’t really specifically about scripting questions, I figured I’d make a generalised topic for questions on MML and Lua.

The <landscapes> tag in MML is confusing me. Years ago, I’d apparently put in this script into my scenario’s MML file:

Code: Select all
<landscapes>
   <landscape coll="28" horiz_exp="0" vert_exp="0" ogl_asprat_exp="1"/>
   <landscape coll="29" horiz_exp="0" vert_exp="0" ogl_asprat_exp="1"/>
   <landscape coll="30" horiz_exp="0" vert_exp="0" ogl_asprat_exp="1"/>
</landscapes>
I don’t for the life of me remember why I included this code for the nighttime, moon, and space collections, but not for the daytime collection, but that’s not important right now. What I’ve gathered is that the code I’ve used here must’ve caused the landscapes to repeat every 360° rather than every 180°, as was default in M∞. This makes sense overall, but I have a few questions.

  1. What the hell does ogl_asprat_exp actually mean? The explanation doesn’t make much sense. I gather that 0 would be perfectly square, 1 would be 1:2 a ratio, and so on. I get that much. I don’t get the rest of it.

  2. Is it possible to change this behaviour on a texture-by-texture basis rather than a merely collection-by-collection one? I want some of the textures to repeat every 180°, and others to repeat every 360°. I could presumably change this on a level-by-level basis instead, but I’d rather not have to use that much individualised scripting for each level. (I already have to change the random/ambient sounds and the scenery on a level-by-level basis.)

  3. For some reason, the space collection – and only the space collection – looks hideous when I try to load HD textures with the above settings. But strangely, it’s only some of them. I’m trying to load HD versions of the M2, M∞, and Tempus landscapes, with the following code:

    Code: Select all
    <texture coll="30"
       bitmap="0"
       normal_image="Data/30 Space/00.png"
       type="1"
       opac_type="0"/>
    <texture coll="30"
       bitmap="1"
       normal_image="Data/30 Space/01.dds"
       type="1"
       opac_type="0"/>
    <texture coll="30"
       bitmap="3"
       normal_image="Data/30 Space/03.png"
       type="1"
       opac_type="0"/>
    <texture coll="30"
       bitmap="4"
       normal_image="Data/30 Space/04.png"
       type="1"
       opac_type="0"/>
    <texture coll="30"
       bitmap="5"
       normal_image="Data/30 Space/05.png"
       type="1"
       opac_type="0"/>

    For some reason, the first three of these distorted hideously until I removed the ogl_asprat_exp setting. The last two didn’t seem seem as bad, but it’s possible that it wasn’t noticeable. The other landscape collections look fine. What gives?
People should not be afraid of their governments. Governments should be afraid of their people.

“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”

Fool's Gold · Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · YouTube Vidmaster’s Challenge
User avatar

The Man
Sarasota, FL

Post Sep 10th '18, 12:45

1. I think the explanation is pretty clear, but I do believe it's wrong about the default. The default is 0, so 1:1 (because the original landscape textures are just over 1:2 so they have to fit in a 1:1 OpenGL texture). Maybe that's why you're confused?
2. No, but since there's only one landscape texture per collection, there really isn't a difference. You can use any (or more than one) landscape collection in a map now, you don't have to use what is set in the level parameters. So maybe that will help?
3. Again, there's only one landscape texture per collection. So I think your MML is wrong.
User avatar

treellama
Pittsburgh

Post Sep 10th '18, 13:45

Thanks for the explanations.

1. That would explain it. I think. I’ll have to look at it again after work and try changing around the values.

2 & 3. Well, there’s only one landscape in M2 and ∞, but I’ve got six, due to the massive number of environments I’ve represented in my scenario. Mine isn’t the only scenario to use more than one landscape per collection, either; Rubicon and Eternal each use three per collection (though one of the three is a dummy texture in three of Rubicon’s four collections). Level-by-level changes it is, I guess. How should I fix the MML?
People should not be afraid of their governments. Governments should be afraid of their people.

“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”

Fool's Gold · Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · YouTube Vidmaster’s Challenge
User avatar

The Man
Sarasota, FL

Post Sep 10th '18, 14:56

If Rubicon and Eternal are using them, can you do it the way they do it?
User avatar

treellama
Pittsburgh

Post Sep 16th '18, 04:22

Sorry for the delayed response; I got sidetracked upgrading the non-landscape textures.

Anyway, I can’t figure out how to make it work the same way as it does in those scenarios. In fact, I can’t even figure out how to make it work the same way in each collection. Using the following code:

Code: Select all
   <landscape coll="27" horiz_exp="0" vert_exp="0" ogl_asprat_exp="1"/>
   <landscape coll="28" horiz_exp="0" vert_exp="0" ogl_asprat_exp="1"/>
   <landscape coll="29" horiz_exp="0" vert_exp="0" ogl_asprat_exp="1"/>

Collections 28 (night) and 29 (moon in the original game) look fine. Collection 27 (day) is hideously blurred.

Meanwhile, if I remove that for all three of these collections, collections 28 and 29 show up upside-down. I can’t begin to hypothesise why this occurs; it just does.

(I’ve excluded collection 30 (space) from this report because, for the time being, I’ve completely given up figuring out what’s even going on in it. Given that the landscapes seldom have much in the way of reference points to the human eye, it’s difficult to figure out what’s going on in them.)

Perhaps I should try exporting all these images as .png files and see if that changes anything. If that doesn’t fix it, I may just need to alter these on a level-by-level basis.

…ETA: oh. Lol. Apparently I’d made the night and moon landscapes wrap around twice. I hadn’t bothered doing that with the daytime landscapes. That could be the entire explanation. I’ll try changing this and see if it solves the problem.

…largely so, it seems. There are a handful of landscapes that look wrong now, but thankfully, I think I didn’t use them in the same level as any of the landscapes that shouldn’t have any of those custom settings, so I think I can fix this with MML now. I hope.
People should not be afraid of their governments. Governments should be afraid of their people.

“The trouble is that we have a bad habit, encouraged by pedants and sophisticates, of considering happiness as something rather stupid. Only pain is intellectual, only evil interesting. This is the treason of the artist: a refusal to admit the banality of evil and the terrible boredom of pain. If you can’t lick ’em, join ’em. If it hurts, repeat it. But to praise despair is to condemn delight, to embrace violence is to lose hold of everything else. We have almost lost hold; we can no longer describe happy man, nor make any celebration of joy.” —Ursula K. Le Guin, “The Ones Who Walk Away from Omelas”

Fool's Gold · Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · YouTube Vidmaster’s Challenge
User avatar

The Man
Sarasota, FL


Return to Mapping



Who is online

Users browsing this forum: No registered users

cron