mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-21 13:16:49 +01:00
Added a new scons based engine setup script.
This commit is contained in:
parent
d7f8e60dce
commit
5216dfabef
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@ modules
|
|||||||
*.o
|
*.o
|
||||||
*.meta
|
*.meta
|
||||||
game/.import/**
|
game/.import/**
|
||||||
|
.sconsign.dblite
|
||||||
|
|
||||||
.vs/*
|
.vs/*
|
||||||
.kdev4/*
|
.kdev4/*
|
||||||
|
1
HEADS
Normal file
1
HEADS
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"engine": "636bc5c32f07050fb387a7f8f5f78f7dc9aef7be", "world_generator": "290d973ea9580f748881a54502850ae5fecfb586", "entity_spell_system": "9e16f68ff75bb2b8773a9ef4cd4aa84299e7579c", "ui_extensions": "271dcf89e9afe5cb6350de2f2433c8ebf8aba785", "voxelman": "6d8ded844cd60907ac226e31e729d2f15a4bcf1a", "texture_packer": "604c330188e220c15d10ea5bd545a6fc5aab0132", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "40d291f308f74428080fc4d14a879c07291873b4"}
|
39
README.md
39
README.md
@ -40,30 +40,23 @@ The reason to use these screens is to convey the style I'm going for.
|
|||||||
|
|
||||||
## Editing the game
|
## Editing the game
|
||||||
|
|
||||||
Firstly I recommend, that you grab the addons from:
|
In order for you to open the game in the editor you will need a custom built version, which can be downloaded from the releases tab, or if you want to build it, chech the Compiling section.
|
||||||
|
|
||||||
https://github.com/Relintai/entity-spell-system-addons.git
|
Once you have the proper editor, you should also grab the addons.
|
||||||
|
|
||||||
And place them in game/addons.
|
You will need scons installed. Scons is required to build godot aswell, so the official godot docs already contain information on how to set it up [here](https://docs.godotengine.org/en/latest/development/compiling/index.html).
|
||||||
|
|
||||||
* The new (wip) setup script will do this automatically!
|
in the project's folder call:
|
||||||
* The ai editor addon is half-baked right now, you don't need to enable that.
|
|
||||||
* And the PropTool leaks a little amount of memory, it will be fixed soon.
|
|
||||||
|
|
||||||
If you just want to try the game, grab the editor executable from releases, and open the project with that, or if you want to compile godot yourself go to the Compiling section.
|
``` scons t=all_addons ```
|
||||||
|
|
||||||
|
Note that if you built the editor yourself (a.k.a you already ran the command `scons`), you will already have these, and you can skip this step.
|
||||||
|
|
||||||
## Project architecture
|
## Project architecture
|
||||||
|
|
||||||
This is the main game, it has scripts so compiling, and setting up the engine is really easy.
|
This is the main game, it has scripts so compiling, and setting up the engine is really easy.
|
||||||
|
|
||||||
These scripts worked well enough for me, but they are not good enough now.
|
To be able to open this project you will need a few engine modules compiled into godot, (The setup script will grab these) namely:
|
||||||
|
|
||||||
I'll work on a better solution to replace the engine setup scripts. (Top priority)
|
|
||||||
This will happen in the next few days.
|
|
||||||
|
|
||||||
(I'll not use git submodules, as I've been bitten already by them, I'm thinking about a scons script, as you already need scons for compiling godot.)
|
|
||||||
|
|
||||||
To be able to open this project you will need a few engine modules compiled into godot, namely:
|
|
||||||
|
|
||||||
https://github.com/Relintai/world_generator.git
|
https://github.com/Relintai/world_generator.git
|
||||||
|
|
||||||
@ -77,22 +70,22 @@ https://github.com/Relintai/texture_packer.git
|
|||||||
|
|
||||||
https://github.com/Relintai/godot_fastnoise.git
|
https://github.com/Relintai/godot_fastnoise.git
|
||||||
|
|
||||||
|
|
||||||
These modules should be more like core modules. Game specific c++ features will go to a different module. I'll set it up soon.
|
These modules should be more like core modules. Game specific c++ features will go to a different module. I'll set it up soon.
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
Either:
|
Before compiling, in the project's folder just run scons, it will set every dependency up. Like:
|
||||||
|
|
||||||
Run `EngineSetup.bat` on windows, or `engine_setup.sh` on linux/osx. These scripts will clone godot, and the required engine modules, and they'll copy them to the proper folders.
|
``` scons ```
|
||||||
|
|
||||||
And then just compile godot as usual. Note I have a bunch of scripts to do it in the root of the project, just select the one you need.
|
I still have the old setup scripts in the repository, in case the scons command fails:
|
||||||
|
`EngineSetup.bat` on windows, or `engine_setup.sh` on linux/osx.
|
||||||
|
|
||||||
|
And then just compile godot as usual. Note I have a bunch of scripts to do it in the root of the project, you can just select the one you need.
|
||||||
|
|
||||||
[Official docs for compiling GODOT](https://docs.godotengine.org/en/latest/development/compiling/index.html)
|
[Official docs for compiling GODOT](https://docs.godotengine.org/en/latest/development/compiling/index.html)
|
||||||
|
|
||||||
If you run the setup scripts again, they'll just pull, from the repositories.
|
## Pulling upstream changes
|
||||||
|
|
||||||
Or:
|
After you pull changes, just run `scons`, it will update the dependencies.
|
||||||
|
|
||||||
Clone Godot, and install the modules mentioned in the Project architecture section, and compile as usual.
|
|
||||||
|
|
||||||
|
217
SConstruct
Normal file
217
SConstruct
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
EnsureSConsVersion(0, 98, 1)
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
module_clone_path = '/modules/'
|
||||||
|
clone_command = 'git clone {0} {1}'
|
||||||
|
|
||||||
|
engine_repository = [ 'https://github.com/godotengine/godot.git', 'engine', '' ]
|
||||||
|
|
||||||
|
module_repositories = [
|
||||||
|
[ 'https://github.com/Relintai/world_generator.git', 'world_generator', '' ],
|
||||||
|
[ 'https://github.com/Relintai/entity_spell_system.git', 'entity_spell_system', '' ],
|
||||||
|
[ 'https://github.com/Relintai/ui_extensions.git', 'ui_extensions', '' ],
|
||||||
|
[ 'https://github.com/Relintai/voxelman.git', 'voxelman', '' ],
|
||||||
|
[ 'https://github.com/Relintai/texture_packer.git', 'texture_packer', '' ],
|
||||||
|
[ 'https://github.com/Relintai/godot_fastnoise.git', 'fastnoise', '' ],
|
||||||
|
]
|
||||||
|
|
||||||
|
addon_repositories = [
|
||||||
|
['https://github.com/Relintai/entity-spell-system-addons.git', 'entity-spell-system-addons', '/addons' ],
|
||||||
|
]
|
||||||
|
|
||||||
|
third_party_addon_repositories = [
|
||||||
|
]
|
||||||
|
|
||||||
|
target_commits = {}
|
||||||
|
|
||||||
|
def load_target_commits_array():
|
||||||
|
if os.path.isfile('./HEADS'):
|
||||||
|
with open('./HEADS', 'r') as infile:
|
||||||
|
target_commits = json.load(infile)
|
||||||
|
else:
|
||||||
|
target_commits = []
|
||||||
|
|
||||||
|
def save_target_commits_array():
|
||||||
|
with open('./HEADS', 'w') as outfile:
|
||||||
|
json.dump(target_commits, outfile)
|
||||||
|
|
||||||
|
def update_repository(data, clone_path):
|
||||||
|
cwd = os.getcwd()
|
||||||
|
|
||||||
|
full_path = cwd + clone_path + data[1] + '/'
|
||||||
|
|
||||||
|
if not os.path.isdir(full_path):
|
||||||
|
os.chdir(cwd + clone_path)
|
||||||
|
|
||||||
|
subprocess.call(clone_command.format(data[0], data[1]), shell=True)
|
||||||
|
|
||||||
|
os.chdir(full_path)
|
||||||
|
|
||||||
|
subprocess.call('git reset --hard', shell=True)
|
||||||
|
subprocess.call('git pull origin master', shell=True)
|
||||||
|
subprocess.call('git checkout master', shell=True)
|
||||||
|
subprocess.call('git reset --hard', shell=True)
|
||||||
|
|
||||||
|
process = subprocess.Popen('git rev-parse HEAD', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
output = process.communicate()[0].decode().strip()
|
||||||
|
target_commits[data[1]] = output
|
||||||
|
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
def setup_repository(data, clone_path):
|
||||||
|
cwd = os.getcwd()
|
||||||
|
|
||||||
|
full_path = cwd + clone_path + data[1] + '/'
|
||||||
|
|
||||||
|
if not os.path.isdir(full_path):
|
||||||
|
os.chdir(cwd + clone_path)
|
||||||
|
|
||||||
|
subprocess.call(clone_command.format(data[0], data[1]), shell=True)
|
||||||
|
|
||||||
|
os.chdir(full_path)
|
||||||
|
|
||||||
|
subprocess.call('git reset --hard', shell=True)
|
||||||
|
subprocess.call('git pull origin master', shell=True)
|
||||||
|
|
||||||
|
target = 'master'
|
||||||
|
|
||||||
|
if data[1] in target_commits:
|
||||||
|
target = target_commits[data[1]]
|
||||||
|
|
||||||
|
subprocess.call('git checkout ' + target, shell=True)
|
||||||
|
subprocess.call('git reset --hard', shell=True)
|
||||||
|
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
def copy_repository(data, target_folder, clone_path):
|
||||||
|
copytree(os.path.abspath(clone_path + data[1] + '/' + data[2]), os.path.abspath(target_folder))
|
||||||
|
|
||||||
|
def copytree(src, dst):
|
||||||
|
for item in os.listdir(src):
|
||||||
|
sp = os.path.join(src, item)
|
||||||
|
dp = os.path.join(dst, item)
|
||||||
|
|
||||||
|
if os.path.isdir(sp):
|
||||||
|
if os.path.isdir(dp):
|
||||||
|
shutil.rmtree(dp)
|
||||||
|
|
||||||
|
shutil.copytree(sp, dp)
|
||||||
|
else:
|
||||||
|
shutil.copy2(sp, dp)
|
||||||
|
|
||||||
|
def update_engine():
|
||||||
|
update_repository(engine_repository, '/')
|
||||||
|
|
||||||
|
def update_modules():
|
||||||
|
for rep in module_repositories:
|
||||||
|
update_repository(rep, module_clone_path)
|
||||||
|
copy_repository(rep, './engine/modules/', '.' + module_clone_path)
|
||||||
|
|
||||||
|
def update_addons():
|
||||||
|
for rep in addon_repositories:
|
||||||
|
update_repository(rep, module_clone_path)
|
||||||
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
||||||
|
|
||||||
|
def update_addons_third_party_addons():
|
||||||
|
for rep in third_party_addon_repositories:
|
||||||
|
update_repository(rep, module_clone_path)
|
||||||
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
||||||
|
|
||||||
|
def update_all():
|
||||||
|
update_engine()
|
||||||
|
update_modules()
|
||||||
|
update_addons()
|
||||||
|
update_addons_third_party_addons()
|
||||||
|
|
||||||
|
save_target_commits_array()
|
||||||
|
|
||||||
|
|
||||||
|
def setup_engine():
|
||||||
|
setup_repository(engine_repository, '/')
|
||||||
|
|
||||||
|
def setup_modules():
|
||||||
|
for rep in module_repositories:
|
||||||
|
setup_repository(rep, module_clone_path)
|
||||||
|
copy_repository(rep, './engine/modules/', '.' + module_clone_path)
|
||||||
|
|
||||||
|
def setup_addons():
|
||||||
|
for rep in addon_repositories:
|
||||||
|
setup_repository(rep, module_clone_path)
|
||||||
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
||||||
|
|
||||||
|
def setup_addons_third_party_addons():
|
||||||
|
for rep in third_party_addon_repositories:
|
||||||
|
setup_repository(rep, module_clone_path)
|
||||||
|
copy_repository(rep, './game/addons/', '.' + module_clone_path)
|
||||||
|
|
||||||
|
def setup_all():
|
||||||
|
load_target_commits_array()
|
||||||
|
|
||||||
|
setup_engine()
|
||||||
|
setup_modules()
|
||||||
|
setup_addons()
|
||||||
|
setup_addons_third_party_addons()
|
||||||
|
|
||||||
|
env = Environment()
|
||||||
|
opts = Variables(args=ARGUMENTS)
|
||||||
|
|
||||||
|
opts.Add('a', 'What to do', '')
|
||||||
|
opts.Add(EnumVariable('action', 'What to do', 'setup', ('setup', 'update')))
|
||||||
|
opts.Add('t', 'Action target', '')
|
||||||
|
opts.Add(EnumVariable('target', 'Action target', 'all', ('all', 'engine', 'modules', 'all_addons', 'addons', 'third_party_addons')))
|
||||||
|
|
||||||
|
opts.Update(env)
|
||||||
|
Help(opts.GenerateHelpText(env))
|
||||||
|
|
||||||
|
action = env['action']
|
||||||
|
target = env['target']
|
||||||
|
|
||||||
|
if env['a']:
|
||||||
|
action = env['a']
|
||||||
|
|
||||||
|
if env['t']:
|
||||||
|
target = env['t']
|
||||||
|
|
||||||
|
if not os.path.isdir('./modules'):
|
||||||
|
os.mkdir('./modules')
|
||||||
|
|
||||||
|
|
||||||
|
if action == 'setup' or action == 's':
|
||||||
|
if target == 'all':
|
||||||
|
setup_all()
|
||||||
|
elif target == 'engine':
|
||||||
|
setup_engine()
|
||||||
|
elif target == 'modules':
|
||||||
|
setup_modules()
|
||||||
|
elif target == 'all_addons':
|
||||||
|
setup_addons()
|
||||||
|
setup_addons_third_party_addons()
|
||||||
|
elif target == 'addons':
|
||||||
|
setup_addons()
|
||||||
|
elif target == 'third_party_addons':
|
||||||
|
setup_addons_third_party_addons()
|
||||||
|
elif action == 'update' or action == 'u':
|
||||||
|
if target == 'all':
|
||||||
|
update_all()
|
||||||
|
elif target == 'engine':
|
||||||
|
update_engine()
|
||||||
|
elif target == 'modules':
|
||||||
|
update_modules()
|
||||||
|
elif target == 'all_addons':
|
||||||
|
update_addons()
|
||||||
|
update_addons_third_party_addons()
|
||||||
|
elif target == 'addons':
|
||||||
|
update_addons()
|
||||||
|
elif target == 'third_party_addons':
|
||||||
|
update_addons_third_party_addons()
|
Loading…
Reference in New Issue
Block a user