News: 11 March 2016 - Forum Rules

Author Topic: Best way to manage game script?  (Read 905 times)

Polinym

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Best way to manage game script?
« on: April 08, 2021, 09:24:16 pm »
Hello! I've been translating a Famicom game script that uses normal pointers, dictionary compression, and many control codes in the text.  However, having to manage the positions of all my strings as well as calculate/enter the pointers by hand has been a real pain. Also, having to go back in the text and change things will require me to recalculate and enter all the pointers again.

I imagine something like a script extractor/inserter would help with this process, but I don't know which would be the best to use. I'd also like to avoid having to reconfigure my table files as much as possible.

What is the best tool to make this happen?
"Where are you going, soldier? Get back to the battle!" - Some Battlefront Clone
My YouTube Channel: https://www.youtube.com/channel/UCJqSB4xw29TTKlia5E0NYtQ

FAST6191

  • Hero Member
  • *****
  • Posts: 3301
    • View Profile
Re: Best way to manage game script?
« Reply #1 on: April 08, 2021, 11:24:24 pm »
In terms of formal tools then your choices are mainly

Atlas and Cartographer
http://www.romhacking.net/utilities/224/
http://www.romhacking.net/utilities/647/

This is the not quite old classic (see Gimmick and romjuice) but what most will know if they use such things.

Kruptar 7 and Oriton maybe but that mostly Kruptar 7.
http://www.romhacking.net/utilities/612/
http://www.romhacking.net/utilities/709/
https://romhack.github.io/doc/kruptarPlugins/ being a nice intro.

Somewhat newer, and potentially less potent, but came out of the Russian scene and is quite hard to ignore as part of these sorts of discussions.

Simple extraction has a few more options in various tools.


That said I am sure you can see how extraction and insertion will inevitably trend towards complex if not actual programming language then quasi to account for every edge case going or be useful across multiple systems (fortunately the NES is fairly well catered to regardless), and this is also why http://www.romhacking.net/?page=utilities&category=14 will have a bit more than mentioned above but the vast majority of things will be game specific.

Before going too far do said control codes include an end of line/section indicator? I often have such things on later systems I play more with and that reduces it to a search with a hex editor, copy paste results of search and 20 seconds with a spreadsheet before copy pasting what I need back into the file. Think "oh no every line ends with 00, find all 00, realise that the pointer is likely 2 bytes later than that so add two, generate pointer list accordingly").

"I'd also like to avoid having to reconfigure my table files as much as possible."
I am not entirely sure what you mean by that. Generally people have to make an insertion table (if only to avoid the A=60h and A=150h dilemma if a game has multiple encodings of the same character).

Programming a tool is not necessarily the worst thing either -- any language that can readily reach out and touch another file as well as do hex maths is going to be suitable for this. If the pointers are in a fixed location dump those, tell the editor what is free space to write text in and then recalculating should be nothing drastic, as will leaving it back in afterwards if you want to edit further. Makes for a pretty nice intro to a given language if you want as well -- no need to mess around with low level C if you don't want as python and other scripting languages of similar potency will do just fine, just make take 600ms to complete rather than 200 if you did some optimised C. Several of the script editing tools mentioned from the general link/category will also come with source to look at.

Polinym

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Best way to manage game script?
« Reply #2 on: April 09, 2021, 12:26:02 am »
"I'd also like to avoid having to reconfigure my table files as much as possible."
I am not entirely sure what you mean by that.
I tried to use something called abcde once, but I got scared away by the fact that it said I needed to use a special table format with it. Also, it seems like it might be for more advanced things than what I'm trying to do (just simple pointers to strings, you know?).

The game in question actually has a few different ways it ends strings so that might be a problem.

"Kruptar 7" looks promising, but I'll try Atlus/Cartogropher if that doesn't pan out well.
"Where are you going, soldier? Get back to the battle!" - Some Battlefront Clone
My YouTube Channel: https://www.youtube.com/channel/UCJqSB4xw29TTKlia5E0NYtQ

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Best way to manage game script?
« Reply #3 on: April 10, 2021, 11:02:02 pm »
FAST6191 already gave a pretty good overview, I'll just add a couple of points.

However, having to manage the positions of all my strings as well as calculate/enter the pointers by hand has been a real pain. Also, having to go back in the text and change things will require me to recalculate and enter all the pointers again.
Yup, manually recalculating pointers after every script change is a major pain and avoiding that pain is one of several excellent reasons for using an insertion utility.

I tried to use something called abcde once, but I got scared away by the fact that it said I needed to use a special table format with it. Also, it seems like it might be for more advanced things than what I'm trying to do (just simple pointers to strings, you know?).
abcde is mostly backwards compatible with Atlas and Cartographer, so you can use essentially the same table files with abcde as with Atlas and Cartographer (for table files, the differences are that abcde expects them to be encoded as UTF-8 and that < and > are reserved characters). abcde can do more fancy things than Atlas or Cartographer, but with that extra power comes extra complexity. If you don't need abcde's extra power and your game just has a simple script, then Atlas/Cartographer are probably easier to use. Depending on your dictionary, script, and amount of free space, you might still like to give abcde a try, though, since it uses a better insertion algorithm that in some cases can produce smaller binary than Atlas will.

The game in question actually has a few different ways it ends strings so that might be a problem.
If by different ways you mean there are multiple control codes that end a string, that shouldn't be a problem. Atlas also supports some other ways of ending strings such as fixed length and Pascal strings, if that helps any.

"Kruptar 7" looks promising, but I'll try Atlus/Cartogropher if that doesn't pan out well.
Let us know how this goes - I dimly recall trying Kruptar many years ago, but I think the documentation was still mostly in Russian at that point and online translation services were less advanced than they are today, so I didn't get very far :banghead:.