Difference between revisions of "Language/Multiple-languages/Culture/How-to-Customise-Open–Source-Language-Games"

From Polyglot Club WIKI
Jump to navigation Jump to search
m (Quick edit)
 
(16 intermediate revisions by 3 users not shown)
Line 3: Line 3:
In the description, 'fit' means finding and duplicating the corresponding code and modify it to fit your new language according to the pattern.
In the description, 'fit' means finding and duplicating the corresponding code and modify it to fit your new language according to the pattern.


Some games support multiplayer online, but if you are new to programming, you don't need to customise that.
Some games support multiplayer online, but if you are new to programming, you don't need to consider that.


For JavaScript games, they are usually opened with index.html.
[https://www.letsreact.org/how-to-run-and-build-a-react-app/ Tips about opening JavaScript programs]. Input 'cmd' in ‘Run’ to start the command line on Windows.


In progress.
In progress.  
 
== Hangman ==
=== https://github.com/neverendingqs/hangman-reactjs ===
 
<big>'''change the word list'''</big>
* /src/lib/randomWords.js
*# Change <pre>var wordList</pre>
 
<big>'''change the keyboard'''</big>
* /src/components/Keyboard.js
*# Change <pre>const letters</pre>
 
<big>'''change the number of guesses'''</big>
* /src/reducers/maxGuesses.js
*# Change <pre>state = 10</pre>


== Scrabble ==
== Scrabble ==
Line 13: Line 28:
<big>'''change the word list'''</big>
<big>'''change the word list'''</big>
* /dict/
* /dict/
Change the lists.
Change the lists


<big>'''change the letter frequency and value'''</big>
<big>'''change the letter frequency and value'''</big>
Line 21: Line 36:
** /multiplayer/game/config/english.jsonp
** /multiplayer/game/config/english.jsonp
** /multiplayer/game/config/german.jsonp
** /multiplayer/game/config/german.jsonp
Change the frequency by repeatance of letter in LETTER_STASH; change the value by changing values in POINTS_PER_LETTER.
Change the frequency by repeatance of letter in <pre>LETTER_STASH</pre>
Change the value by changing values in <pre>POINTS_PER_LETTER</pre>


<big>'''add a language in singleplayer'''</big>
<big>'''add a language in singleplayer'''</big>
* /config/
* /config/
*# add a language with word list
*# Add a language with word list
* /index.html
* /index.html
*# fit <pre><div class="language_selector"></pre>
*# Fit <pre><div class="language_selector"></pre>
*
* /game.js
* /game.js
*# fit <pre>const LANG_ENGLISH = 'english';</pre>
*# Fit <pre>const LANG_ENGLISH = 'english';</pre>
*# fit <pre>const ENGLISH_CONFIG_URL = 'config/english.jsonp';</pre>
*# Fit <pre>const ENGLISH_CONFIG_URL = 'config/english.jsonp';</pre>
*# fit <pre>function getConfigUrl()</pre>
*# Fit <pre>function getConfigUrl()</pre>


<big>'''add a language in singleplayer and multiplayer'''</big>
<big>'''add a language in singleplayer and multiplayer'''</big>
* /config/
* /config/
*# add a language with word list
*# Add a language with word list
* /index.html
* /index.html
*# fit <pre><div class="language_selector"></pre>
*# Fit <pre><div class="language_selector"></pre>
*
*
** /game.js
** /game.js
** /multiplayer/game/game.js
** /multiplayer/game/game.js
*# fit <pre>const LANG_ENGLISH = 'english';</pre>
*# Fit <pre>const LANG_ENGLISH = 'english';</pre>
*# fit <pre>const ENGLISH_CONFIG_URL = 'config/english.jsonp';</pre>
*# Fit <pre>const ENGLISH_CONFIG_URL = 'config/english.jsonp';</pre>
*# fit <pre>function getConfigUrl()</pre>
*# Fit <pre>function getConfigUrl()</pre>
* /multiplayer/config.php
* /multiplayer/config.php
*# fit <pre>'language/English.php'</pre>
*# Fit <pre>'language/English.php'</pre>
* /multiplayer/0_register.php
* /multiplayer/0_register.php
*# fit <pre>const LANGUAGE_ENGLISH = 'english';</pre>
*# Fit <pre>const LANGUAGE_ENGLISH = 'english';</pre>
*# find <pre>player->language = in_array;</pre>, add the language in <pre>[ LANGUAGE_ENGLISH, LANGUAGE_GERMAN ]</pre>
*# Find <pre>player->language = in_array;</pre>, add the language in <pre>[ LANGUAGE_ENGLISH, LANGUAGE_GERMAN ]</pre>
* /multiplayer/1_matchmaker.php
* /multiplayer/1_matchmaker.php
*# find <pre>$game->stashLetters</pre>, replace the line with <pre>$game->stashLetters = array_values(switch($player->language){"english":English::LETTER_STASH; break;"german":German::LETTER_STASH; break;}</pre>
*# Find <pre>$game->stashLetters</pre>, replace the line with <pre>$game->stashLetters = array_values(switch($player->language){"english":English::LETTER_STASH; break;"german":German::LETTER_STASH; break;}</pre>
*# fit the line
*# Fit the line
 
== Spelling Bee ==
=== https://github.com/rsuth/bumblewords ===
<big>'''change the word list'''</big>
* /dictionary.txt
Change the list
 
==Other Lessons==
* [[Language/Multiple-languages/Culture/How-to-contribute-to-wiki-lessons-(FAQ)|How to contribute to wiki lessons (FAQ)]]
* [[Language/Multiple-languages/Culture/Texts-and-Audios-under-a-Public-License|Texts and Audios under a Public License]]
* [[Language/Multiple-languages/Culture/Useful-Anki-add‐ons|Useful Anki add‐ons]]
* [[Language/Multiple-languages/Culture/How-to-be-Creative|How to be Creative]]
* [[Language/Multiple-languages/Culture/Basics-of-Economy|Basics of Economy]]
* [[Language/Multiple-languages/Culture/How-to-locate-the-origin-of-a-video-or-a-photo|How to locate the origin of a video or a photo]]
* [[Language/Multiple-languages/Culture/Philosophical-and-Religious-Texts|Philosophical and Religious Texts]]
* [[Language/Multiple-languages/Culture/Largest-Retailing-Websites-around-the-World|Largest Retailing Websites around the World]]
* [[Language/Multiple-languages/Culture/Ranking-of-countries-by-cost-of-living-in-the-world|Ranking of countries by cost of living in the world]]
* [[Language/Multiple-languages/Culture/Best-Guitarists|Best Guitarists]]
<span links></span>

Latest revision as of 19:47, 27 March 2023

This is an introduction to the customisation of open-source language games for non-programmers. Use 'search in page' to find the lines quickly.

In the description, 'fit' means finding and duplicating the corresponding code and modify it to fit your new language according to the pattern.

Some games support multiplayer online, but if you are new to programming, you don't need to consider that.

Tips about opening JavaScript programs. Input 'cmd' in ‘Run’ to start the command line on Windows.

In progress.

Hangman[edit | edit source]

https://github.com/neverendingqs/hangman-reactjs[edit | edit source]

change the word list

  • /src/lib/randomWords.js
    1. Change
      var wordList

change the keyboard

  • /src/components/Keyboard.js
    1. Change
      const letters

change the number of guesses

  • /src/reducers/maxGuesses.js
    1. Change
      state = 10

Scrabble[edit | edit source]

https://github.com/edlerd/scrabble[edit | edit source]

change the word list

  • /dict/

Change the lists

change the letter frequency and value

    • /config/english.jsonp
    • /config/german.jsonp
    • /multiplayer/game/config/english.jsonp
    • /multiplayer/game/config/german.jsonp

Change the frequency by repeatance of letter in

LETTER_STASH

Change the value by changing values in

POINTS_PER_LETTER

add a language in singleplayer

  • /config/
    1. Add a language with word list
  • /index.html
    1. Fit
      <div class="language_selector">
  • /game.js
    1. Fit
      const LANG_ENGLISH = 'english';
    2. Fit
      const ENGLISH_CONFIG_URL = 'config/english.jsonp';
    3. Fit
      function getConfigUrl()

add a language in singleplayer and multiplayer

  • /config/
    1. Add a language with word list
  • /index.html
    1. Fit
      <div class="language_selector">
    • /game.js
    • /multiplayer/game/game.js
    1. Fit
      const LANG_ENGLISH = 'english';
    2. Fit
      const ENGLISH_CONFIG_URL = 'config/english.jsonp';
    3. Fit
      function getConfigUrl()
  • /multiplayer/config.php
    1. Fit
      'language/English.php'
  • /multiplayer/0_register.php
    1. Fit
      const LANGUAGE_ENGLISH = 'english';
    2. Find
      player->language = in_array;
      , add the language in
      [ LANGUAGE_ENGLISH, LANGUAGE_GERMAN ]
  • /multiplayer/1_matchmaker.php
    1. Find
      $game->stashLetters
      , replace the line with
      $game->stashLetters = array_values(switch($player->language){"english":English::LETTER_STASH; break;"german":German::LETTER_STASH; break;}
    2. Fit the line

Spelling Bee[edit | edit source]

https://github.com/rsuth/bumblewords[edit | edit source]

change the word list

  • /dictionary.txt

Change the list

Other Lessons[edit | edit source]