Reveal Map to Player as if it had been explored entirely

jcikal

The Voice of Reason
Joined
Jul 23, 2005
Messages
303
How do I reveal the map to the player? I don't mean the CTRL-Z cheatcode, I mean that the map is revealed to the player, just as if it had been explored in its entirety. What file or files do I need to change for this to happen?
 
Could someone with Python/C++ knowledge please help this poor soul?
 
I'm not sure of one best way to reveal all the plots, but here's how plot reveals work, hopefully it can give you some ideas:

First, some definitions:

1.) Revealed: A plot is "revealed" if it has been seen by a team. The fog of war may still be on it.
2.) Visible: A plot is visible if it can currently be seen by a team. Thus, there will be no fog of war on this tile.

All plots have a few little counters to keep track of whether the plot is revealed or visible to a team.

So, say there's a plot that you can't see (it's not revealed). The revealed value and visible value for your team would be 0. Now say you move your unit one plot closer so that now it's in range to see it. What's happened is that the visible value is incremented by one. Since it's also true that you're just now seeing the plot for the first time, the reveal value is incremented also. Since both of these are now 1, the plot is revealed and visible to you.

Now, say you move the unit away, so that it can no longer "see" the plot. Whenever a unit moves, it decrements from one all the plots it could see from where it's moving from. It then moves, and increments all the plots it can see from it's destination plot. The visible count in the plot we were thinking of was decremented by one, so it's now back to zero. The revealed value never decrements. With a reveal of one and a visible of 0, this plot is now under fog of war (revealed, but not visible).

The idea that a plot is always current even though units come and go and move many many times only works if for every time a unit increments the visible counter by one, they decrement it by one once they're done with it. So, if for some reason Firaxis never decremented visibility from all the plots a unit could see for when that unit died, you would have a situation where the plots the unit could see when it died would be perpetually visible, because the visibility would never drop below 1 (since the unit that added to the visibility count is now dead and even though more units would pass by eventually, they would increment to two then when they leave decrement back down to 1).

Knowing this, perhaps you might want to try something in the onGameStart function in the event manager where for the team you want to have the plots revealed you go through all the plots on the map and increment the visible by one. This will throw off the value to always be one more than it should, which means it will never drop below 1, and the plots should always be visible.

Edit: BTW, you can change visiblity count of a plot via CyPlot.changeVisibilityCount(TeamType eTeam, INT iChange, InvisibleType eSeeInvisible). Seeing invisible units work just like reveal and visible, so if you use some Invisible type for the last argument, you can also change so that a certain invsiible type is now visible as well. I would recommend, however, using changeInvisibleVisibilityCount (the coolest function name in the entire API if you ask me) so that if you want to see all invisible units, you can simply loop through all the invisible types and just use that.
 
you could reveal the world in worldbuilder....
 
0d1n3oo3Broad said:
you could reveal the world in worldbuilder....

That's true, but since that was brought up last time this very same user made a thread with the very same question (:nono: ) I take it that's not what they wanted.

Also, in Worldbuilder you can only reveal plots, not set them to visible. Finally, the end result with Worldbuilder is only the current game to be revealed, and perhaps you want to make it so that all games you play (included random maps) are revealed (and/or visible).
 
That's correct Gerikes, btw, given the fact that you obviously know a lot about the Python language, what do you recommend I do in order to understand the Python language as it is used in Civ 4? Thanks for the help too. That's exactly what I wanted, not only for the map tiles to be visually visible to me, but that the computer also understands that the entire map has been explored by me as well.
 
jcikal said:
That's correct Gerikes, btw, given the fact that you obviously know a lot about the Python language, what do you recommend I do in order to understand the Python language as it is used in Civ 4? Thanks for the help too. That's exactly what I wanted, not only for the map tiles to be visually visible to me, but that the computer also understands that the entire map has been explored by me as well.

Well, I was lucky, as I had already learned Basic, Pascal, C, C++, Lisp, and Java before I was introduced to Python. Once you have a bunch of languages under your belt, picking up new ones becomes exponentially easier. However, I still made sure I picked my way through as much as I could with Dive Into Python, although I heard good things too about How to think like a Computer Scientist


As for learning specifically how Python works with Civ4, I just looked at the example tutorials that came with the game. I also feel I had an advantage that if I didn't know how things worked (like when python functions inside CvGameUtils or CvEventManager are called) I could look at the SDK and easily tell what's going on. You can probably still do this even if you don't know c++ that well.

But for the most part, CvGameUtils and CvEventManager can just do so much, you really need to just weed through them all and try doing different things with the functions. If you want to make new screens (like civic screens) or make popups, see how the the screens already used or the python popups work (some popups have their results built into the SDK).

Edit: Oh, and one last thing. Get some utility that you can use to grep files, such as Windows Grep, and learn to use it. Then, if you ever want to change something but don't know where it is, you can just grep the entire python directory for the word. Say you're trying to figure out how to use a python function. Grep the main python file directory for that function name (i.e. "currHitPoints") and you'll probably find it used somewhere which you can base your own code off of.
 
Thanks Gerikes, I'm very much interested in being able to watch the AI as they move/build cities/battle each other. This is mainly because I was already accustomed to watching them in Civ3. In Civ 4 however, this is just not possible; even with all ofthe map being visible, whenever it's the AI's turn to play, all I get is a message that says "Waiting for the other Civs" to finish their turn, but it doesn't show me anything as they are doing it, rather, after they finish their turn, then I can just move about the map with the camera to see what they have built, but I do not get the pleasure of watching them as they are actually building their cities.

I did notice that regardless of whether or not I was close to the animals, whenever any of the animals moved, the camera would center itself on the animal unit and would show me the animal moving to another part of the map. So if I could accomplish for the game to do the same thing they do for the animal units for the rest of the AI units, I would defitively get much more from the game than I'm getting now.

If there's any help you can offer on accomplishing this task, I'd sure appreciate it. Thanks.
 
jcikal said:
I did notice that regardless of whether or not I was close to the animals, whenever any of the animals moved, the camera would center itself on the animal unit and would show me the animal moving to another part of the map. So if I could accomplish for the game to do the same thing they do for the animal units for the rest of the AI units, I would defitively get much more from the game than I'm getting now.

If there's any help you can offer on accomplishing this task, I'd sure appreciate it. Thanks.

I take it that the reply I made on your other thread didn't work? I'm not sure if it's the same issue you're having here.

The reason that the animals are probably being centered while the other guys aren't is probably because you have "show enemy moves" on but not "show friendly moves". Because animals, like all Barbarians, are enemies, they will be shown. If you want to have ALL the AI's moves shown, you will have to also set the "show friendly moves" option.
 
Nice explanation Gerikes, having not worked with FoW and visiblity yet I was unaware of the visibility incrementing and had just assumed they used a boolean value. Thanx for the info. :)

jcikal said:
what do you recommend I do in order to understand the Python language as it is used in Civ 4?

IMO there are two main things to know if you want to python mod in civ4. The number one is getting a grasp on the syntex of python, the use of tabbing to designate code branches, how to import other modules and then use functions from inside the imported files, the basics of for loops and if/elif/else statements, the setting/calling of local and global variables, and the creating of classes and class instances. Basicly if you can store, call, iter over, and if/then your data you can do just about anything you want.

The other most important thing is to have a little comon sense and the text search close at hand. Most methods are named using whole words and some are practically a sentence, so if you know what you want to do, just search for those words. Don't worry if you don't find anything on your first try either, some things are not called what you would expect or might not be in the class you would assume.

To start on python I recommend this tutorial on the python docs site. If you have a decent grasp on the basics of programing it moves ya through the important python stuff without to much hassle.

Good luck with your modding. :)
 
Ya know it might make a cool wonder effect to have the entire map revealed AND permantly De-fogged for a player, say after a Spy Satillite Wonder was built. In SMAC building your first Satilite would do this.
 
Back
Top Bottom