• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    JavaScript
  • Created over 12 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Open Source HTML5 Word Puzzle Game

Hexagame Word Puzzle

Hexagame is an Open Source HTML5 word game developed by Matteo Spinelli.

Basic rules

  1. Compose words by selecting a minimum of three nearby tiles.
  2. Click (or tap) on the last selected tile to confirm the word.
  3. Find as many words as you can in the given time frame (3 minutes per level).

You have a limited number of swaps. Swaps let you rearrange the tiles position.

  1. To change a tile position click (or tap) and hold on it and drag on a nearby tile.
  2. Release to confirm.
  3. You have a limited number of swaps available. Use them wisely.

Client side

To get better performance on tablets and mobile devices the UI is built out of HTML elements and CSS, this is not a canvas game. The game does not use any JS framework, it's all hand crafted custom code. This makes the whole game resides comfortably in just 15kb (minified+compressed).

Server side

Server side the game uses PHP for very simple tasks (the leader boards mostly). The only dependency is Google OAuth2 library (not included in this repo) needed for user's sign in. More sign in gateways will be added in the future (twitter, facebook, ...).

To add the OAuth PHP client to Hexagame, move the client src directory inside Hexagame libs directory and rename it google (./hexagame/libs/google/...).

You also need to rename the config-test.php file to config.php and fill the $config variable inside (it should self explanatory).

Compatibility

The game is in beta stage and the list of supported browsers/platforms is still limited:

  • Desktop

    • Chrome (best performance overall)
    • Safari (smoothest animations)
    • Firefox (works, low framerate)
    • Opera (works, low framerate)
    • Internet Explorer 9+ (glitches, need debug but good performance)
  • Tablet

    • iPad (small glitches)
    • Android (doesn't work, need work)
  • Mobile

    • No mobile device supported. Android and iPhone planned. Possibly other webkit based devices. I don't think the WinPhone 7.5 browser can handle this, maybe WP8.

Database structure

A mysql database is needed for the leader boards. The DB structure is as follow:

CREATE TABLE `users` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL DEFAULT '',
  `email` varchar(128) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `sessions` (
  `id` char(40) NOT NULL DEFAULT '',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  `token` text NOT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `scoreboards` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL DEFAULT '0',
  `time` bigint(20) unsigned NOT NULL DEFAULT '0',
  `language` char(5) NOT NULL DEFAULT '',
  `platform` tinyint(4) NOT NULL DEFAULT '0',
  `score` int(10) unsigned NOT NULL DEFAULT '0',
  `words` smallint(5) unsigned NOT NULL DEFAULT '0',
  `letters` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `level` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `score` (`score`),
  KEY `language` (`language`),
  KEY `user_id_2` (`user_id`,`score`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `leaderboards` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `rank` int(10) unsigned NOT NULL DEFAULT '0',
  `user_id` int(11) unsigned NOT NULL DEFAULT '0',
  `language` char(5) NOT NULL DEFAULT '',
  `platform` tinyint(4) NOT NULL DEFAULT '0',
  `score` int(10) unsigned NOT NULL DEFAULT '0',
  `words` smallint(5) unsigned NOT NULL DEFAULT '0',
  `letters` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `level` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  KEY `score` (`score`),
  KEY `rank` (`rank`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Please note that the DB structure will likely change.

Dictionaries

The game is a word puzzle so it is based on a word list. The dictionary files are not included in the repo but you can download them from http://hexaga.me/dict/wordlist.zip. In the archive you'll find the post-processed word lists for the following languages:

  • US English
  • UK English
  • Italian is ready but disabled in beta phase

If you want to contribute with other languages please follow these rules:

  • It is not a simple dictionary but a word list. We need all verb forms (infinite, present, future, past, etc), plural and singular, male and female, adjectives in simple, superlative, comparative, diminutive, and so on.
  • Include the most commonly used words only and some neologism. Ideally the word list shouldn't exceed ~1mb uncompressed. The US dictionary for example is just 350kb, while Italian is 950kb.
  • Include only words 3 to 8 characters long.
  • If possible accented vowels should be converted into the not-accented counter part (e.g.: รจ = e). When not applicable, please contact me before proceeding.

TO-DO

  • Optimize iPad version
  • Fix IE glitches
  • Add tutorial and instructions
  • Add Options page (to change language and preferences)
  • Add Audio
  • Add android tablet compatibility
  • Add mobile compatibility
  • Add more sign in gateways (twitter, facebook, ...)

Quick reference to build a local working environment

  1. Download the wordlist, unzip and place it in the dict folder.
  2. Rename config-test.php to config.php.
  3. Add audio files in the Audio folder (not provided in this repo)

You should be ready to go. If you want to add the leader boards and user login you also need.

  1. Create the hexagame Mysql database with the given structure.
  2. Access the Google API console and register you application/domain.
  3. Download the OAuth PHP client, copy the src directory inside the Hexagame lib directory and rename it google.
  4. Fill the $config variable.
  5. Change the return URL in the login.js file (inside the googleSignIn function).

License

Although the code is MIT licensed, the name Hexagame, the logo and the icons are copyrighted materials owned by Matteo Spinelli. The code is offered for educational purposes.

More Repositories

1

iscroll

Smooth scrolling for the web
JavaScript
12,873
star
2

add-to-homescreen

Add to home screen call-out for mobile devices
JavaScript
2,272
star
3

SwipeView

Virtually infinite loop-able horizontal carousel
JavaScript
700
star
4

infiniwall

Infinite, loopable, lazy loaded, 360ยฐ scroller for desktop and mobile
JavaScript
198
star
5

2-way-iScroll

Horizontal snap scroll (carousel) + vertical free scroll on mobile webkit using iScroll
JavaScript
116
star
6

cardview

Javascript incarnation of the rolodex
JavaScript
109
star
7

wp-frontend-login

Front-end account management (register/login/change password) for Wordpress.
PHP
104
star
8

OPK

Open Programmatic Keycap is a spherical top keycap profile developed in CadQuery
Python
88
star
9

touch-layer

Custom events and gestures handler for touch enable mobile devices
JavaScript
63
star
10

socket-balls

devicemotion + websockets + node.js proof of concept for iOS4.2
JavaScript
54
star
11

underpants-project

The Underpants Project
JavaScript
37
star
12

jsOdometer

CSS 3D odometer
JavaScript
26
star
13

OverflowScrollingFix

OSFix tries to fix iOS5 native 'overflowScrolling:touch' glitches
JavaScript
22
star
14

sockjs-chat

Lame sockJS chat demo
JavaScript
18
star
15

kbedit

Keyboard Designer
JavaScript
16
star
16

scifi-underdogs

Great Sci-Fi films you might have missed
13
star
17

remote-3d-city

JavaScript
13
star
18

PHBee

Micro PHP Framework
PHP
11
star
19

wp-add-to-homescreen

Official WordPress plugin for Add to Homescreen
PHP
10
star
20

how-to-build-a-custom-keyboard

A practical guide to building a computer keyboard from scratch
Smarty
8
star
21

KiiConf

JavaScript
8
star
22

ComfyUI_FaceAnalysis

Extension for ComfyUI to evaluate the similarity between two faces
Python
8
star
23

PuLID_ComfyUI

PuLID native implementation for ComfyUI
7
star
24

Block_Patcher_ComfyUI

Experimental sampler to iterate through blocks weight
Python
6
star
25

ComfyUI_InstantID

Python
3
star
26

ComfyUI_SimpleMath

custom node for ComfyUI to perform simple math operations
Python
1
star