Announcement

Collapse
No announcement yet.

Need suggestion on my new Utility Project

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Update:

    Found the starting position of units block. The program needs a minor overhaul to increase speed (searching for units supported by each city is very time consuming, so unit information needs to be stored somewhere). Still haven't figured out how to read rules.txt file automatically from appropriate directory.

    Comment


    • #17
      Hi Xin! Do you have any idea why AI sometimes changes production orders in ALL cities and moves some units in PBEM even when player has ended his turn with Ctrl+N and no cities are taken? That has happened at least in two PBEM games and is really annoying.

      With your utility it is hopefully possible to easily change the production orders back but what to do with side-problem reported by FMK (only +1 shield between turns)?

      Comment


      • #18
        Marko,

        AI is more likely to change production when you lose a city. However when one of your cities is under siege and you lose a unit inside the city, production change may also happen. The AI cannot move units out of the city since it does not have control of your civ once you hit Ctr-N. The only situation this could happen is probably caused by the 'turn 1 effect': the starting civ of the scenario is not the white civ, so strange things happen when the white (or other civs before the starting civ) starts to play.

        AI usually wants 3 or more defense units (i.e., units with AI role = 2 (?)) in a city. So if you have too few defense units the change will be likely. If you don't have any defense units in a city the AI may even rush buy for you.

        My utility was a trial version. Since nobody gave any feedbacks I have already forgot about it. I'll look into it and see what happened. Besides FMK who else uses this program? Do they counter the same problem? If it's only him then maybe it's system related.

        The program starts with a flag set to 1. Then it checks if the human player is currently playing. If yes, the information stored in the last 3 bytes of city names is copied to city production bytes and the flag is changed to 0. Once the flag is zeroed, information flow is reversed, i.e., city production items and shield productions are written to the last 3 byes of city names. When the human civ is not playing the flag is set to 1 again.

        So the program should be loaded after civ2 is running but before the human civ takes control of his civ. If the human has already gained control (i.e., he has gone through reports and now can move units), then at this time loading the utility program will cause a turn's production to be lost. Or, if the system is superfast then civ2 may process city productions faster than the utility program, in this case production will also be lost.
        Last edited by Xin Yu; January 29, 2002, 17:53.

        Comment


        • #19
          Update: after days of searching, finally found the address which stores unit stats info. Each unit occupies 20 bytes, in the following order:
          1-2: 16 flags (see 2, etc.)
          3-4:00, can change but no effect
          5: expiration tech number (FF=none)
          6: domain
          7: move times road modifier
          8: range (number of turns in air)
          9: attack
          10: defense
          11: health time 10
          12: fire power
          13: cost (number of rows)
          14: carry
          15: AI role
          16: prerequisite (FF=none)
          17-18: encyclopedia entry address
          19-20: 00 (change will cause crash)

          Except the last two bytes, all number can be changed. Including: change move to a number which is not a multiple of the road modifier; change health to a number which is not a multiple of 10;
          Last edited by Xin Yu; January 31, 2002, 11:53.

          Comment


          • #20
            Further updates will be in my 'preview' thread.

            BTW, Marko, I found FMK's post about the +1 shield only thing. It had nothing to do with my utility program since the program did not exist when he complained.

            Comment


            • #21
              Yes, that odd problem was without the use of this utility.
              I will use this next time I am in a PBEM (which should be very soon with my new secret project being done) I am kinda intimidated by using it. I am not really sure why. I'll re-read the write up and make sure I have everything down pat.

              -FMK.

              Comment


              • #22
                Why didn't lazyciv work? I just tried it as America in 2194 PBEM with Pap. On the first turn I rush built 9grand worth of ammunition plants. I ended up losing Pearl Harbor and so the AI changed production in all my cities to mobile inf. Lazy civ didn't work. I did the test on the city names over 12 characters and that worked, but my production queue wasn't saved. Anyone know why?
                Re-elect Bush!

                Comment


                • #23
                  I downloaded the saved files and opened them using a hex editor. I found that none of the production information were recorded. Did you use Lazyciv on turn 1? You must use it on turn 1 in order for the information to be recorded, then on turn 2 you can retrieve them.
                  Last edited by Xin Yu; March 28, 2002, 20:46.

                  Comment


                  • #24
                    ****... no I didn't.

                    Xin Yu, could you do me a really big favor? With the hex editor could you change the production queue for the American cities (except Midway) to Ammunition plant? That's what they were all building anyway.

                    Also for refrence, if I start using lazyciv now on turn 2 will it work for turn 3? Can I use lazyciv for other PBEMs or do I have to use it for one PBEM at a time?
                    Re-elect Bush!

                    Comment


                    • #25
                      MagyarCrusader: I can change the production for you. However I don't want to do it for other civs of yours if they got messed up as well. Please check if you want your other civs' production be restored as well.

                      Yes if you do it on turn 2 you'll be able to see the result on turn 3. You can use the utility whenever you play PBEM, there's no restriction on which scenario to play, etc.

                      Since you are controlling more than one civ, I'm not sure if the utility will work properly. But you can always play as if you only control one civ -- i.e., save at the end of American's turn, then open the saved file and play as British, etc.

                      Comment


                      • #26
                        Please, America will be just fine. They are the ones I spent over 9000 gold rush buying ammunition plants for. I don't believe I could continue the game with a realistic chance for victory after this. But for the British and USSR I'll just swallow my loses thusfar. I haven't rushbought much for them... yet. Anyway, thank you for answering my other questions as well. This is going to help me a lot.
                        Re-elect Bush!

                        Comment


                        • #27
                          I accidentally broke my glasses. Now it is difficult for me to do hex editing. Please wait till Sunday.

                          Comment


                          • #28
                            No problem. But thank-you very much for your help!
                            Re-elect Bush!

                            Comment


                            • #29
                              Here you are. BTW I found a problem in the lazyciv utility program. I relied on the identification of 'human player' to initialize restoring of production but when another player was playing, the human player civ was reset to that player. Hence currently the lazyciv program will not work unless you hex edit the saved file to change the human player back to your civ. I have already given up the project so I'm not going to fix it now. It has to wait till I finish another project.
                              Attached Files

                              Comment


                              • #30
                                I consider the game beginning (where you have to go through many menus) tedious enough. Especially with PBEM repeated Enters are not very entertaining.

                                I imagine a tool that would be registered under Windows as the program that opens files with .sav, .hot, .net extensions. Then you could launch Civ2 files directly from the Explorer/WindowsCommander etc. by pressing the Enter key.
                                The Civ2 program writes the default menu choices (they are highlighted after the Civ2 launch) in the file Civ2.dat . The tool could remember appropriate Civ2.dat file for every savefile extension (.sav, .hot and .net). If asked to open a savefile it would rewrite the Civ2.dat file to the appropriate one, then send to the Civ2 program a necessary number of "Enter" keys and the full path of the savefile into the load file dialog.

                                I suppose the job is relatively easy: to start the Civ2.exe file as my subthread, to send "Enters" to the Civ2's message queue and to send the full filename into the open dialog (as individual characters or by the clipboard).
                                The problem is I am a poor programmer and besides I know almost nothing about Windows programming and so I would work on that a month. Xin, don't you want to do it?
                                Last edited by SlowThinker; May 25, 2002, 20:11.
                                Civ2 "Great Library Index": direct download, Apolyton attachment

                                Comment

                                Working...
                                X