Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Star Wars Galactic battlegrounds support #421

Closed
MayeulC opened this issue Dec 20, 2015 · 16 comments · Fixed by #1151
Closed

Star Wars Galactic battlegrounds support #421

MayeulC opened this issue Dec 20, 2015 · 16 comments · Fixed by #1151
Labels
just do it You can start working on this, there should be nothing left to discuss nice new thing ☺ A new feature that was not there before to-discuss Idea or suggestion that needs some discussion before implementation

Comments

@MayeulC
Copy link
Contributor

MayeulC commented Dec 20, 2015

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 TheJJ added nice new thing ☺ A new feature that was not there before just do it You can start working on this, there should be nothing left to discuss idea labels Dec 20, 2015
@TheJJ
Copy link
Member

TheJJ commented Dec 20, 2015

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
Copy link
Contributor

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

  • DRS copyright header is 60 chars for SWGB instead of 40
  • SWGB has genie.dat instead of empires2.dat, and genie_x1.dat for Clone Campaigns. the formats for these files are a bit different from the empires2_x1_p1.dat format.

other than that it should mostly ~work.

@TheJJ TheJJ added to-discuss Idea or suggestion that needs some discussion before implementation and removed idea labels Mar 17, 2017
@elraro
Copy link

elraro commented Oct 2, 2017

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
Copy link
Member

TheJJ commented Oct 2, 2017

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
Copy link
Contributor

goto-bus-stop commented Oct 2, 2017

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
Copy link

elraro commented Oct 2, 2017

@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
Copy link
Contributor

Gotcha, but openage extracts them as .bina :)

@elraro
Copy link

elraro commented Oct 2, 2017

I have opened the file 50500.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
Copy link

elraro commented Oct 2, 2017

Found the problem :)

FILE_VERSION is hardcoded!

@elraro
Copy link

elraro commented Oct 2, 2017

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
Copy link
Member

TheJJ commented Oct 3, 2017

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
Copy link

elraro commented Oct 3, 2017

@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
Copy link
Member

heinezen commented Oct 3, 2017

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
Copy link

elraro commented Oct 3, 2017

@heinezen yes of course

@TheJJ
Copy link
Member

TheJJ commented Oct 3, 2017

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
Copy link

elraro commented Oct 3, 2017 via email

@heinezen heinezen linked a pull request Aug 3, 2020 that will close this issue
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
just do it You can start working on this, there should be nothing left to discuss nice new thing ☺ A new feature that was not there before to-discuss Idea or suggestion that needs some discussion before implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants