Now optional files : action/material/view/tpl

Game development with Board Game Arena Studio
Post Reply
User avatar
thoun
Posts: 1619
Joined: 10 December 2020, 22:25

Now optional files : action/material/view/tpl

Post by thoun »

Some of you already noticed: when you generate a new project, these files are not generated anymore.
The replacements are :
X.action.php => use autowired actions directly in the game file
material.inc.php => if you want to split you material data outside of the game.php file, you can generate material files in modules/php
X_X.tpl & X.view.php => generate the template on the JS file using string templates

All these changes have been applied to the Reversi tutorial, I recommend to (re-)read it if you want to see concrete examples of these changes.

Note: you can still create the optional file with the correct name, if you want to use the old way.
The Red Kite
Posts: 14
Joined: 31 August 2021, 18:30

Re: Now optional files : action/material/view/tpl

Post by The Red Kite »

I thought I would just create a test project to try out some TPL ideas and... I just noticed this. Was a shock to be truthful.

I get the idea of adding HTML fragments via javascript but it is not a panacea. Writing HTML in an HTML file feels more natural (imho).

I don't want to halt progress. I am sure there is a good set of reasons but this is a significant change.

I was able to create a TPL file as suggested. Remember that the file has to be called <project>_<project>.tpl and it has to be placed in the top-level folder. Also you need to comment out the JS fragment that writes the 'Player zone content goes here' so that your TPL based HTML doesn't disappear.
antromusx
Posts: 23
Joined: 26 November 2023, 21:23

Re: Now optional files : action/material/view/tpl

Post by antromusx »

Does it make sense to refactor an old project for a new standards (getting rid of deprecated .tpl, action.php, view.php, states.php, etc.)?

Looks like quite a lot of work and I don't want to break a working implementation, if compatibility with the old format remains.
What do fellow developers do?
Post Reply

Return to “Developers”