Rotation?

Spatzimaus

Mad Scientist
Joined
Sep 21, 2005
Messages
3,063
Location
Los Angeles, CA
Question for anyone who might know. I've got an image, type .dds, that I use in my Mythology mod (nearly functional!). It's a square image, 600x600, and I want to be able to rotate it 90, 180, or 270 degrees depending on what the player clicks; I could just add four versions of the image, but that'd be very wasteful, so I'd prefer to be able to just manipulate the one image it already displays. While the core game's UI elements never seem to do anything like that, many Lua functions used by other games DO allow for rotation.

So, I'm wondering whether anyone knows of anything like this in the Lua, possibly from one of the DLCs (which I've never bought). I've tried Rotate, SetRotate, SetRotateVal, and SetRotation, all of which are used by Lua mods for other games, and none of those are accepted by Civ5; I could keep guessing forever (SetTextureRotation?) but I'm hoping someone else has an idea.
 
Bumping this thread from four months ago. I'm about to release the next big version of my Mythology mod, now that all of its internal mechanics are working, but I could REALLY use one of the following:

> A way to rotate a DDS image, either using a command inside a Lua function or within a declaration in a Lua-related XML file
OR
> A way to draw an arbitrary non-regular polygon, preferably a FILLED polygon, inside an existing layer.

Now that I've got all the save/load kinks worked out of my Mythology content, it's just about ready for general use, but this is really the last little issue I'm having. Basically, the Mandala (the UI I use for my mythology system) needs to be able to display the region (in a 2-dimensional alignment space) associated with each Focus the player can select. Ideally, clicking on a Focus would light up the appropriate section, and either of the above methods would work for that

If neither of the above are possible, then I'll have to do one (or both) of the following:
> Add a grid to the UI (by adding a few hundred "+" icons), where mousing over a grid intersection would show which Foci were available at that position, and clicking on a Focus would change the icon's color in the appropriate areas. That's a lot of overhead involved, so I'd prefer not to do this.
> Add six DDS files showing groups of Foci, and simply switch which DDS is displayed as the background. Not quite as readable as I'd like, since it'd be hard in some cases to figure out the overlap regions, and it'd also make it harder to make the UI look nice in the future.
Neither of these is really a good solution, so I'd really prefer if someone had any ideas about the first two concepts.
 
I can't answer any of your questions directly. But:

  1. For what it's worth, you can resize dds display images in Lua. They have to be defined at the proper size initially in the xml (or you get cropping or a weird smear of the last pixel row), but after that, you can use Lua to stretch or squeeze the image on the x and/or y axes. I use this in my mod so that I can use 2D art portraits with different aspect ratios (since I use many 100s of these, it was easier to make the game accommodate the art rather than the other way around). I did this back in September so I forgot the exact functions, but I can check if you need it.
  2. I don't think there is any limit to the number or size of dds images in game. I've added about 400 ~0.5M 2D images without seeing any increase in memory usage. (I think this is the point of the dds format.) It's only an issue for downloading.
 
For what it's worth, you can resize dds display images in Lua.

Unfortunately, no stretching or shrinking can equal a 90-degree rotation. That's the problem I've run into; there's really nothing in the existing UI that isn't just a premade jpeg or something, so there's no existing logic I can cannibalize to do what I want.

Honestly, all I REALLY need is a simple "draw" function that lets me place (and then remove) a colored line between points A and B. I can make something workable by myself if I had that, but the only examples I've seen of these in the core game are purely vertical or horizontal, and I need diagonals as well (and not just 45-degree angles, I mean arbitrary ones). What I really want is a "fill" function as well, so that I can add a color to the appropriate sections, but I could make do without that.

I don't think there is any limit to the number or size of dds images in game.

Other than, as you noted, the downloading issue. Also, if you're constantly rebuilding your own mod while testing changes (which I am), the time used re-copying of those files to the destination directory can get a bit prohibitive.

This is why I'd rather not add 21 new images (one per Focus) and would instead prefer something dynamic. Granted, I could make the 21 very low in detail and scale them up to whatever I need, but it'd be much easier (and better-looking) if I could just take six nicely-detailed images and rotate them 90, 180, or 270 degrees as needed.
 
Honestly, all I REALLY need is a simple "draw" function that lets me place (and then remove) a colored line between points A and B.

Never watched the replays? Check out the <line> tag in the ReplayViewer.xml/lua files
 
Never watched the replays?

Actually, no. It's been almost a year since I actually FINISHED a game; since I spend most of my Civ time working the kinks out of my Mythology mod, I rarely even get past the first 30 turns before I've got enough things to fix/tweak to require starting over. So I've never seen a replay.

But good catch; while I don't want to screw around with creating a new instance type, this WOULD allow me to create 21 polygon layers without too much trouble. It's still not as nice as I'd like, since it has no "fill" option that I can see, but it's definitely close enough for a first attempt.
 
Also, if you're constantly rebuilding your own mod while testing changes (which I am), the time used re-copying of those files to the destination directory can get a bit prohibitive.

This specific problem is solved by my ModBBF script, which can add 100s of large dds files in seconds. (Also, if you run ModBBF twice after a new version build, it has a nice side effect of always triggering a mod browser update.)

Granted, I could make the 21 very low in detail and scale them up to whatever I need,

Make high detail and scale down.
 
This specific problem is solved by my ModBBF script,

The main reason I haven't done anything like that is that since I don't have a huge number of asset files, it hasn't been worth it to go through any extra hoops. I'm trying to avoid needing any extra steps, so if there's a possibility of doing what I want without adding any DDS files at all, I'd prefer that path. Now, in the future I'll probably have to do this sort of thing, like when I add wonder splash screens for all of my mods and custom unit models for all my units, but up until now it hasn't been necessary to do anything beyond the basic Build functions.

Make high detail and scale down.

I'm trying to place a semi-tranparent overlay over a 600x600 area, with 21 different polygon shapes displayable on that overlay. Five of them are squares, four are right triangles, four are non-right isoceles triangles, and the remaining eight are slightly more complex polygons. So unfortunately I can't just use the box tool to simulate a fill function, as far as I can tell, for anything other than the squares.

If I make 21 DDS images of that full size, then the file sizes get prohibitive. But since the overlays are mainly simple polygons with almost nothing in the way of fine detail, I could make the files at a lower resolution (like 300x300 or even lower) and then use Lua to stretch them up to the right size; the amount of pixelation would be minor, since all of the lines are straight.

The lines method used by the replay system works just fine for what I need, except that it doesn't seem to have an option for filling the polygons. If I can find a polygon function that does handle that, then I'd be set, with no need for DDS files at all. In the meantime, I'm going to try a method involving dimming the background while highlighting certain lines; I'm hoping that this will be readable enough to the users (people other than me), which I'll know by next week.
 
Actually, no. It's been almost a year since I actually FINISHED a game ...

You don't need to finish a game, there are several other mods/ways to watch the replay - retire being one of them.

If you want to make a pixel-by-pixel overlay, you may be able to "get creative" with the <replaymap>. Not tried it, so you may not be able to get transparent pixels and/or overlay it onto an existing screen.
 
If you want to make a pixel-by-pixel overlay, you may be able to "get creative" with the <replaymap>. Not tried it, so you may not be able to get transparent pixels and/or overlay it onto an existing screen.

In the end, all I did was make a transparent layer covering the entire Mandala area, tint it slightly with the appropriate color, and outline the area in question using brighter lines. I'm not done with it, but I think it's readable enough that filling the area just isn't necessary for now. It's too bad, though; we could really use these sorts of drawing tools for a lot of things, but the only dynamic "fill" functions are the unit health bar and the circular blue overlay on the Apollo icon (showing tech progress towards unlocking it) in the Victory Progress screen, neither of which really works for this purpose.
 
Back
Top Bottom