How to clone an existing game to make local changes

Game development with Board Game Arena Studio
Post Reply
User avatar
Sly0001
Posts: 5
Joined: 18 March 2020, 04:30

How to clone an existing game to make local changes

Post by Sly0001 »

Hi,

1. In another forum thread I found something about a "From Existing Project" option in the Create Project page, but there these is no such thing.

2. I also read about overwriting my newly created project with another project from the game configuration page, doing so does copy the project, but all files remain readonly.

What is the recommended method to copy a project and then be able to modify it?

Thanks a lot

Sylvain
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: How to clone an existing game to make local changes

Post by Tisaac »

This was possible before but the admin disabled it since it was not really working.
Following these steps should work :
- create your own project MyProject
- grant read access to the project ProjectToCopy you want to copy to access files
- copy files to your new project
- rename *EVERY* instance of the string "PrrojectToCopy" to "MyProject", including inside the names of the files and the content
- upload everything to MyProject, reload everything from the admin pannel
User avatar
Sly0001
Posts: 5
Joined: 18 March 2020, 04:30

Re: How to clone an existing game to make local changes

Post by Sly0001 »

It works! Thanks
User avatar
pickardj79
Posts: 17
Joined: 26 July 2020, 04:34

Re: How to clone an existing game to make local changes

Post by pickardj79 »

There's a php script that does this for you. I've been using it extensively for about a month with no problems. I cloned https://github.com/elaskavaia/bga-sharedcode into dir whose parent is common to the sftp'd source project and target project. E.g. if I want to clone galaxytrucker project into pickardjgt my dir structure is:

> ls ~/bga/
bga-sharedcode galaxytrucker pickardjgt

I only have read access to galaxytrucker so I sftp-downloaded that. pickardjgt is my working project and started as a blank project.

Then from that common parent I run

Code: Select all

php bga-sharedcode/misc/bgaprojectrename.php galaxytrucker pickardjgt
. It's a joint-development effort so I have the source project (galaxytrucker) under source control and edit code there. Then I have a bash script that runs the bgaprojectrename php, does a php-syntax check, and sftp-uploads my target project (pickardjgt) to bga. The slowest part of this is sftp so I have different versions of the script for uploading different parts of the code. I don't see any reason this couldn't be replicated into multiple local copies uploaded to different bga projects, if needed. Like stable and dev builds.
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: How to clone an existing game to make local changes

Post by Een »

There is also an overwrite ... with ... form at the end of the "source code version control" block on the "Manage game" page for your project (this feature was added at the same time than the "create from another project" feature was disabled, as a more flexible and reliable tool).

This is the recommended method to overwrite a project with the code of another project.
User avatar
Sly0001
Posts: 5
Joined: 18 March 2020, 04:30

Re: How to clone an existing game to make local changes

Post by Sly0001 »

@Een, As I said in the original post, "overwrite ... with ..." created the files with read only attributes. So the copy worked but I could not upload modifications via sftp.
Last edited by Sly0001 on 10 September 2020, 23:32, edited 1 time in total.
User avatar
quietmint
Posts: 299
Joined: 31 July 2017, 00:28

Re: How to clone an existing game to make local changes

Post by quietmint »

@Een, we have these permission issues often. In the manage game, can we get a "Reset Permissions" button? Basically it would run something like chown -R myuser:myuser . and chmod -R 777 . in the current project folder to fix this type of problem (regardless of how it happened).
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: How to clone an existing game to make local changes

Post by Een »

Well, we clearly don't want 777 :)
But I'll check this, I was not aware of the issue (except on subdirectories someone had already reported permission issues).

EDIT: reassigning yourself administrator rights on the project should probably fix permission issues in most cases (until we have had time to look into this).
User avatar
PurplishCat
Posts: 11
Joined: 29 November 2016, 05:02

Re: How to clone an existing game to make local changes

Post by PurplishCat »

Edit: Never mind. It does work. It's a little confusing because the project names are case sensitive, even though everywhere in studio the names are converted to lowercase, so I can't even see what the original case of my project was/is. As far as I can tell at least. And I had to guess on the case of the target game to copy. If there a way to see the original case of my own projects and existing games?

---- Original ---

Can any game be used as the source? I wanted to look at Marco Polo as a learning exercise (a modern implementation and a game that I know). When I tried to replace a newly created project with marcopolo I got:
Sorry, an unexpected error has occurred...

You must use camelcase for project names

#0 /var/tournoi/release/tournoi-200916-0917/www/include/webActionCore.inc.php(135): action_studio->overwriteStudioProject()
#1 /var/tournoi/release/tournoi-200916-0917/www/index.php(230): launchWebAction('admin', 'action_studio', 'overwriteStudio...', false, false, NULL, true, false)
#2 {main}
Not sure what camel casing has to do with anything...

If only certain games can be used, is there a list?
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: How to clone an existing game to make local changes

Post by Een »

If there a way to see the original case of my own projects and existing games?
Yes, the name with original case is used in your gamename.game.php file for the game class so you can check it there.

As we recommend to use camelcase when creating a project, it's usually camelcase; using camelcase for the copy will also work if the project was created with only lowercase letters; it will not work if the project was created using some uppercase letters differing from camelcase (since copying projects relies on replace all substitutions).

Hope it helps!
Post Reply

Return to “Developers”