One Hour One Life Forums

a multiplayer game of parenting and civilization building

You are not logged in.

#1 2018-04-30 22:17:38

Uncle Gus
Moderator
Registered: 2018-02-28
Posts: 567

How to set up your own mod

Here's a little guide to help get yourself up and running and making your own mod, while still being able to bring in Jason's changes each week.

Overview:
1. Set up a Linux VM for development and testing
2. Fork Jason's repos
3. Install Visual Studio Code for editing files
4. Clone the code repo onto your VM
5. Tweak the script used to build everything
6. Run the script to clone and build everything
7. Add Jason's repos as a secondary source of code
8. Install kdiff3 for resolving conflicts
9. Adjust some key files in the data to avoid collisions with Jason and other modders
10. Get cracking!

1. Set up a Linux VM for development and testing
There are a couple of ways to do this, but following this thread should get you there. Of course if you're on Linux, you don't need a VM. Another alternative is to compile it for Windows directly, but this might actually make you go insane. The good thing about using the pre-baked VM is that it has all the dependencies installed for you (Shoutout to Bimble).

2. Fork Jason's repos
First you'll need a Github account. Once you've done that, open Jason's OneLife repo and fork his repo (button in the top right).
Then do the same thing with Jason's OneLifeData7 repo.

3. Install Visual Studio Code for editing files
This is just my recommended IDE for Linux, so feel free to use whatever you like. But if you are blindly following this guide, go here and download and install Visual Studio Code onto your Linux VM.

4. Clone the code repo onto your VM
Create a new folder on your VM. I'm going to assume that you call it MyLife for the purpose of this guide. Open that folder in terminal and run:

git clone https://github.com/<yourgithubusername>/OneLife.git

5. Tweak the script used to build everything
Open OneLife/scripts/pullAndBuildTestSystem.sh and change the following lines, replacing jasonrohrer with your Github username:

if [ ! -e minorGems ]
then
	git clone https://github.com/jasonrohrer/minorGems.git	
fi

if [ ! -e OneLife ]
then
	git clone https://github.com/<YOUR_GITHUB_USERNAME>/OneLife.git
fi

if [ ! -e OneLifeData7 ]
then
	git clone https://github.com/<YOUR_GITHUB_USERNAME>/OneLifeData7.git	
fi

Now the script will pull from your repos instead of Jason's.

6. Run the script to clone and build everything
Now CHANGE BACK TO THE PARENT DIRECTORY, MyLife in this example, and run the script:

./OneLife/scripts/pullAndBuildTestSystem.sh

It is vital to change back to the parent directory otherwise you will clone these repos inside the scripts folder.

7. Add Jason's repos as a secondary source of code
In terminal, in the OneLife folder, type:

git remote add jason https://github.com/jasonrohrer/OneLife.git

And in the OneLifeData7 folder, type:

git remote add jason https://github.com/jasonrohrer/OneLifeData7.git

8. Install kdiff3 for resolving conflicts
You will get conflicts when you merge in Jason's changes, almost guaranteed, so you need a decent tool for resolving those conflicts. In terminal type:

sudo apt-get install kdiff3

For advanced players, you can set it as the default mergetool by following the instructions here and save yourself a WHOLE KEYPRESS on every merge conflict.

9. Adjust some key files in the data to avoid collisions with Jason and other modders
ID numbers are sequentially generated, so to avoid conflicts you need to choose an offset. If you want your mod to play nicely with other mods, you will need to collaborate and choose unique offsets that allow enough room to grow. For example, I used the offset 20,000. That means that Jason can create 19,999 objects before there will be a problem merging with my mod.

Edit all of these files and change the number to your offset:

  • OneLifeData7/objects/nextObjectNumber.txt

  • OneLifeData7/scenes/next.txt

  • OneLifeData7/sounds/nextSoundNumber.txt

  • OneLifeData7/sprites/nextSpriteNumber.txt

You will also need to change the version numbers in:

  • OneLifeData7/dataVersionNumber.txt

  • OneLife/server/serverCodeVersionNumber.txt

These numbers can be whatever you want, but again, you'll want them to not conflict with other mods. It makes sense to start from the same offset number.

10. Get cracking!
You're ready to start making changes! Run the editor to add objects and transitions etc. This guide doesn't cover any of the specifics of actual modding, so you'll need to figure that out for yourself or look for help elsewhere. When you're happy with your changes and ready to commit them, run:

git add .
git commit -m "<Commit statement here>"
git push

You need to do this for each respository, namely OneLife and OneLifeData7. If you run your mod on a server, then on the server all you need to do is clone your OneLife repo onto the server and run the pullAndBuildTestSystem.sh script, just like in step 4.

When you're ready to bring in Jason's latest changes, then in each of the repos, OneLife and OneLifeData7, type:

git pull jason master

Resolve conflicts by running:

git mergetool

You will always get merge conflicts on those nextNumber files; always take your own number instead of Jason's. For other files, you'll need to work that out yourself for each file.

Hapy modding! smile

Edit: Added sounds/nextSoundNumber.txt to list of files to tweak to avoid collisions

Last edited by Uncle Gus (2018-04-30 22:30:47)

Offline

#2 2018-04-30 23:13:30

ryanb
Member
Registered: 2018-03-08
Posts: 217
Website

Re: How to set up your own mod

Thanks for the guide Uncle Gus.

If you're making a mod, you might also want to fork the onetech repo. You can point to a custom data repo and then deploy the site up to GitHub pages. I'm working on improving the compatibility with mods. If you have any suggestions in that area please post them here


One Hour One Life Crafting Reference
https://onetech.info/

Offline

#3 2018-05-01 05:28:58

Drakulon
Member
Registered: 2018-03-31
Posts: 136

Re: How to set up your own mod

Yesterday i compiled ohol for the first time, using this tutorial from jason: http://onehouronelife.com/compileNotes.php?nocounter=1
If you are using Ubuntu this tutorial makes it super easy.
If you are not using Ubuntu you can also install it next to your windows instead of vm https://help.ubuntu.com/community/WindowsDualBoot
I think way to many people are using windows, i only use linux and its so much better if you know how to use it smile
Except for gaming, but if more people would use linux more people would build games for linux.

Uncle Gus wrote:

10. Get cracking!

This is not cracking, this is hacking, dont mix up those 2 words tongue
Unfortunately the word hacking changed over time and now means cracking aswell.
Cracking would be to disable protections / break into systems.
Here is a nice old definition of hacking: http://www.catb.org/esr/faqs/hacker-howto.html
"The basic difference is this: hackers build things, crackers break them."

Last edited by Drakulon (2018-05-01 09:10:48)

Offline

#4 2018-05-01 11:20:18

Uncle Gus
Moderator
Registered: 2018-02-28
Posts: 567

Re: How to set up your own mod

Hahaha, ACTSHUALLY, I didn't mean it in that sense either! I meant "get cracking!" as in the "get moving!" sense.

Offline

#5 2018-05-01 11:37:26

sammoh
Member
Registered: 2018-03-01
Posts: 85

Re: How to set up your own mod

Excellent guide. PM me on Discord if you are an idiot and need another idiot to explain it to you even dumber than this.


Two Hours, One Life - a curated OHOL server with heavy modifications.

Discord:     https://discord.gg/atEgxm7
Address:          https://github.com/frankvalentine/clients

Offline

Board footer

Powered by FluxBB