Viewports

Automated missions originate in the AI code, where everything is already in global coordinates. Your popup will be inserting missions in the UI, where things are viewport coordinates usually (depending on where the addition of the popup is placed in the existing code sequence).

So now if you move a unit (or start a mission) in the UI the sequence goes something like this:

1) UI commend intercepted (coordinates from the UI are viewport)
2) Mission request created
3) Net message sent with the mission request
4) Net message received. For missions that contain coordinates the coordinates are translated to global
5) Mission pushed

Note - I'm not 100% sure the net message happens upstream of the coordinate conversion, as the above sequence says (but I think I does).

Where you add the code to inject the popup matters. Logically you'd want to inject it upstream of the net message generation since you only want to replay the results (not the popup choice!) on all machines in an MP game. Thus if the net message deals with viewport coordinates for a regular MOVE_TO mission you will have to add a new MOVE_TO_GLOBAL (or something) mission that is in global coordinates (since viewport coordinates won't exist for cities outside the viewport), and NOT translate it in the translation code on net message receipt.

Automated missions go through none of this since they all happen inside the AI (the net message is just an instruction to start automating)
The translation happens before the net message is sent in selectionListGameNetMessageInternal which has a parameter that specifies if a translation should happen or not.
selectionListMove takes a plot pointer, not coordinates and then uses absolute coordinates of the passed plot and passes them to selectionListGameNetMessageInternal with the right flag set so they are not treated as viewport coordinates.
So at the point a mission is pushed, it is always in absolute coordinates and a new mission is not needed.
 
Viewports is absolutely awesome! I only have to reduce my viewport settings when hitting memory limits and C2C keeps working -I might reach the space age yet.
Are there any other mods or modmods that incorporate viewports? I would love to revisit Planetfall or Fall from Heaven II with viewports.
 
Viewports is absolutely awesome! I only have to reduce my viewport settings when hitting memory limits and C2C keeps working -I might reach the space age yet.
Are there any other mods or modmods that incorporate viewports? I would love to revisit Planetfall or Fall from Heaven II with viewports.

C2C is (as far as I know) the only mod that has these so far. Implementing them took 2 months for us and really burned out Koshling, so I would hate to be the person who tries to do that for another mod.
 
Are you having graphics issues and other odd looking things using viewports? There are a number of annoying bugs with it sadly, although it does allow you to pay giant/gigantic maps without an issue with memory. :D
 
Are you having graphics issues and other odd looking things using viewports? There are a number of annoying bugs with it sadly, although it does allow you to pay giant/gigantic maps without an issue with memory. :D

Yes, those bugs are known, and also most likely unfixable given the current engine we have. :(
 
Aww shoot, I was hoping it was some settings some place I missed...:sad: Still it rocks being able to play on gigantic maps and not crash every 5 mins.. :lol:
 
Just had a CTD when the following situation was brewing:

My unit near Japan finished its turn. The game monitor jumped to the London in-city view as I had some production to assign there. The city tiles were black as the viewport was still in East Asia. So far so good I had that often, if I wanted to go out of city I could rightclick on the upper part of the incity black screen and got back to viewport era.

But this time I didn't go out of city screen by rightclicking on a black tile out of the radius of worked tiles but I saw
that I had a new animal in my city which I wanted to move so I doubleclicked on it, expecting the viewport switching to it but instead a CTD appeared. Seems the game can't handle the zoom out of city screen in to the surroundings of a city when due to the viewport away - a black tile city view is happening.
 
Just had a CTD when the following situation was brewing:

My unit near Japan finished its turn. The game monitor jumped to the London in-city view as I had some production to assign there. The city tiles were black as the viewport was still in East Asia. So far so good I had that often, if I wanted to go out of city I could rightclick on the upper part of the incity black screen and got back to viewport era.

But this time I didn't go out of city screen by rightclicking on a black tile out of the radius of worked tiles but I saw
that I had a new animal in my city which I wanted to move so I doubleclicked on it, expecting the viewport switching to it but instead a CTD appeared. Seems the game can't handle the zoom out of city screen in to the surroundings of a city when due to the viewport away - a black tile city view is happening.

Can you post the relevant save + instructions to reproduce please.
 
Can you post the relevant save + instructions to reproduce please.

Ok I missed to save before the first incident, now was able to reproduce:

After the game has loaded, click space until you see the viewport switch to the ships near Japan. Now klick on the little symbol on the right side ("caravan post has been built"). The game zooms into in-city view of a city outside of the current viewport. Most tiles are black.
In in-city screen click on an unit present in the city, for example the townwatchman - instant CTD.

I think the bug is with Auto Zoom Into City as the viewport doesnt switch there as well. I like it actually. The black tiles I don't care. Just when I activate a unit in the blacked city screen the viewport should change to it imho.

BTW. Its a good savegame to test AI behaviour to penetrate a border. In France I have a long row of Atlatists, one of it standing on a Normandy flatland and no general next to it; the (roman) AI doesn't bother to attack it though... If it would, the rest of the front would be penetrated and I would be in trouble.
 

Attachments

SVN version - viewports=60x60 - crash on finishing generating duel size map with "failed to init video memory"
possible other crashes on "too small" maps (works ok on Normal size despite it beeing smaller than 60x60, anyway)
 
SVN version - viewports=60x60 - crash on finishing generating duel size map with "failed to init video memory"
possible other crashes on "too small" maps (works ok on Normal size despite it beeing smaller than 60x60, anyway)
Larger viewport sizes than map sizes are not supported at the moment.
 
well... having constant size of viewport, so both fast and stable for current machine and "set and forget" approach
 
well... having constant size of viewport, so both fast and stable for current machine and "set and forget" approach

I suppose, although if it were possible via some hack (for instance to add useless tiles as padding) it would just waste memory and needlessly slow down the game.
 
I suppose, although if it were possible via some hack (for instance to add useless tiles as padding) it would just waste memory and needlessly slow down the game.

It's not possible if the map wraps.
 
koshling, sure, especially on toroidal maps :P

maybe do a hack to make viewport tempotrarily smaller (just for the game, not to save settings) if loading map which is too big?

also maybe it's other bug than it seems (that means - some stealthy bug which has nothing with engine limitations) since I were able to play normal under 60x60 viewport and normal is 60x58 if believing the list.

I would play multi under 40x40 viewport - I hope no bugs would arise? if there is some danger I may consider playing viewportless (however some players may can not hangle GEM or other gigantic map on their PC).
 
koshling, sure, especially on toroidal maps :P

maybe do a hack to make viewport tempotrarily smaller (just for the game, not to save settings) if loading map which is too big?

also maybe it's other bug than it seems (that means - some stealthy bug which has nothing with engine limitations) since I were able to play normal under 60x60 viewport and normal is 60x58 if believing the list.

I would play multi under 40x40 viewport - I hope no bugs would arise? if there is some danger I may consider playing viewportless (however some players may can not hangle GEM or other gigantic map on their PC).

Not possible I'm afraid - the problem is that the viewport size has to be fixed before you can see the loaded map size (the game engine requests it and breaks if you try to change it afterwards at a point in the load sequence before you get to se the map)
 
Let's say that I wanted to make an RFC on the GEM map, and that I wanted to import viewports onto it. How would I go about doing that?

Let's say that I also wanted to make the viewports static to create separate "regions" which would isolate sections of the globe from each other until a certain tech was reached. For instance, they would have a fixed area (individual to each Civ, maybe) which they couldn't move past until I wanted them to. I wouldn't want to let them move out of it until they discovered the tech that allows them to, upon which the viewport would move naturally. How would I do that?
 
Let's say that I wanted to make an RFC on the GEM map, and that I wanted to import viewports onto it. How would I go about doing that?

Let's say that I also wanted to make the viewports static to create separate "regions" which would isolate sections of the globe from each other until a certain tech was reached. For instance, they would have a fixed area (individual to each Civ, maybe) which they couldn't move past until I wanted them to. I wouldn't want to let them move out of it until they discovered the tech that allows them to, upon which the viewport would move naturally. How would I do that?

Go and find the Parallel Maps modcomp. Then merge it with the RFC DLL (no easy task) and get the Viewports code from C2C (which is built upon and requires Parallel Maps) and merge that as well. It is not easy at all.

As for your idea, viewports would not be the way to go about that because their size can not be changed during runtime.
 
Let's say that I wanted to make an RFC on the GEM map, and that I wanted to import viewports onto it. How would I go about doing that?

Let's say that I also wanted to make the viewports static to create separate "regions" which would isolate sections of the globe from each other until a certain tech was reached. For instance, they would have a fixed area (individual to each Civ, maybe) which they couldn't move past until I wanted them to. I wouldn't want to let them move out of it until they discovered the tech that allows them to, upon which the viewport would move naturally. How would I do that?

Viewports are a purely UI artifact - they have ne meaning to the AI, so however you set up and froze viewports it wouldn't stop the AI moving around the underlying map as it sees fit. As such they are only part of the solution you would need anyway.
 
Back
Top Bottom