SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.8k stars 1.13k forks source link

Star Wars Galactic battlegrounds support #421

Closed MayeulC closed 4 years ago

MayeulC commented 8 years ago

Hi there,

I was wondering if this engine re-implementation could support Star Wars:Galactic battlegrounds assets; it's one of my favorite games (I like it a lot more than the vanilla ages of empire II).

It is using (as far as I know) the same engine, with some custom modifications, like Flying units, shields, energy and such.

http://www.gog.com/game/star_wars_galactic_battlegrounds_saga

Related:

TheJJ commented 8 years ago

If we're awesome enough this only requires that the converter supports the swgb assets. The engine should, by this time, be generic enough that the data pack created by convert is loaded and it'll work out of the boxâ„¢.

goto-bus-stop commented 8 years ago

I looked into this a while ago. there are two "big" differences between the Age2 and SWGB formats:

other than that it should mostly ~work.

elraro commented 7 years ago

First of all, I'm sorry if my English is not very good... I'm working on trying to add support to the SWGB. I've modified a couple of scripts and "looks" like it reads the DRS files. The problem comes when openage try to finding the palette.

Traceback (most recent call last):
  File "run.py", line 15, in init run
    main()
  File "/home/alberto/Desktop/openage/openage/__main__.py", line 126, in main
    return args.entrypoint(args, cli.error)
  File "/home/alberto/Desktop/openage/openage/game/main.py", line 60, in main
    if not convert_assets(root["assets"], args):
  File "/home/alberto/Desktop/openage/openage/convert/main.py", line 200, in convert_assets
    for current_item in convert(args):
  File "/home/alberto/Desktop/openage/openage/convert/driver.py", line 109, in convert
    yield from convert_metadata(args)
  File "/home/alberto/Desktop/openage/openage/convert/driver.py", line 144, in convert_metadata
    palette = get_palette(args.srcdir)
  File "/home/alberto/Desktop/openage/openage/convert/driver.py", line 133, in get_palette
    return ColorTable(srcdir[palette_path].open("rb").read())
  File "/home/alberto/Desktop/openage/openage/util/fslike/path.py", line 109, in open
    return self.fsobj.open_r(self.parts)
  File "/home/alberto/Desktop/openage/openage/util/fslike/wrapper.py", line 50, in open_r
    fileobj = self.obj.joinpath(parts).open_r()
  File "/home/alberto/Desktop/openage/openage/util/fslike/path.py", line 121, in open_r
    return self.fsobj.open_r(self.parts)
  File "/home/alberto/Desktop/openage/openage/util/fslike/union.py", line 112, in open_r
    raise FileNotFoundError(b'/'.join(parts))
FileNotFoundError: b'interface/50500.bin'
Makefile:22: recipe for target 'run' failed
make: *** [run] Error 1

Where can i find the interface directory? And the "struct" in folders? or something for the drs/dat files?

Thanks :)

TheJJ commented 7 years ago

This interface directory is mounted from the interfac.drs file (in openage/convert/main.py). It may be that the "normal" palette file has a different id for SWGB, for aoe2 it's 50500, but it may be different here.

What "struct" folders do you mean?

goto-bus-stop commented 7 years ago

SWGB's default palette is also 50500. It should be looking for 50500.bina though, not 50500.bin. Are you working off of the latest master branch @elraro?

elraro commented 7 years ago

@goto-bus-stop yes, master branch. i "unzip" the interfac.drs file with this: http://aluigi.altervista.org/quickbms.htm to check if 50500.bina exist. But i found 50500.bin, thats why i rename in driver.py

goto-bus-stop commented 7 years ago

Gotcha, but openage extracts them as .bina :)

elraro commented 7 years ago

I have opened the file50500.bin and yes, its a palette, the header with a hexadecimal editor is: JASC-PAL

@goto-bus-stop okey. But same error. I think somethink is wrong with my mount_drs_archives() I will try to debug :)

elraro commented 7 years ago

Found the problem :)

FILE_VERSION is hardcoded!

elraro commented 7 years ago
INFO [T14551159988800583378] [py] [1] empires.dat
Traceback (most recent call last):
  File "/home/alberto/EclipseNoBorrar/pycharm-2016.2.3/helpers/pydev/pydevd.py", line 1580, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/alberto/EclipseNoBorrar/pycharm-2016.2.3/helpers/pydev/pydevd.py", line 964, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/alberto/EclipseNoBorrar/pycharm-2016.2.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/alberto/Desktop/openage/run.py", line 15, in <module>
    main()
  File "/home/alberto/Desktop/openage/openage/__main__.py", line 126, in main
    return args.entrypoint(args, cli.error)
  File "/home/alberto/Desktop/openage/openage/game/main.py", line 60, in main
    if not convert_assets(root["assets"], args):
  File "/home/alberto/Desktop/openage/openage/convert/main.py", line 199, in convert_assets
    for current_item in convert(args):
  File "/home/alberto/Desktop/openage/openage/convert/driver.py", line 111, in convert
    yield from convert_metadata(args)
  File "/home/alberto/Desktop/openage/openage/convert/driver.py", line 160, in convert_metadata
    gamespec = get_gamespec(args.srcdir, args.game_versions, args.flag("no_pickle_cache"))
  File "/home/alberto/Desktop/openage/openage/convert/driver.py", line 91, in get_gamespec
    not dont_pickle)
  File "/home/alberto/Desktop/openage/openage/convert/gamedata/empiresdat.py", line 278, in load_gamespec
    gamespec.read(file_data, 0)
  File "/home/alberto/Desktop/openage/openage/convert/dataformat/exportable.py", line 299, in read
    offset = new_data.read(raw, offset, new_data_class)
  File "/home/alberto/Desktop/openage/openage/convert/dataformat/exportable.py", line 299, in read
    offset = new_data.read(raw, offset, new_data_class)
  File "/home/alberto/Desktop/openage/openage/convert/dataformat/exportable.py", line 299, in read
    offset = new_data.read(raw, offset, new_data_class)
  File "/home/alberto/Desktop/openage/openage/convert/dataformat/exportable.py", line 371, in read
    result = decode_until_null(result[0])
  File "/home/alberto/Desktop/openage/openage/util/strings.py", line 19, in decode_until_null
    return data.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Uhm, what could it be? This crash with data b'\xff'I checked struct with https://github.com/Tapsa/genieutils (changed walk_sprite_rate to int_32, but i dont know if its correct...

void TerrainPassGraphic::serializeObject()
{
  serialize<int32_t>(ExitTileSpriteID);
  serialize<int32_t>(EnterTileSpriteID);
  serialize<int32_t>(WalkTileSpriteID);
  if (getGameVersion() < GV_SWGB)
  {
    int32_t replicationAmount = WalkSpriteRate;
    serialize<int32_t>(replicationAmount);
    WalkSpriteRate = replicationAmount;
  }
  else
  {
    serialize<float>(WalkSpriteRate);
  }
}
TheJJ commented 7 years ago

How many changes to the dat file reading did you make? I fear there's many differences that have to be adapted first.

The gamedata-reading framework is not that fit for multiple dat-versions yet, we have to add this as well.

elraro commented 7 years ago

@TheJJ only changed walk_sprite_rate in TerrainPassGraphic to `int_32, but im not sure about this....

Yeah, i know. I will try and compare the reader with this lib: https://github.com/elraro/genieutils

heinezen commented 7 years ago

There isn't even an empires.dat in SWGB. GENIE.DAT and genie_x1.dat look like their counterparts. Did you try to read these files?

elraro commented 7 years ago

@heinezen yes of course

TheJJ commented 7 years ago

To explore the files and extract content, https://github.com/SFTtech/openage/blob/master/doc/convert/interactive.md might be helpful for you.

For the .dat files, genieutils and the AGE are probably the best source.

elraro commented 7 years ago

Ok, thanks!