@@ -73,16 +73,16 @@ <h1 id="-package-json">Package.json</h1>
73
73
< ul >
74
74
< li > < p > No trailing commmas.</ p >
75
75
< p > Good</ p >
76
- < p > { </ p >
77
- < pre > < code > "a": 123,
78
- "b": 456
79
- </ code > </ pre > < p > } </ p >
80
- < p > Bad</ p >
81
- < p > { </ p >
82
- < pre > < code > "a": 123,
83
- "b": 456,
84
- </ code > </ pre > < p > } </ p >
85
- </ li >
76
+ < pre > < code > {
77
+ "a": 123,
78
+ "b": 456
79
+ }
80
+ </ code > </ pre > < p > Bad</ p >
81
+ < pre > < code > {
82
+ "a": 123,
83
+ "b": 456,
84
+ }
85
+ </ code > </ pre > </ li >
86
86
< li > < p > No comments! JSON is NOT JavaScript.</ p >
87
87
</ li >
88
88
< li > < p > All Strings and identifiers must be quoted with double quotes. The only things not quoted are numbers and < code > true</ code > , < code > false</ code > ,
@@ -108,26 +108,20 @@ <h3 id="required-fields">Required fields</h3>
108
108
"minPlayers": 1
109
109
}
110
110
}
111
- </ code > </ pre > < ul >
112
- < li > < p > < code > name</ code > </ p >
111
+ </ code > </ pre > < h4 id ="-name- "> < code > name</ code > </ h4 >
113
112
< p > A name for your game. Used on the main screen of HappyFunTimes and SuperHappyFunTimes</ p >
114
- </ li >
115
- < li > < p > < code > description</ code > </ p >
113
+ < h4 id ="-description- "> < code > description</ code > </ h4 >
116
114
< p > A description. Used on superhappyfuntimes. No HTML allowed currently.</ p >
117
- </ li >
118
- < li > < p > < code > version</ code > </ p >
115
+ < h4 id ="-version- "> < code > version</ code > </ h4 >
119
116
< p > Used on superhappyfuntimes so users can know if there is a newer version for them to download.</ p >
120
- </ li >
121
- < li > < p > < code > happyFunTimes.gameId</ code > </ p >
117
+ < h4 id ="-happyfuntimes-gameid- "> < code > happyFunTimes.gameId</ code > </ h4 >
122
118
< p > This is the id for your game. Every game on superhappyfuntimes must have a unique id.
123
119
only A-Z, 0-9, _, - are allowed and no more than 60 charactera.</ p >
124
- </ li >
125
- < li > < p > < code > happyFunTimes.apiVersion</ code > </ p >
120
+ < h4 id ="-happyfuntimes-apiversion- "> < code > happyFunTimes.apiVersion</ code > </ h4 >
126
121
< p > This is the happyFunTimes API version needed by this game. If this number is higher
127
122
than the version of happyFunTimes the user has installed they will be asked to upgrade.
128
123
It is also used by happyFunTimes to provide the correct API for the game.</ p >
129
- </ li >
130
- < li > < p > < code > happyFunTimes.gameType</ code > </ p >
124
+ < h4 id ="-happyfuntimes-gametype- "> < code > happyFunTimes.gameType</ code > </ h4 >
131
125
< p > This is used by happyFunTimes to figure out how to deal with the game. For example
132
126
how to launch the game and how to publish it.</ p >
133
127
< p > Valid values are</ p >
@@ -136,28 +130,25 @@ <h3 id="required-fields">Required fields</h3>
136
130
< li > < code > Unity3D</ code > </ li >
137
131
< li > < code > Unity3DLibrary</ code > </ li >
138
132
</ ul >
139
- </ li >
140
- < li > < p > < code > happyFunTimes.minPlayers</ code > </ p >
133
+ < h4 id ="-happyfuntimes-minplayers- "> < code > happyFunTimes.minPlayers</ code > </ h4 >
141
134
< p > How many players are required to play this game. For example, jumpjump you can play with
142
135
one player. It's probably not any fun but you can player. boomboom on the otherhand
143
136
requires 2 players. It will not start until there are 2 players.</ p >
144
137
< p > This is only used on the superhappyfuntimes to set expectations. If you have a game that requires
145
138
10 players please consider marking it here.</ p >
146
- </ li >
147
- < li > < p > < code > happyFunTimes.category</ code > </ p >
139
+ < h4 id ="-happyfuntimes-category- "> < code > happyFunTimes.category</ code > </ h4 >
148
140
< p > This is also only used on superhappyfuntimes to set expections and hopefully to, um, categories
149
141
things. Current values</ p >
150
142
< ul >
151
143
< li > < code > game</ code > A game</ li >
152
144
< li > < code > example</ code > Not a game, not really meant to be played, just an example</ li >
153
145
< li > < code > demo</ code > Not a game, something else like an exhibit, possibly not playable without more stuff</ li >
154
146
</ ul >
155
- </ li >
156
- < li > < p > < code > happyFunTimes.useScriptTag</ code > </ p >
147
+ < h4 id ="-happyfuntimes-usescripttag- "> < code > happyFunTimes.useScriptTag</ code > </ h4 >
157
148
< p > True indicates you don't want to use requirejs instead you want to use < code > <script></ code > tags. Your < code > apiVerison</ code >
158
149
must be < code > 1.3.0</ code > or higher</ p >
159
150
< p > I really like < a href ="http://requirejs.org "> require.js</ a > style of modules. It encourages
160
- dependency injection, it also suppots module independence. But, for many it's non
151
+ dependency injection, it also supports module independence. But, for many it's non
161
152
standard and they're not used to it.</ p >
162
153
< p > So, if you want to just use standard script tags make sure your < code > package.json</ code > has its
163
154
< code > happyFunTimes.apiVersion</ code > set to < code > 1.3.0</ code > or higher and add the flag < code > happyFunTimes.useScriptTag</ code > set
@@ -178,8 +169,7 @@ <h3 id="required-fields">Required fields</h3>
178
169
either < code > game.html</ code > or < code > controller.html</ code > . The HappyFunTimes libraries will be inserted before
179
170
those tags. The < code > game.js</ code > or < code > controller.js</ code > will be inserted after.</ p >
180
171
< p > See example: < a href ="http://github.com/hft-simple-script/ "> http://github.com/hft-simple-script/</ a > </ p >
181
- </ li >
182
- < li > < p > 'happyFunTimes.ignore`</ p >
172
+ < h4 id ="-happyfuntimes-ignore- "> < code > happyFunTimes.ignore</ code > </ h4 >
183
173
< p > Used to prevent certainly files from being part of the published game.</ p >
184
174
< p > This is an array of strings in the format of < code > .gitignore</ code > (< a href ="http://git-scm.com/docs/gitignore "> see git docs</ a > )
185
175
not including the double asterix syntax. So for example</ p >
@@ -195,8 +185,33 @@ <h3 id="required-fields">Required fields</h3>
195
185
}
196
186
}
197
187
</ code > </ pre > < p > would exclude the < code > <projectdir>/src</ code > folder as well as any photoshop files.</ p >
198
- </ li >
199
- </ ul >
188
+ < h4 id ="-happyfuntimes-templatefileoptions- "> < code > happyFunTimes.templateFileOptions</ code > </ h4 >
189
+ < p > requires apiVersion < code > 1.15.0</ code > or higher.</ p >
190
+ < p > by default < code > game.html</ code > automatically gets inserted into < code > templates/game.gameview.html</ code > .
191
+ 'controller.html< code > automatically gets inserted into</ code > templates/controller.index.html`.</ p >
192
+ < p > If your project needs other files to be treated similarly you can use this option. A good example
193
+ is < a href ="http://github.com/greggman/hft-tonde-iko "> Tonde-Iko</ a > . Its < code > game.html</ code > is just a menu for
194
+ debugging, testing, and lanching individual screens. The game itself is run from < code > realgame.html</ code > .
195
+ There's also a network stress test in < code > stress.html</ code > and a file that creates the controller avatar
196
+ texture atlas in < code > makeimage.html</ code > .</ p >
197
+ < p > Each of those needed the templating treatment to get the happyfuntimes support libraries etc so
198
+ this was added to the package.json</ p >
199
+ < pre > < code > {
200
+ "name": "Tonde-Iko",
201
+ ...
202
+ "happyFunTimes": {
203
+ "gameId": "tonde-iko",
204
+ ...
205
+ "templateFileOptions": [
206
+ { "filename": "realgame.html", "template": "game" },
207
+ { "filename": "stress.html", "template": "game" },
208
+ { "filename": "makeimage.html", "template": "game" }
209
+ ]
210
+ }
211
+ }
212
+ </ code > </ pre > < p > That basically says for those 3 files use the < code > game</ code > template. They will automatically use
213
+ their respective scripts and css so for example < code > realgame.html</ code > uses < code > scripts/realgame.js</ code >
214
+ and < code > css/realgame.css</ code > </ p >
200
215
201
216
< hr />
202
217
< div >
0 commit comments