Patch Files?

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
labgnome
Juggernaut
Posts: 833
Joined: Mon Mar 02, 2015 5:57 pm

Patch Files?

#1 Post by labgnome »

Ok, first of all this might not be the right sub-form for this but it seems the best fit for what I want to ask.

I've been trying to take people's advice and take doing things I want to see in the game into my own hands. The problem is I'm really just feeling around in that dark. I have no idea how to use a .patch file, or how to make one for that matter. I tried looking it up but didn't find anything helpful on my own. I've run into a number of issues, but mainly I just don't know how to take something I want to see and actually put it into the game in such a way that I can even see what it does.

At this point I can't even put in the couple of native species I tried to design to see what they are like, without the game doing some profoundly weird things, such as shipyards disappearing from the game, or stars and planets not being generated during universe creation. I'm not so much concerned with fixing a specific problem as just getting enough of a grasp of the basics to actually do things.
All of my contributions should be considered released under creative commons attribution share-alike license, CC-BY-SA 3.0 for use in, by and with the Free Orion project.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Patch Files?

#2 Post by Geoff the Medio »

You don't need to do anything with patch files to modify the game content scripts. Just open them in a (good, not notepad) text editor, modify them (small changes, so you can tell what broke things), and then try them in the game. Look at the .log files (particularly freeorion.log and freeoriond.log) for error messages that often give an indication where something didn't parse correctly. If you can't figure it out, copy-paste the modified bit of script into a code tag in a forum post asking about it, describing what you tried to do and including the error message you got about it.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Patch Files?

#3 Post by Dilvish »

Geoff beat me to the response, but Ill go ahead and post since my answer is slightly different.
labgnome wrote:I have no idea how to use a .patch file, or how to make one for that matter.
patch files were just for sharing changes with other people, and are not even needed for that if you fork our main repo at github. If you could learn to use git and github that would be helpful for you, but in the meantime the simple approach cna work fine: make backup copies of your original files (and any interim versions that work well enough you want to save them) and then just edit your game files directly.
At this point I can't even put in the couple of native species I tried to design to see what they are like, without the game doing some profoundly weird things, such as shipyards disappearing from the game, or stars and planets not being generated during universe creation. I'm not so much concerned with fixing a specific problem as just getting enough of a grasp of the basics to actually do things.
start with very small changes, test them, add to them-- work incrementally, with smaller changes while you are still learning things. Also, checking the server log file (freeoriond.log) in the config folder can help show you what script code was in error (if it caused an actual parsing error, which is likely the case if it blocked galaxy creation)
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Patch Files?

#4 Post by MatGB »

labgnome wrote: At this point I can't even put in the couple of native species I tried to design to see what they are like, without the game doing some profoundly weird things, such as shipyards disappearing from the game, or stars and planets not being generated during universe creation. I'm not so much concerned with fixing a specific problem as just getting enough of a grasp of the basics to actually do things.
I'm planning on writing a basic howto for new/inexperienced contributors as soon as I know how to do everything with the new system myself, I think I'm there but I'm bug hunting the patch I'm working on before trying to push it.

Basically, a Patch file is the old, Subversion/SVN/Sourceforge name for a file that tells a computer what changes to make. We've, very recently, switched to using GIT/GitHub which has a completely different system so while you might see the occasional patch files you don't need to learn how to use them as we're stopping using them.

Now, getting started on scripting. Here's a very simple method. I'm assuming you're using Windows, if you're not then you'll need to adapt these but Windows is what I know.

Create a new folder in the root of a drive on your computer (ie, in the C: drive itself), call it whatever you like, mine's currently called SVN. Go into Program Files/Freeorion and copy the entire Default directory (folder) into the folder you just created. There are a number of reasons for this. If you've messed up the scripts, reinstall the game first ;-)

Now, boot the game up, don't run anything, go into the Options menu and scroll at the top until you can see Directories. Go into that. the first selection is a box called "Resource Files", note that it currently points to program files/default (or wherever Linux/Mac store them if that's your computer).

In the box, replace program files\freeorion\default with YOURNEWROOTFOLDER\default

Restart the game.

Now, you can edit the files as much as you like in your new folder and when you restart the game it'll run using your new work. The two reasons to do this on Windows is a) it's a lot easier to change the pointers there than in users/documents/whatever/whatever and b) having it outside of program files means you have a backup and don't need to give yourself admin privs every time you save the file.

If you're making new species, you'll likely want to create stringtable entries as well, if you change en.txt in any way you'll also need to tell the game to load that language file in the UI tab, it's easier to do stringtalbes as you can hit the flush button and it reloads even during a game.

If your script messes up, in a folder in users/yourname/appdata/roaming/freeorion there'll be two log files, one of them will normally give you an error report telling you what's gone horribly wrong. I have that folder as a shortcut in Windows as I need to go there a LOT.

If the error report doesn't make sense, or you can't figure things out, post your files here, with exerpts of the key code, I still do this regularly and am happy to help others when I can, partially as more contributors means more cool stuff in my games and partially as solving problems helps me understand the code better.

If it goes horribly wrong, also in there is config.xml, just delete that file and the game'll go back to using the original default folder. Or recopy the default folder.

Soon, hopefully very soon, I'll write a howto on using GIT, making contributor PULL requests and adding stuff directly in, but you really don't need to worry about that for now.

(for what it's worth, I'd been trying to work out a horrible bug in my code in which starlanes, systems and entire AI empires ere disappearing from my map. Turned out I'd put the word "destroy" in the wrong place and Floaters were killing everything every time they made a new Dyson Forest. That was just this week. Geoff's broken the entire game so it either didn't work or was horribly faulty several times since I've been hanging about here, and he's in charge, we all learn to do things better ;-) )
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
labgnome
Juggernaut
Posts: 833
Joined: Mon Mar 02, 2015 5:57 pm

Re: Patch Files?

#5 Post by labgnome »

Ok, I think I know where it went wrong, sort-of. I had several different changes I was going to try, and so I made copies of the folder, but re-named it so I knew what changes I was working with. I noticed one problem was fixed (the game not giving me species to choose) when I took out spaces from the folder names, then so I'll try re-naming them back to "default", and fiddling with where they are. I'll also try to be as unambitious as possible, I might be getting ahead of myself in some areas.
All of my contributions should be considered released under creative commons attribution share-alike license, CC-BY-SA 3.0 for use in, by and with the Free Orion project.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Patch Files?

#6 Post by MatGB »

Unambitious is good to start with, my first few tweaks were very simple things like "make this building give a small bonus to this", playing to see it had worked, and then doing a bit more. I then moved onto copying a species completely to make a new one and slowly making small changes, etc. Doesn't take long to get the hang of it.

You can rename the folder to whatever you like, but you have to tell the game where to now look ;-)
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
labgnome
Juggernaut
Posts: 833
Joined: Mon Mar 02, 2015 5:57 pm

Re: Patch Files?

#7 Post by labgnome »

Maybe it's not a good idea to try to start off with whole new species. I was honestly just wanting to see them in the game. Maybe trying the neutronium armor fix would be better. I think I've uninstalled and reinstalled about a dozen times now. If it keeps up I'll put up the log file here.
All of my contributions should be considered released under creative commons attribution share-alike license, CC-BY-SA 3.0 for use in, by and with the Free Orion project.

Post Reply