• Welcome to SC4 Devotion Forum Archives.

Whatevermind's House of Wonders

Started by whatevermind, October 27, 2012, 11:48:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

whatevermind

Quote from: Lowkee33 on December 14, 2012, 07:09:50 AM
It's possible to add brushes to the menu (rather than just replace maxis)

How? Is it as simple as changing the IID (and icon/Ltext if desired)? I guess I'll try that and see what happens.




Ok, so updates. I've made the full square texture and worked out the brush sizes. Zooms 1 and 2 are full coverage sizes, while zooms 3, 4, and 5/6 are sized for detailing. I still have to test them to make sure they work as advertised, but it's mostly a formality, that part's all pretty straightforward.

I've also been playing around with the color palette for the file format, and it appears that it does support any 256 colors you want to code into it, not just the default greyscale. So I made something seasonal:



I doubt colors have any impact on the brushes themselves. In the case of the flora brush, they should still be interpreted as "plant trees", but if you define a color at 0x00, I don't know which way that would go. For the terrain brushes, it would probably treat them as equivalent to a grey, and assign an intermediate intensity to that pixel.

I had also mentioned a few posts back about controlling the spin of the brush. This turned out to be a somewhat messy property to work with, since there's a few different things going on there. The default behavior of the flora brush is to spin as long as you hold the mouse button down. These pictures were taken using the SC4D texture from a few posts above, after I had figured out the texture format and gotten it to work. The brush will spin:



Until it has rotated through a full circle:



The property that disables/enables spinning is Comp1AlignedWithMouseMoveDirection. The default setting for this property is False, but when you set it to True, the brush now points however your mouse is moving, and also stops spinning when you use it. When you look at the full range of terrain brushes, some have True as the default, and some have False. Because brushes can have multiple components, you could also have one that moves with the mouse, and another that does not. The trick with this setting though is that the game is very sensitive to the mouse movement direction, and the results aren't always predictable. Sometimes, when I thought I'd get it to plant aligned with the city square, it planted at a diagonal instead, and vice versa. I've found though that just making sure to move the brush back and forth a few times in the desired direction before clicking usually produces the desired direction. Usually.  ::)

No worries though, the full coverage sizes of my brush are sized to handle being placed on the diagonal as well, so it shouldn't matter how you point the mouse, just try to aim for the center of the city.  :D

While I was trying to figure out spin, I found two other exemplar properties that look like they would affect spin as well. The first, Comp1MaxDecalRotation, is not actually used by any of the Maxis brushes, and doesn't appear to actually do anything when you do use it. There are actually a bunch of "Decal" related brush exemplar properties, and they generally don't seem to be used, so perhaps they are leftovers from game development that were never removed.

The other property is TypicalBrushAngleIncrement, which is actually found in the Terrain Exemplar. According to the Reader definition, this defines an angle, in degrees, that the brush spins between successive applications, and the default is 0.5. There are five values defined, one for each zoom. Theoretically, this should control how fast the brush spins, but I haven't actually tried out different values to see what it does. Maybe someday. Also note that this should effect every brush in the game. I also wonder if the values aren't actually in radians, because 0.5d is a really tiny angle, it would take 720 iterations to trace a circle at that rate. Of course, how does the game define "successive applications", that plays a big role in what that value would have to be.



whatevermind

Quick update here, folks. I've tested and tweaked and tested and tweaked the brush sizes, and I think I've found some that work well pretty universally. Zoom all the way out and you get full coverage, while the closer zooms are set up for detailing/infill planting. The tiniest brushes are heavily influenced by clustering effects. So, while the brush might only paint one tile wide, the trees might end up 3 tiles away for a big cluster. Still, I kept the tinier brushes in there, because for grasslands/meadows, evergreen forests, etc. where they do cluster tightly, you can get very thin strips of flora. So, from a functional standpoint, things are essentially done. All that remains is to wrap it all up into a tidy package.

I've also played around a little with setting up this brush to be in addition to the Maxis brush, instead of a replacement, and it's a lot more complicated than I had guessed. As far as I can tell with what research I've done, it would require modding the UI to create a submenu for Flora tools. I'm still trying to get a sense of just how big a project that would be. If anyone does know how to do this I'd love to know.

whatevermind

Woohoo! Triple post!  :P

So, I've finished up this mod, and opened up a LEX candidacy, so hopefully in the near future you should all be able to plant forests in plentiful abundance with the optimized standalone flora brush. Compatible with all known tree and terrain mods, coming soon to an exchange near you!

I ended up simply setting it as a replacement to the Maxis flora brush. I haven't run into any roadblocks so far with tweaking the UI to make it into an additional brush, but working on the UI is intensely tedious, and I didn't want to let that get in the way of getting this mod released. I may still pick away at the UI and see where I get, and if I can make multiple flora brushes possible, I'd probably just release it as a separate mod, and update this one if necessary.

So, want some pretty pictures? Here's the brush in action (animated gif, I'm to lazy to make a movie  $%Grinno$% )



That's the brush at full zoom out on a large city, no tree or terrain plugins. It actually moves a little faster than that on my computer, but it gives you an idea of performance.

And here's a little something from the blooper reel:



I was testing it with custom terrain and trees, but was missing the prop mega packs that contained some of the trees.  Sure makes things easier for the cardboard industry though!  :P

jmyers2043

Works pretty good. I planted a large city and didn't have to wave my hand around and about. Although, I didn't see it plant a small square. I'll do a small city tomorrow and experiment with brush sizes.

- Jim

Jim Myers  (5th member of SC4 Devotion)

Swordmaster

I'd love to get my hands on this. Curious to know how it behaves. Well, by the looks of it.


Cheers
Willy

whatevermind

#25
It's official folks! Now on the LEX!




&dance &dance First upload !!!  &dance &dance

Serkanner

Congratulations!  &apls

Very nifty mod. I almost always fully forest my maps so this will make life a lot easier.

xannepan

Thank you very much for this great and very useful mod!

Kergelen



                                    Links to SC4 websites

Dantes



-> haha, the kingdom ob boxes  :D Fantastic picture an something of art  :P

whatevermind

#30
Thanks for the kind words! Hopefully it'll be a useful tool for years to come.




So, I had mentioned some time ago about getting into some of the other properties in the terrain brush exemplars, and then never quite finished up with that. There are three more properties of note to this exemplar (and probably a few more that I just haven't bothered with yet).

The first I actually brought up over in xannepan's thread, since it relates to his work there, which is Comp1IDOfEffectToPlace, which defines the Group ID and Instance ID of an effect to be created by the brush. This is used by the fauna brushes and the rain tool, but certainly could have other uses, too. The GID and IID it contains reference an effect from section 14 of the EFFDIR.

The next two are somewhat interrelated and define what the brush actually does. These are Comp1BaseTextureVal and Comp1OperationID. Comp1OperationID is actually pretty straightforward, as it controls what type of brush you are using, for example: flora, terrain, erosion, smoothing, fauna, etc. Values for this property are given as 0x0000000X. For brevity, I'll refer to them simply in 0xX format.

The possible values for Comp1OperationID are:

  • 0x0 - Terrain (hills/valleys)
  • 0x1 - Flora
  • 0x2 - Smoothing
  • 0x3 - Not used?
  • 0x4 - Fauna
  • 0x5 - Leveling
  • 0x6 - Erosion
  • 0x7 - Scorched earth?
  • 0x8 - Terrain (hills/valleys)
  • 0x9 - Rain
  • 0xA - Spring?

Theoretically, values higher than 0xA could be possible, but Maxis doesn't use them, and some quick tests didn't seem to reveal any higher values that did anything.

Comp1BaseTextureVal is a slightly more complex property, and it's purpose is to tell the game how to interpret the brush texture. There are only three values for this that are used by Maxis, and it only works on certain brushes, particularly the terrain (Operation ID 0x0 and 0x8) brushes. In the case of these two brush operations, this value determines whether the brush makes hills or valleys, or both. The values are as follows:

  • 0x00 - White parts of the texture are raised, and black parts are left untouched.
  • 0x80 - White parts of the texture are raised, and black parts are lowered.
  • 0xFF - White parts of the texture are left untouched, and black parts are lowered.

Grey in brush textures typically places that area under a medium strength, and presumably the closer that grey value is to either 0x00 (black) or 0xFF (white) determines how that pixel is interpreted by this property. I haven't tested that at all though. It's also possible that other values work, but probably still on a linear function between those three known values.

So, let's get into some pictures of these things at work. These were all tested using the SC4D texture I made, shown again below for reference:



Since many of the Operation IDs are used in Maxis brushes, I tried, for the sake of testing, to maintain Comp1Strength values similar to that used in the Maxis brushes for each operation, and this definitely helped make the effects more visible, as some of the brushes can be very sensitive (or insensitive) to small changes in strength.

Operation 0x0:
This is the basic terrain brush, useful for mountains, valleys, etc. I tried it with all three values for Comp1BaseTextureVal. It is very sensitive to strength, and works very fast. Combined with BaseTextureVal 0x00:

With BaseTextureVal 0x80:

With BaseTextureVal 0xFF:


Operation 0x1:
This is the flora brush. Comp1BaseTextureVal does not have any effect on this brush.

Operation 0x2:
This is the basic smoothing brush, also used for plains, etc. On level ground it does nothing, so I had to make some hills first to see what it could do.

That's not the clearest, but it is a gentle brush by default.

Operation 0x3:
This doesn't seem to be used. Maxis doesn't have any brushes that use this value, and I couldn't get it do anything.

Operation 0x4:
This is used for the fauna brushes. Simply setting the OperationID to 0x4 doesn't really do anything, I think the functionality of these brushes is really controlled by the effects they generate. The fauna brushes also have a few extra properties that I haven't looked into that probably play a role as well.

Operation 0x5:
This is the leveling brush. The operation is similar to 0x2, but stronger. First, I created some hills to test it on:

Then I put some water in the middle and ran it again:

It just grabs whatever terrain elevation is at the center of the brush, and applies it to whatever parts fall under the texture.

Operation 0x6:
This is the erosion brush. It appears to work over an area the size and shape of the brush texture, but doesn't seem to actually use the texture pattern itself. It just erodes everything that falls under the brush.

Operation 0x7:
This one is a weird one. It's not used by Maxis, but it appears to change the texture of the terrain. I call it "scorched earth" from the resulting appearance:

This pattern doesn't show up until you release the mouse button, and it is not saved by the game.

Operation 0x8:
This is also a terrain brush, similar to Operation 0x0. The only difference between the two seems to be that this one works more slowly. It has the same interaction with the BaseTextureVal property as Operation 0x0 does.

Operation 0x9:
This is the rain tool. It only seems to work if the Comp1BaseTextureVal is set to 0xFF. It's hard to describe how this one works, but the picture below shows it in use.

This is a temporary effect, and just about anything will erase this, including terraforming over it with other brushes. This effect is not saved.

Operation 0xA:
This is supposedly the "spring" tool, but I couldn't get it to do anything. The Maxis brush for this tool isn't actually in the game, though it is set up to essentially work a strong pinpoint (less than 1 tile wide), and lower the terrain at that point. Whether it's meant to be a sinkhole or an attempt at surface water isn't clear since it doesn't seem to work.

So, that pretty much wraps up terrain brushes. There's a few unsolved mysteries left in there, and a few more that could use further research, but I think with these basics, just about any sort of terrain brush could be created. The ability to layer brushes into the same tool also opens up a lot of possibilities, for example having Comp1 do one thing, and Comp2 something entirely different.

epicblunder

Loving your terrain brush so far, it's quite the timesaver!

Quote from: whatevermind on January 20, 2013, 06:41:10 PM
Operation 0x7:
This one is a weird one. It's not used by Maxis, but it appears to change the texture of the terrain. I call it "scorched earth" from the resulting appearance:

This pattern doesn't show up until you release the mouse button, and it is not saved by the game.

I would be very interested in this.  At one point i was working on making paintable MMP snow using Lowkee's textures but i could never get a result i liked well enough to release (because i suck at BATing alpha maps, couldn't get good edges and patterns).  Would it theoretically be possible to make a brush only cover a small area and point to a snow texture? That would be awesome.

Swordmaster

I'll need to read through this again when I have the game at hand, but could any of this knowledge be applicable to make ports and docks more easily? Something like the draw function in terraformer, I guess.


Cheers
Willy

jmyers2043

Quote from: Swordmaster on January 21, 2013, 04:03:38 AM
... but could any of this knowledge be applicable to make ports and docks more easily? ....


Cheers
Willy

Whoa! that would be very handy!

- Jim
Jim Myers  (5th member of SC4 Devotion)

whatevermind

Quote from: epicblunder on January 20, 2013, 07:49:53 PM
Would it theoretically be possible to make a brush only cover a small area and point to a snow texture? That would be awesome.

Like this? I had forgotten all about that thing, but when I read your post, I remembered Lowkee posting about the same thing. Anyway, I downloaded the mod and tested it and it works as advertised. You could of course replace the snow textures with some of your own choosing. And you should be able to get enough from my earlier posts here to set up the size and shape of the brush to your own liking, but I'd be happy to answer any questions.

Quote from: Swordmaster on January 21, 2013, 04:03:38 AM
...could any of this knowledge be applicable to make ports and docks more easily? Something like the draw function in terraformer, I guess.

That would be nice indeed!  ;D  But I don't think I've seen anything in the brush exemplars that could create such a tool. The problem is having something that can create terrain at a specific elevation (absolute, or relative to sea level) that the tool could be based off of, and I can't think of anything I've seen in game that can do that. Bridge approaches can do that, no idea how to tap into that function though.


Swordmaster

I've got a new challenge for you - as if you didn't have enough of them already :D

I've been trying to figure out the shadow texture (7AB50E44-1ABE787D-69D3A23B in SimCity2.dat). It looks like it's a similar type of FSH that I can only edit in HEX mode. Can you find out if it's possible to make a new texture like this which is blank? So we can assign this new texture to flora we want without shadows? I've been trying to do this but I can't get my head wrapped around how the FSH is coded. Besides, both versions of reader don't reliably display the color version of the FSH.


Cheers
Willy

memo

Willy, are you sure it is not an ordinary FSH texture? Actually, there are FSH files the reader cannot display properly. Though, you can export them as usual (see attachment).

whatevermind

#37
A new challenge!  ;D

Well, it looks like a mostly normal file as far as I can tell. There's something extra going on with it near the end of the file, but I'm not really sure what, it's not a palette in the same manner as the brush texture file types.

Either way, from what I gathered poking around the file, I made two versions of it that should be blanked out, and I've attached them. However, they are untested since I don't know how this file is used and what references it. I'm betting you do have some way of testing them though.  ;D

The one version is simply a blank FSH file, the other includes an offset. The original file has an offset, so I figured I'd create a version with the same offset as well just in case that is critical to functioning.

I'd be very interested in how this turns out and if these things work for you.



Edit: I saw that this texture is referenced by the flora exemplars while working on some today, so I tried these textures out, as well as a few other variations on them - and none of it seemed to have any effect on shadows. I even got rid of the shadow properties altogether and the trees still had shadows.

Swordmaster

Thanks! You're right, apparently the property is not functional. Too bad, this could have been interesting. Maybe they're used with software rendering, but for some reason this mode is usually very buggy for me.


Cheers
Willy

whatevermind

A question for all of you out there. I'm working on something that "requires" some modifications to the Rewards LUA, and unfortunately, you have to replace the entire thing anytime you mod it, you can't just replace those sections that you want to change (or at least if you can I can't seem to make that work).

So, I'm wondering if anyone knows of any mods out there that replace the Rewards LUA file. I'm already aware of Mr Truesage's City Hall Mod, but I'd love to know if there's others out there that I might have to take into consideration if this ever gets to a public release.