You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tait Hoyem b392262824
Update readme indsutction to reflect new command
2 years ago
..
migrations add skeleton 2 years ago
static/games remove accidental copy' 2 years ago
templates/games Update skeleton dir 2 years ago
README.md Update readme indsutction to reflect new command 2 years ago
__init__.py add skeleton 2 years ago
admin.py add skeleton 2 years ago
apps.py add skeleton 2 years ago
consumers.py Update skeleton dir 2 years ago
models.py add skeleton 2 years ago
tests.py add skeleton 2 years ago
urls.py Update skeleton dir 2 years ago
views.py Update skeleton dir 2 years ago

README.md

New games

Here is how to create a new game.

Step 1

Before making any changes, try to understand the structure of /skel/. Here is what you need to know in simple terms; check out each individual file for more information on how each component works:

  1. URLs are defined in skel/urls.py, this includes HTTP urls as well as WebSocket connection points.
  • HTTP responses return from skel/views.py.
  • WebSocket requests return from skel/consumers.py.
  1. WebSockets are connected to from the client in skel/static/games/skel.js.
  2. Models are defined in skel/models.py. None are included by default, but check out the Django documentation for further information on how these work.
  3. The HTML template used for the game is defined in skel/templates/games/skel.html.

Step 2

Let's create a brand new game, disconnected from our "skel" fake game. For the purposes of this guide xyz will be the name of our new game. To create a new game, run the command python manage.py newgame xyz a new game called xyz will now be created; change two things to show your game in action:

  1. Add xyz to the INSTALLED_APPS list in lamegames/settings.py.
  2. Add xyz to the GAMES list in lamegames/settings.py.

For 2, check the syntax of how other apps/games are added for an idea of how to do so.

Step 3

Have fun! Look at django guides as well as examples we have created:

  • rps/ is for Rock-Paper-Scissors
  • minesweeper/ is for Minesweeper
  • chat/ is for a simple, open-air chat room defined by a room id.

Check how these examples work for more information, and look into how Django, Django channels and Django models work to create more advanced games. Some games (like rock-paper-scissors) will not need such advanced features as models, but they do require knowledge of channels. Others (like Minesweeper) require little knowledge of channels due to their single-player nature, but do require some more models so a game may be saved for a user when they come back.

Step 4

Be creative!

I want to see the following games eventually make it into lamegames:

  • Malcana
  • (simple) Chess
  • Card games: blackjack, poker and "Uno"-like games
  • Chinese Chess (where the knight moves 2+2 instead of 2+1)

Make it happen, and be the next contributer!