Graphics problems when placing additional natural wonders

General Tso

Panzer General
Joined
Oct 12, 2007
Messages
1,548
Location
U. S. of A.
I'm working on adding new terrain, features, and natural wonders to the map at the beginning of the game. I'm using my own copies of the game code with a few modifications. I've found that if I use the SerialEventDawnOfManShow event to trigger my code all of the graphics load and work when the map is displayed. With one exception - natural wonders.

The problems are somewhat sporadic. At times I've created every wonder (I have all 17) on a single map and they all looked perfect. I can restart the map using the main menu and the next time there might be several glitches. The time after that perfect, etc.... But quite often there is at least one graphic glitch and sometimes there are a large number of them.

My code appears to be placing the natural wonders in the proper places and doing the proper modifications to the wonder plot and surrounding area.

Here's the type of problems that occur:

The Great Barrier Reef: Doesn't show up. Just appears as normal coastal water plot.

The Rock of Gibraltar: Sometimes the rock itself doesn't show up - just appears as flat grassland. Other times the mountain that is generated on the plot next to it doesn't show up - the land looks flat.

Lake Victoria appears as a black smudge.

Some of the wonders that require their plot to be changed to a mountain appear flat.

In all cases the proper changes appear when I check the appropriate plot. The plot does contain the wonder even though it may be invisible or distorted. Plots where mountains where added because of the wonder do indeed have their plot type set to mountain. The problems all appear to be graphical. To help add to my confusion when I add mountains using my separate terrain code they all appear fine - none of them are flat. The terrain code is identical when adding moutains - it just doesn't create wonders.

Any ideas?
 
Thanks. I'll check them out. Maybe they will shed some light on the subject.

Edit: Unfortunately I couldn't find any information about those events. Even if they do apply to natural wonders I don't think they would help. I assume they just get triggered when the appropriate thing happens. My code will be creating the new natural wonder that triggers the event. So I'm already there. I just need to find out what's causing the graphics problems.
 
Natural Wonders are features and, unfortunately, only the "base 7" features (IDs 0-6) will be updated in-game by the graphics engine. Natural Wonders and the atoll feature (all IDs > 6) won't update. There are some threads on this somewhere...

It's sort of like trying to update terrain type. The graphics engine just won't draw it (until you reload the game).

But who knows? maybe some untested Events will trigger a graphics update. (I'd be happy if we found one that just redrew the whole map as if it were a reload.)
 
I'm adding the natural wonders right before the map is displayed. I could definitely be wrong but I think I'm bypassing the in-game loading problem. For the most part terrain, features, and natural wonders can be change by my code and they work fine (With the exception of the problems listed above).

ReloadTextures - That sounds promising. I'll have to poke around.
 
I just tried ReloadTextures but it didn't seem to help. I even cycled thru every plot on the map and called ReloadTextures while passing x,y for that plot. It didn't help. :sad:
 
I think I found something. It seems to be tied to the location of the plot on the map. If it's near the edge (top to bottom) or near the "seam" (left to right where x goes from 0 to max) that's when the problem occurs. I'm going to do some more testing. If this indeed does solve the problem I'll report back here. Hopefully it will stop somebody else from wasting as much time as I have.
 
Well back to the drawing board...

Not creating wonders near the edge of the map seemed to reduce the frequency of the problem. But the problem still exists.
 
PerfectWorld3, Techtonics and other mapscripts (possibly all, I'm not sure) often have glitches near the map seam. Hills or mountains appear flat and visa versa. It's not the modders fault I'm sure, but no one has ever provided an explanation as far as I know. There's something about the base mapscripts that seem to give them privileged access to graphics. (Note: I'm not sure if this still true after the last patch. Loading modder mapscripts is more integrated in the menu now than it was before.)

I haven't spent much time on it, but when I tried to add mountains during AssignStartingPlots, I got invisible mountains...
 
Sound like the same problem.

I've been doing some testing where I add several hundred natural wonders to a huge map. As long as I stay away from the edges most maps work OK and all of the wonders appear as they should. But every once in a while I get one where some of the wonders are corrupted. Maybe I had two problems and staying away from the map edge just fixed one of them? I'm taking a brake for now. I'm starting to think in circles. :crazyeye:

Thanks for the help.
 
Maybe I had two problems and staying away from the map edge just fixed one of them? I'm taking a brake for now.

Flat map or global? If its global you may want to check if your glitch graphics are where you get a "seam" when the flat map is wrapped to be global.
 
Thanks for mentioning it. Unfortunately I'm already doing that. For testing purposes I'm currently not allowing any of the natural wonders created by my mod to be within 5 plots of the edge (both x and y). That seemed to get rid of a few of the problems plus I think it looks better. I'm in the process of tracking down the rest of the problems. I'll post some details soon...
 
The problem with ghost tiles on map seams in modded maps always involves one major thing. The plot get's changed. The reason the original maps almost never have these issues is because they're designed to only assign all this stuff once (unless it comes back in a later stage and changes the plot for some reason; say during starting location placement if it determines a player's position isn't fertile enough it may add sheep to a flat tile thereby forcing hills on that tile, if that tile was on the map seem it will be a ghost tile even in the original script).

If you're willing to share your code I'd be happy to take a look and see if any of the tricks I've learned through working with mapscripts are applicable. Additionally, some wonders just won't display properly if they don't meet the terrain requirements. Krakatoa for example absolutely cannot have land adjacent to it, etc. I haven't messed with Lake Vic yet, but it's more than possible that rivers on it's edges or something may cause it to have issues. GBR however I'm not quite sure what's happening; I've even messed with a lot of the default wonder placement code to increase the number of wonders spawned, limit the broken wonders (FoY, El Dorado, and Mt. Kili) from spawning, and added yields to the tile underneath certain underpowered NWs. I've yet to notice any issues from my NW placement tinkering but I am dealing with maps that are X-shifted to place as much water as possible on the map seam and I didn't mess with any of the NW's actual placement requirements.
 
Thanks for the information Bobert13. I'll explain what I'm trying to do along with some observations. If you (or anybody else) have any ideas I'd be interested in hearing them.


I've added several new features to my mod that allows the user to add terrain, features, and natural wonders relative to each player's starting location. I use the Dawn of Man event to trigger my code after the standard map generation is complete but before it becomes visible. As long as I follow the basic rules terrain and features work with no problems.


Natural Wonders are another story. As a test using my mod I filled maps with 100's of naturals wonders. Including some of every type. Here are my observations from that test.

The Great Barrier Reef: Was the biggest problem. It was invisible at least 75% of the time. Both reef tiles for a given wonder where always the same - either both visible or both invisible.

The Rock of Gibraltar: The mountain that get's created (if needed) next to the wonder is corrupted in some way. The game says there is a mountain but the plot appears flat with the terrain consisting of a mixture of the surrounding tiles.

All other natural wonders: There images appears corrupted. Wonders that require mountains look flat, Lake Victoria looks like a black smudge, etc... This problem was far less common then the two above.


By trial and error (and perusing this forum) I ended up doing the following.

Added limit checks so that wonders would not be built near the edge of the map or near the seam.

Added a check that doesn't allow new natural wonders to be built within 2 plots of another wonder.

Disabled Great Barrier Reef and Rock of Gibraltar (just in my code).


By doing these things I was able to create maps with hundreds of natural wonders and they always worked OK.

It seems to me that the problem is caused by placing wondesr close to each other and changing a plots height near a wonder.

Reef: Always places two reefs next to each other. Is invisible a large amount of time.

Gibraltar: Almost always places a mountain next to the wonder. Problem is common.

Other wonders - Seems like the problem occurred when two wonders where only one plot apart so the problem was less common.

If anybody has any thoughts on this I'd be greatly interested in hearing them. I'd like to get the Reef and Gibraltar working if possible. Even if that's not possible. I'd still like to know whats happening.

.
 
Bobert13:

I forgot to mention: If you are still interested in checking out the code. I expect to release a new version within the next week or so. I figured I'd just wait until then. That way you can look at it after I get a chance to clean things up and get everything functioning as well as possible. I can always enable Gibraltar and The Reef in a later version - if there is indeed a way to do it.
 
The Rock of Gibraltar: The mountain that get's created (if needed) next to the wonder is corrupted in some way. The game says there is a mountain but the plot appears flat with the terrain consisting of a mixture of the surrounding tiles.
I see this one often in an unmodded Continents map. (I've probably looked at 1000 of these maps in my mod autoplay testing.)

It's clear that many of these NWs have very specific rules about what can/can't/must be adjacent to them. I think that you can reverse engineer these rules from looking at code in AssignStartingPlots.lua.
 
I agree: Some of these problems occur in unmodded games. I've seen both the flat mountain for Gibraltar and the invisible Reef.

I know next to nothing about actual graphics creation. I'm just familiar with the code used to generate them so I could be off base here. But it seems that the main concept is: Once a wonder is placed. Never change the plot "height" within 2 plots of it or place another natural wonder within 2 plots of it (maybe just 1 plot of it?). The problem is definitely intermittent so with the low rate of natural wonders in a normal game it doesn't show up very often.
 
Back
Top Bottom