1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[SDK] Sub-Map: “Zoom-In” on Tiles for Tactical Combat Map, Simcity-ish Building, RPG

Discussion in 'Civ4 - Creation & Customization' started by chrusion, May 22, 2006.

  1. chrusion

    chrusion Chieftain

    Joined:
    May 5, 2006
    Messages:
    36
    Location:
    Seattle, WA
    Sub-Map functionality can open a huge range of options for modding CivIV.
    Some options come to mind:

    Tactical Combat can make or break a strategic decision in reality.

    Building placement can greatly affect the efficiency of a building.

    RPG can add “insider” elements to turn the tide of strategy.

    Of course the options don’t end there. Game play modifications that are enabled by Sub-Map functionality are only limited by the imagination!


    Please comment on your ideas for the use of this mod and what sort of functionality it should have.

    This is an SDK project.
    Please bring to the table ideas of the best, safest, and most useful ways to implement this code.

    ANY IDEA IS A GOOD START

    Don’t be ashamed of what a flaming wolf might say.
     
  2. chrusion

    chrusion Chieftain

    Joined:
    May 5, 2006
    Messages:
    36
    Location:
    Seattle, WA
    SDK analysis leads me to believe that deriving from the CivGlobals class is the best place to start. The objects of the derived class will each represent a Sub-Map. Only persistant changes need to be stored. All other data can be shared.

    CivGlobals is a Singleton but a derived class could have a dynamic datastructure to hold multiple object instances of the class and still maintain a pseudo-Singleton appearance.
    I have designed a datastructure that may be perfect for this implementation.

    The Sub-Map acts like its own mini Civ game with appropriately scaled unit and terrain statistics and abilities.

    Are there any ideas on what data elements of CivGlobals would possibly have Sub-Map counterparts and what data could be shared data?

    For the sake of completeness any obvious and not so obvious suggestions would be appreciated.

    I am also willing to work with someone that wants to partner in this.
     
  3. Dale

    Dale Chieftain

    Joined:
    Mar 14, 2002
    Messages:
    6,986
    Question:

    How to propose to graphical show your map? We don't have access to the gamebryo routines in the .exe, so I'm very interested to know.

    Dale
     
  4. Olleus

    Olleus Warlord

    Joined:
    Oct 30, 2005
    Messages:
    6,478
    Location:
    England
    This is going to be a hell of a tough nut too crack. I think that theLopez, TGA and Kael have already tried and failed.

    As we can't access the game engine, I guess that the only way to make this work is too create some 'dummy' tiles on a map and use a 'Sub-Map' event to zoom into them. This would screw up the globa view though.
     
  5. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    Actually I haven't tried this specifically. I have pondered it a bit, and I'm not sure how it could be done, but I haven't had a serious go at it.

    I have a few vague ideas involving changing the terrain graphics to make an overlay visible (or not).
    My current idea involvs a graphical hack. Basically, you would convert all the terrain files to .nif files offset so that they would appear higher than normal. Then, you simply add them as features, and they would overlay the current map at a different height, and remove the "features" when you're done with your sub-map.

    The slight trouble with this is that you'd have to offset all the unit positions by the same amount to fit them on the grid, as well as getting them to react to hight changes (you'd have to temperarily convert all the actual plots that they are on to the plots you want it to be - then the height changes would work). You'd probably have to create a whole new set of unit .nifs with the same offset as the terrain, as I don't think you can change the z co-ordinate of units dynamically.

    You'd also have to fiddle with the 3D camera controls so that you couldn't do weird things with it.

    Very very hackish, but I'm pretty certain it would work... unless the graphics engine has a maximum Z value. It would also be pretty tought to integrate with any mod change the terrain, or the units.

    On a similar note this method would work excellently for overlayed maps with spaceships and suchlike - like CTP. You'd make the features a semi-transparent, and all your units which could go into space would have a good hefty z-shift so that they appeared right. A few SDK tweaks and all would be awsome.
     
  6. Tholish

    Tholish Chieftain

    Joined:
    Jul 5, 2002
    Messages:
    1,344
    Location:
    Japan
    Please do this, as in a submaps mod, yes. It absolutely will be used. Also please make it, or a version of it, as simple, versatile, and small as possible so it can easily be plugged into mods. As opposed to a big monster with bells and whistles.
     
  7. sgrig

    sgrig Comrade

    Joined:
    Nov 29, 2001
    Messages:
    1,123
    Location:
    Isaac Newton's College
    How about this:
    When the sub-map is opened, an area of the main map (or even the whole map) is "cleared", i.e. whatever is present there - terrain types, improvements, cities, units, etc, is copied to memory, but graphically everything is cleared (ie "deleted"), and then the data for the submap is loaded onto these tiles (i.e. units, improvements "created"). When quitting the the submap, the submap data is stored, and the original map data is restored, with necessary adjustments resulting from action on the sub map.

    Of course this way is very messy and rather "brute-force", but possibly it could work within the limits of what SDK allows as it uses existing graphics procedures.

    This also ties in with chrusion's idea that the sub-map acts like a mini Civ4 game.

    What do people think? Is this reasonable or far too messy?
     
  8. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    I had considered it, but I'm pretty sure there will be some quite noticeable delay caused by wiping the original map every time.
     
  9. Tholish

    Tholish Chieftain

    Joined:
    Jul 5, 2002
    Messages:
    1,344
    Location:
    Japan
    How about having a strip of "battlemaps" up above the North Pole, where this is done without erasing the actual game? One for each type of tile, ie a submap for battles in forest, a submap for battles on grassland, etc.... When stacks collide, all units are teleported to the pertinent battlemap (or maybe are broken down into subunits, like a Tank division on the main map becomes 3 tank brigades on the battlemap, one per health point) and when the battle is over all survivors teleport back. Upgrades would have to be reflected also, such as first strike etc...
     
  10. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    As mentioned above this would mess with the globe view. You'd only really need one battle map, as you could quickly generate the terrain each time.

    Although this might be possible using more SDK orientated tweaking rather than graphics orientated tweaking like I was suggesting.
     
  11. chrusion

    chrusion Chieftain

    Joined:
    May 5, 2006
    Messages:
    36
    Location:
    Seattle, WA
    I am considering something that is similar to this approach.

    The game data is all stored in a CivGlobals object. (If I have missed something please let me know)
    All I have to do is create a new CivGlobals object derivative (inheritance in C++) that is not a Singleton (can have more than one instance of itself) called CivGlobalsSubMaps.
    I won't mess with the main game data in CivGlobals (except to update with Sub-Map results).
    Each Sub-Map will be an object instance of CivGlobalsSubMaps.

    I will minimize Sub-Map creation time by having several default base maps.
    These maps are unknown to the Main CivIV game so will not be involved with Global View.
    I will look at disabiling Global View while in a Sub-Map.

    Switching to a Sub-Map then becomes as easy as swapping a 32-bit pointer!
    When the pointer is swapped the CivIV game engine will continue along its merry way with the next game loop as if nothing had happened. Only now the game is the Sub-Map. I may need to do some Load Game functionality to get the proper initialization.

    Sub-Maps will also be small so will not take much time to generate.
    The problem may be memory but I will use as much shared data as possible to alleviate this.
     
  12. sgrig

    sgrig Comrade

    Joined:
    Nov 29, 2001
    Messages:
    1,123
    Location:
    Isaac Newton's College
    In this approach would it be possible then to have a separate set of XML files for each submap? Since tactical level maps would have to have different rules from the main map.
     
  13. chrusion

    chrusion Chieftain

    Joined:
    May 5, 2006
    Messages:
    36
    Location:
    Seattle, WA
    Yes,
    This is a later goal in the project, another step in complexity. Each step in complexity means more classes need to be derived for the special cases. I am being careful to work with the Main CivIV functionality and not fight against it; I want to use CivIV's strengths to do this, not wrestle with it or force an ugly hack.

    XML Initialization happens during Load Game, so the Sub-Map could have a whole set of different support files. This is a common way of detailing RPG scenarios in an RPG world.


     
  14. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    How are you planning on getting this working in multiplayer?

    Are you planning on getting this working in multiplayer?

    Will it work in multiplayer without you having to do anything?
     
  15. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    Well, good luck with that... I'm skeptical but interested. :)
     
  16. sgrig

    sgrig Comrade

    Joined:
    Nov 29, 2001
    Messages:
    1,123
    Location:
    Isaac Newton's College
    Why wouldn't it work in multiplayer? (assuming it works for single player?)
     
  17. Tholish

    Tholish Chieftain

    Joined:
    Jul 5, 2002
    Messages:
    1,344
    Location:
    Japan
    My use for it would be a space mod. The main map would be the space terrain with planets and spaceships in between. Submaps would represent planets.

    I can also see it being used to represent the greater pace at which wars progress relative to growth and research. Most wars just last a few years, but wars between empires in civ will last dozens of turns, each representing at least a year, . I know its just a game, but making it a better simulation improves the game experience. You know that like any lens, some of its distorted but SOME parts of it are in pure focus.

    What I'd like to see is maybe a ten to one step down during wars involving the human player. After each growth and research turn, regular turns like now, there are ten tactical movement turns in which units can move and fight but no research, growth or economic activity occurs. Except special kinds in the realm of military supply and engineers. Using the same board. Once two stacks enter battle, then they go to a battle map, maybe 16 by 16, representing all the features of the two squares (that of the defender and that of the attacker), but each unit becomes multiple units there, one per hit point. All units of a player start in the center of his side of the board in one big stack. After ten turns the battle is over and the campaign speed main board is returned to with battle results reflected. After ten turns on the campaign board, the eleventh turn has regular civ function enabled again, with the next turn of research and population growth and worker actions and city production and yield calculations and so forth.
     
  18. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    Hmm... its an interesting idea... games would go on much longer with a system like that. For some people, that wouldn't be much fun, but other people... like myself... treat civ like a fine wine that I like to savor. That said, I'm not sure how possible it will be to pull it off.

    It will also probably require a reworking of the combat system since you'll go 10 turns without any hope of reinforcements.

    Of course, that's assuming that it's possible.
     
  19. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    Thinking about it, it depends on what you are using it for. If you are using it for combats, then it would probably take up quite a bit of time, and would do really nasty things to PBEM. This is avoidable by just disabling it in multiplayer I supose.
     
  20. Starship

    Starship Chieftain

    Joined:
    Feb 9, 2006
    Messages:
    197
    God, if you can here me, please bless this project....

    The uses for this utility are endless. Good luck, I really hope you can get it to fly.

    tactical battlefields
    simcity-ish city building & organization
    multiple world space mods
    Underground sub maps
    & on & on

    This would take Civilization to a new level. I've been hoping for this since I started playing civ (CivII). Maybe you can talk to the people at Firaxis? Maybe they can point you in the right direction? I know Kael was hoping somebody would do this...and he knows people...maybe PM him, and maybe he could give you a contact?

    May the force be with you.
     

Share This Page