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.” —V, V for Vendetta (Alan Moore)

“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”

“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell

Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · 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.” —V, V for Vendetta (Alan Moore)

“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”

“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell

Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · 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.” —V, V for Vendetta (Alan Moore)

“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”

“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell

Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · YouTube Vidmaster’s Challenge
User avatar

The Man
Sarasota, FL

Post Nov 21st '19, 02:03

Bumping an ancient thread.

In case anyone still has a similar problem to my issue with landscapes, a more elegant solution to this problem is to handle it on a texture-by-texture basis, which I hadn’t realised was a possibility last year. Consequentially, I’ve got the following code as my Landscapes.mml file:

Code: Select all
<marathon>
   <opengl>
      <!-- landscape collection 1 (day) -->
      <texture coll="27" bitmap="0" type="1" normal_image="Data/27 Day/00.dds"/>
      <texture coll="27" bitmap="1" type="1" normal_image="Data/27 Day/01.dds"/>
      <texture coll="27" bitmap="2" type="1" normal_image="Data/27 Day/02.dds"/>
      <texture coll="27" bitmap="3" type="1" normal_image="Data/27 Day/03.dds"/>
      <texture coll="27" bitmap="4" type="1" normal_image="Data/27 Day/04.dds"/>
      <texture coll="27" bitmap="5" type="1" normal_image="Data/27 Day/05.dds"/>

      <!-- landscape collection 2 (night) -->
      <texture coll="28" bitmap="0" type="1" normal_image="Data/28 Night/00.dds"/>
      <texture coll="28" bitmap="1" type="1" normal_image="Data/28 Night/01.dds"/>
      <texture coll="28" bitmap="2" type="1" normal_image="Data/28 Night/02.dds"/>
      <texture coll="28" bitmap="3" type="1" normal_image="Data/28 Night/03.dds"/>
      <texture coll="28" bitmap="4" type="1" normal_image="Data/28 Night/04.dds"/>
      <texture coll="28" bitmap="5" type="1" normal_image="Data/28 Night/04.dds"/>

      <!-- landscape collection 3 (moon/dusk) -->
      <texture coll="29" bitmap="0" type="1" normal_image="Data/29 Dusk/00.dds"/>
      <texture coll="29" bitmap="1" type="1" normal_image="Data/29 Dusk/01.dds"/>
      <texture coll="29" bitmap="2" type="1" normal_image="Data/29 Dusk/02.dds"/>
      <texture coll="29" bitmap="3" type="1" normal_image="Data/29 Dusk/03.dds"/>
      <texture coll="29" bitmap="4" type="1" normal_image="Data/29 Dusk/04.dds"/>
      <texture coll="29" bitmap="5" type="1" normal_image="Data/29 Dusk/05.dds"/>

      <!-- landscape collection 4 (space) -->
      <texture coll="30" bitmap="0" type="1" normal_image="Data/30 Space/00.dds" opac_type="0"/>
      <texture coll="30" bitmap="1" type="1" normal_image="Data/30 Space/01.dds" opac_type="0"/>
      <texture coll="30" bitmap="2" type="1" normal_image="Data/30 Space/02.dds" opac_type="0"/>
      <texture coll="30" bitmap="3" type="1" normal_image="Data/30 Space/03.dds" opac_type="0"/>
      <texture coll="30" bitmap="4" type="1" normal_image="Data/30 Space/04.dds" opac_type="0"/>
      <texture coll="30" bitmap="5" type="1" normal_image="Data/30 Space/05.dds" opac_type="0"/>
   </opengl>

   <!-- 360 degree landscape wraparound where applicable -->
   <landscapes>
      <landscape coll="28" frame="4"
         horiz_exp="0"
         vert_exp="0"
         ogl_asprat_exp="1"
      />

      <landscape coll="28" frame="5"
         horiz_exp="0"
         vert_exp="0"
         ogl_asprat_exp="1"
      />

      <landscape coll="29" frame="4"
         horiz_exp="0"
         vert_exp="0"
         ogl_asprat_exp="1"
      />

      <landscape coll="29" frame="5"
         horiz_exp="0"
         vert_exp="0"
         ogl_asprat_exp="1"
      />

      <landscape coll="30" frame="5"
         horiz_exp="0"
         vert_exp="0"
         ogl_asprat_exp="1"
      />
   </landscapes>
</marathon>

Both parts of this are important to make the textures look correct. In particular, ogl_asprat_exp is what makes the landscapes wrap around in OpenGL mode. (I’m sure there’s an explanation for why this is in the landscapes segment rather than the OpenGL segment, but I’m not sure what it is.)

Obviously, change values as needed.

My current Stupid Scripting Trick question concerns how the engine handles OpenGL scripts for scenery. I have the following code for some of my levels:

Code: Select all
<marathon>
   <!-- Load Jjaro scenery objects -->
   <scenery>
      <object index="50" flags="5" destruction="27">
         <normal><shape coll="25" seq="28"/></normal>
         <destroyed><shape coll="25" seq="29"/></destroyed>
      </object>
      <object index="51" flags="5" destruction="27">
         <normal><shape coll="25" seq="30"/></normal>
         <destroyed><shape coll="25" seq="31"/></destroyed>
      </object>
      <object index="52">
         <normal><shape coll="25" seq="27"/></normal>
      </object>
      <object index="53">
         <normal><shape coll="25" seq="32"/></normal>
      </object>
      <object index="54">
         <normal><shape coll="25" seq="33"/></normal>
      </object>
      <object index="55">
         <normal><shape coll="25" seq="34"/></normal>
      </object>
      <object index="56">
         <normal><shape coll="25" seq="36"/></normal>
      </object>
      <object index="57">
         <normal><shape coll="25" seq="39"/></normal>
      </object>
      <object index="58">
         <normal><shape coll="25" seq="35"/></normal>
      </object>
      <object index="59">
         <normal><shape coll="25" seq="37"/></normal>
      </object>
      <object index="60">
         <normal><shape coll="25" seq="38"/></normal>
      </object>
   </scenery>
</marathon>

The purpose of this is to restore the original Jjaro scenery objects in my Jjaro collection. (By default, it loads the Sewage scenery objects from Marathon 2/∞, because the Sewage collection is used for an entirely different environment… long story.) Functions fine. Even seems to work OK in film replay, which is important. I’ve got the following segment of code to load some scenery objects RADIX created into the Lava collection:

Code: Select all
<marathon>
   <!-- Load Jjaro flora in lava set (objects 0-5 & 8) -->
   <scenery>
      <object index="0" flags="0">
         <normal><shape coll="23" seq="21"/></normal>
      </object>
      <object index="1" flags="0">
         <normal><shape coll="23" seq="22"/></normal>
      </object>
      <object index="2" flags="0">
         <normal><shape coll="23" seq="23"/></normal>
      </object>
      <object index="3" flags="0">
         <normal><shape coll="23" seq="24"/></normal>
      </object>
      <object index="4" flags="0">
         <normal><shape coll="23" seq="25"/></normal>
      </object>
      <object index="5" flags="0">
         <normal><shape coll="23" seq="26"/></normal>
      </object>
      <object index="8" flags="0">
         <normal><shape coll="23" seq="27"/></normal>
      </object>
   </scenery>
</marathon>

I’ve loaded this code into Visual Studio Code’s XML editor, and there don’t seem to be any syntax errors. It works some of the time, but it inexplicably does not load the HD graphics I’d defined in my Miscellaneous.mml global script. Copying the OpenGL definitions back into the map script will load the HD graphics while I’m playing the game:

Code: Select all
<marathon>
   <!-- Load Jjaro flora in lava set (objects 0-5 & 8) -->
   <scenery>
      <object index="0" flags="0">
         <normal><shape coll="23" seq="21"/></normal>
      </object>
      <object index="1" flags="0">
         <normal><shape coll="23" seq="22"/></normal>
      </object>
      <object index="2" flags="0">
         <normal><shape coll="23" seq="23"/></normal>
      </object>
      <object index="3" flags="0">
         <normal><shape coll="23" seq="24"/></normal>
      </object>
      <object index="4" flags="0">
         <normal><shape coll="23" seq="25"/></normal>
      </object>
      <object index="5" flags="0">
         <normal><shape coll="23" seq="26"/></normal>
      </object>
      <object index="8" flags="0">
         <normal><shape coll="23" seq="27"/></normal>
      </object>
   </scenery>

   <opengl>
      <!-- Lava scenery - copied here due to Aleph One weirdness -->
      <texture coll="23" bitmap="62"
         normal_image="Data/23 Lava Scenery/62.png"
         opac_type="1"
      />

      <texture coll="23" bitmap="63"
         normal_image="Data/23 Lava Scenery/63.png"
         opac_type="1"
      />

      <texture coll="23" bitmap="64"
         normal_image="Data/23 Lava Scenery/64.png"
         opac_type="1"
      />

      <texture coll="23" bitmap="65"
         normal_image="Data/23 Lava Scenery/65.png"
         opac_type="1"
      />

      <texture coll="23" bitmap="66"
         normal_image="Data/23 Lava Scenery/66.png"
         opac_type="1"
      />

      <texture coll="23" bitmap="67"
         normal_image="Data/23 Lava Scenery/67.png"
         opac_type="1"
      />

      <texture coll="23" bitmap="68"
         normal_image="Data/23 Lava Scenery/68.png"
         opac_type="1"
      />
   </opengl>
</marathon>

Again, no syntax errors, and seems to behave fine while I’m playing the game. However, if I replay a film, it will behave strangely. The last scenery object definition, for object 8, actually changes a solid scenery object to make it possible to pass through. This behaviour still appears to be replicated in film playback; the film playback would quickly go out of sync if it were not. I have not been able to identify any desyncs.

However, all of the redefinitions of the shapes are lost in film playback; Aleph One reverts to my scenario’s default shapes for those scenery objects. Moreover, if I restart a new game on the same level after replaying a film, it still will not load RADIX’s shapes.

Furthermore, removing the OpenGL definitions from my global scripts does not seem to fix playback for the levels using RADIX’s shapes. I suspect the problem is linked to redefinitions of scenery in levels employing OpenGL scenery. I’ve had similar problems with levels employing similar scripts in the Pfhor collection that also employ HD shapes. I’ve been employing OpenGL scenery redefinitions for the level “Dimensional Bleedthrough” for over a year, and although this script usually functions correctly while I’m playing, it has never functioned correctly in film playback.

One final note: I was hoping that employing:

Code: Select all
      <txtr_clear coll="23"/>

in the OpenGL field before loading all the textures would fix the problem, but it doesn’t seem to have had any effect. There is a reasonable chance that I am not using it correctly, however.

Does anyone have an explanation for what’s going on here? Am I neglecting to reset some other value somewhere that will stabilise the behaviour of these scenery objects? (I should note that the default lava scenery objects are not having any MML loaded into memory; it’s only the scripts using RADIX’s shapes where this occurs.)
“People should not be afraid of their governments. Governments should be afraid of their people.” —V, V for Vendetta (Alan Moore)

“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”

“If others had not been foolish, we should be so.” —William Blake, The Marriage of Heaven and Hell

Last.fm · Marathon Chronicles · Marathon Eternal 1.2 · Where Monsters Are in Dreams · YouTube Vidmaster’s Challenge
User avatar

The Man
Sarasota, FL


Return to Mapping



Who is online

Users browsing this forum: No registered users