Git Product home page Git Product logo

Comments (14)

reubene avatar reubene commented on July 26, 2024 1

I can solve the draw order problem if you're not working on it. I think I've found an elegant solution for it

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

A .SCN is basically a .SAV file but there are some differences in the binary layout. I'll try to find out what the differences are.

What the game does when you read a .scn:

  • it looks for .gif files (Cities, units, etc.) in the local directory of the scenario. If it can't find those files, it uses gifs from root Civ2.
  • similar procedure with city.txt, rules.txt, game.txt, labels.txt, pedia.txt, advice.txt
  • title.gif (if it exits)
  • scenario intro txt file (if it exits)
  • sound files
  • it loads EVENTS.TXT (if it exists)
  • then it loads the game

If you load a .scn and it loads the events (either from .txt or you make the events in the events editor) and then save the game, the .sav then contains these events. A .scn may contain these events if they were added manually.

(Also - if you load a .scn in the civ2 root and then try to use the scenario editor, it will prompt you to choose a new scenario folder where it will then drop all the files. This is so that you don't mess with original gif/txt files in the root)

So basically we have to:

  1. add reading of events in .sav/.scn files (they may or may not be in there)
  2. make an EVENTS.TXT parser
  3. find out the layout of .scn files
  4. make some sort of ScenarioEvents class which will make these objects from read .sav game data in LoadedGameObjects.cs
  5. enable opening .scn from the main menu

These are existing triggers:
image

and actions which the game uses:
image

from civ2-clone.

reubene avatar reubene commented on July 26, 2024

Our current file loading capability already has the ability to load the images and txt files from the sav or scn directory and then fall back to root if not found so there is not much to do there.

I would suggest getting the scenario loading and player selection working and worrying about the events as a separate task. Some scenarios such as the rome.scn don't even have events

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

Ok I'll try to do scenario loading.
I also implemented events reading to get it out of the way.

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

FW and MGE scenarios can be loaded now, but there are some minor issues with certain scenarios.
The loaded map appears blank, there's some issue with visibility or sth else, I'll have to look it up.

I had some trouble with popup boxes which are not listed in Game.txt (they are either read from scenario .txt files or are just custom dialogs, like player selection dialog for scenarios). I added these dialogs manually in Read.PopupBoxes since I don't know how to do a custom dialog.

Also some dialogs are duplicated (like difficulty/gender selection for load game and scenarios). I had to add additional classes for these. This can probably be done more elegantly.

from civ2-clone.

reubene avatar reubene commented on July 26, 2024

I tried it with the classic rome and ww2 scenarios but it seems it's not reading the data correctly not sure why. I get a null reference error as the values loaded are way outside the expected ranges

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

Ww2 and Rome are two early Conflicts in civilization scenarios. The .scn and .sav structure are different than FW and MGE so I'll have to install CiC version of the game on my comp somehow to test it.
Try downloading some fw/mge scenarios from civfanatics or scenario league.

from civ2-clone.

reubene avatar reubene commented on July 26, 2024

FW and MGE scenarios can be loaded now, but there are some minor issues with certain scenarios. The loaded map appears blank, there's some issue with visibility or sth else, I'll have to look it up.

I found an issue in the visibility code so that may be the cause of what you're seeing here, I've now fixed it in my latest PR

from civ2-clone.

reubene avatar reubene commented on July 26, 2024

Ww2 and Rome are two early Conflicts in civilization scenarios. The .scn and .sav structure are different than FW and MGE so I'll have to install CiC version of the game on my comp somehow to test it. Try downloading some fw/mge scenarios from civfanatics or scenario league.

I don't think I was using CIC versions of the scenarios, I was using the default ones that come with MPG

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

Correct, those two came with the base game.
Edit: ok I checked, hex editor indicates they're from <=2.42 version of the game. I'll try installing that version with wineVdm to test the file structure so we can read those & CIC scenarios. Also it would probably be wise to start adding changes so that we can read TOT sav files. At least TOT structure is well documented.

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

MGE and those older two scenarios (ww2 & rome) that came bundled with the base game should now be ok.
I still need to make FW scn/sav files to work.

from civ2-clone.

reubene avatar reubene commented on July 26, 2024

I opened up both scenarios and they look good.

There seems to be something wrong with the fortress and airbase handling, there are airbases where there shouldn't be in WW2 scn and then a bunch that should be there are missing

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

I'll look into it. Also FW scenarios and load games work.
You'll get some obscure errors in some scenarios, mostly additional whitespaces in strings, inconsistencies in Rules file, etc.
So only TOT left, but I'm guessing TOT will require adding more properties to cities, units, ... that don't exist in MGE.

from civ2-clone.

axx0 avatar axx0 commented on July 26, 2024

Fortress and airbase should be fixed now, unlike other tiles they are 48 px high. But it's not a very elegant solution.
Another problem is that fortress should be drawn only after units are drawn.
Same with city names - they are always last thing that is drawn on the map.

from civ2-clone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.