Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## The Game Netwalk

![netwalk logo](../../raw/master/resources/icon.png)

Netwalk is a puzzle-like game where you have to rotate tiles.
Your goal is to connect all terminals to the server.

See in-game help for more information.

Download:
* [script.game.netwalk-0.0.7.zip](../../raw/master/script.game.netwalk-0.0.7.zip)
12 changes: 9 additions & 3 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<addon id="script.game.netwalk" name="Netwalk Game" version="0.0.5" provider-name="Tristan Fischer (sphere@dersphere.de)">
<addon id="script.game.netwalk" name="Netwalk Game" version="0.0.7" provider-name="Tristan Fischer (sphere@dersphere.de)">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="xbmc.python" version="3.0.0"/>
</requires>
<extension point="xbmc.python.script" library="game.py"/>
<extension point="xbmc.python.script" library="game.py">
<provides>game</provides>
</extension>
<extension point="xbmc.addon.metadata">
<language/>
<platform>all</platform>
Expand Down Expand Up @@ -40,5 +42,9 @@
<description lang="pt_BR">NetWalk é um jogo de quebra-cabeça como onde você tem que girar blocos. [CR] Seu objetivo é conectar todos os terminais para o servidor. [CR] [CR] Veja ajuda do jogo para mais informações.</description>
<description lang="sv">Netwalk är ett pussel-liknande spel där du roterar brickor.[CR]Ditt mål är att ansluta alla terminaler till servern.[CR][CR]Se hjälpen för mer information.</description>
<description lang="zh">网络漫步是一个旋转管线的解迷类游戏。[CR]你的目标是将所有终端连接到服务器。[CR][CR]更多信息见游戏中的介绍。</description>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
</extension>
</addon>
19 changes: 13 additions & 6 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
0.0.5 (81.01.2014)
0.0.7 (2021-02-28)
- Migrated to python3 for matrix (thanks to Adamhotep)
- Control support for keyboard remotes (Esc/Caps/Shift, thanks to Adamhotep)

0.0.6 (2018-10-21)
- added add-on to new games category in add-on manager

0.0.5 (2014-01-18)
- fixed translations in gotham

0.0.4 (28.08.2013)
0.0.4 (2013-08-28)
- added translations

0.0.3
0.0.3 (2013-02-20)
- In-game help
- New icon

0.0.2
0.0.2 (2013-02-19)
- New skin (thanks to Jugger)
- Avoid 4-connection tiles
- Fix keyboard navigation between buttons and the grid
- Code refactoring

0.0.1
- Initial version
0.0.1 (2013-02-17)
- Initial version
69 changes: 36 additions & 33 deletions game.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Tristan Fischer (sphere@dersphere.de)
# Copyright (C) 2013 Tristan Fischer (sphere@dersphere.de)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,20 +20,21 @@
import os
import random
import time
import thread
import _thread
import string
import sys

import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs

addon = xbmcaddon.Addon()

ADDON_NAME = addon.getAddonInfo('name')
ADDON_PATH = addon.getAddonInfo('path').decode('utf-8')
ADDON_PATH = addon.getAddonInfo('path')
MEDIA_PATH = os.path.join(
xbmc.translatePath(ADDON_PATH),
xbmcvfs.translatePath(ADDON_PATH),
'resources',
'skins',
'default',
Expand Down Expand Up @@ -91,7 +92,7 @@ def _(string_id):

def log(msg):
xbmc.log('[ADDON][%s] %s' % (ADDON_NAME, msg.encode('utf-8')),
level=xbmc.LOGNOTICE)
level=xbmc.LOGINFO)


class Tile(object):
Expand Down Expand Up @@ -131,19 +132,19 @@ def set_type(self):

def build_controls(self):
self.button_control = xbmcgui.ControlButton(
x=self._x_position,
y=self._y_position,
width=self._width,
height=self._height,
x=int(self._x_position),
y=int(self._y_position),
width=int(self._width),
height=int(self._height),
label='',
focusTexture=get_image('selected.png'),
noFocusTexture=get_image('not_selected.png'),
)
self.image_control = xbmcgui.ControlImage(
x=self._x_position,
y=self._y_position,
width=self._width,
height=self._height,
x=int(self._x_position),
y=int(self._y_position),
width=int(self._width),
height=int(self._height),
filename=get_image('empty.png'),
)

Expand All @@ -163,7 +164,7 @@ def update_image(self):
def rotate_cw(self):
# shift all bits to the right
if not self._is_locked:
new_connections = self.connections << 1
new_connections = int(self.connections) << 1
if new_connections > 15:
new_connections -= 15
self.connections = new_connections
Expand All @@ -172,8 +173,8 @@ def rotate_cw(self):
def rotate_ccw(self):
# shift all bits to the left
if not self._is_locked:
new_connections = self.connections >> 1
if self.connections & UP:
new_connections = int(self.connections) >> 1
if int(self.connections) & UP:
new_connections += LEFT
self.connections = new_connections
return True
Expand Down Expand Up @@ -244,7 +245,7 @@ def has_free_neighbor(self):

@property
def num_connections(self):
num = len([d for d in DIRECTIONS if d & self.connections])
num = len([d for d in DIRECTIONS if d & int(self.connections)])
return num

def __str__(self):
Expand All @@ -267,8 +268,8 @@ def __init__(self, rows, columns, x_position, y_position, width, height):
def generate_tiles(self):
tile_width = self._width / self._columns
tile_height = self._height / self._rows
for row in xrange(self._rows):
for column in xrange(self._columns):
for row in range(self._rows):
for column in range(self._columns):
tile = Tile(row, column, self, tile_width, tile_height)
self._tiles.append(tile)

Expand Down Expand Up @@ -312,7 +313,7 @@ def randomize_tree(self):
self._target_moves = 0
for tile in self._tiles:
movement = random.choice([tile.rotate_cw, tile.rotate_ccw])
for turn in xrange(random.randint(0, 2)):
for turn in range(random.randint(0, 2)):
movement()
self._target_moves += 1

Expand All @@ -337,10 +338,10 @@ def update_connection_states(self):
active_tile.is_connected = True
for direction in DIRECTIONS:
# check if this tile has a connection to this direction
if active_tile.connections & direction:
if int(active_tile.connections) & int(direction):
# check if the neighbor has an opposite connection
neighbor = active_tile.neighbor_at(direction)
if neighbor.connections & opposite(direction):
if int(neighbor.connections) & int(opposite(direction)):
# if the neighbor wasn't already checked, do that later
if neighbor not in visited_tiles:
to_visit_tiles.add(neighbor)
Expand Down Expand Up @@ -385,12 +386,11 @@ class Game(xbmcgui.WindowXML):
CONTROL_ID_EXIT = 3006
CONTROL_ID_GAME_ID = 3007
AID_EXIT = [9, 13] # exit the game
AID_ENTER = [7, 100] # rotate the selected tile clockwise
AID_BACK = [10] # rotate the selected tile counter clockwise
AID_INFO = [11] # lock the selected tile
AID_SPACE = [12] # lock the selected tile
AID_MIDDLE_MOUSE = [102] # lock the selected tile
AID_LOCK = AID_INFO + AID_SPACE + AID_MIDDLE_MOUSE
AID_ENTER = [7, 34, 100] # rotate the selected tile counter-clockwise
BID_CCW = [61657] # rotate the selected tile counter-clockwise (caps)
AID_BACK = [10, 92] # rotate the selected tile clockwise
AID_LOCK = [11, 12, 102, 117] # lock the selected tile
BID_LOCK = [61650, 61651] # lock the selected tile (left/right shift)

def onInit(self):
# init vars
Expand All @@ -409,24 +409,27 @@ def onInit(self):
self.grid.generate_tiles()
self.add_tile_controls()
# start the timer thread
thread.start_new_thread(self.timer_thread, ())
_thread.start_new_thread(self.timer_thread, ())
# start the game
self.start_game()

def onAction(self, action):
action_id = action.getId()
button_code = action.getButtonCode()
#log("action id = %d" % action_id) # uncomment to log keypress codes
#log("button code = %d" % button_code) # uncomment to log button codes
focus_id = self.getFocusId()
if self._game_in_progress and focus_id in self._tile_button_ids:
tile = self._tile_button_ids[self.getFocusId()]
if action_id in self.AID_ENTER:
if action_id in self.AID_ENTER or button_code in self.BID_CCW:
if not tile.is_locked:
tile.rotate_ccw()
self.movement_done()
elif action_id in self.AID_BACK:
if not tile.is_locked:
tile.rotate_cw()
self.movement_done()
elif action_id in self.AID_LOCK:
elif action_id in self.AID_LOCK or button_code in self.BID_LOCK:
tile.is_locked = not tile.is_locked
if self.grid.all_correct:
self.game_over()
Expand All @@ -453,7 +456,7 @@ def start_game(self, game_id=None):
if not game_id:
random.seed()
game_id = ''.join(
random.choice(string.ascii_uppercase) for n in xrange(15)
random.choice(string.ascii_uppercase) for n in range(15)
)
self._game_id = game_id
random.seed(self._game_id)
Expand All @@ -469,7 +472,7 @@ def start_game(self, game_id=None):
self.game_id_control.setLabel(str(self._game_id))

def timer_thread(self):
while not xbmc.abortRequested:
while not xbmc.Monitor().abortRequested():
if self._game_in_progress:
game_time = time.time() - self._start_time
self.time_control.setLabel(str(int(game_time)))
Expand Down
Binary file added resources/fanart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
14 changes: 12 additions & 2 deletions resources/language/Belarusian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,18 @@ msgid "Exit?"
msgstr "Exit?"

msgctxt "#32010"
msgid "[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgid "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"

msgctxt "#32011"
msgid "[B]Goal[/B][CR]Your goal is to connect all terminals to the server by rotating the tiles[CR]Note, there is only ONE solution possible for each game!"
Expand Down
9 changes: 7 additions & 2 deletions resources/language/Chinese (Simple)/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ msgid "Exit?"
msgstr "退出?"

msgctxt "#32010"
msgid "[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]控制[/B][CR]- 选定管线:移动鼠标,上、下、左、右键[CR]- 顺时针旋转管线:右击鼠标,ESC、BACK键[CR]- 逆时针旋转管线:左击鼠标,回车键[CR]- 锁定管线:鼠标中键,信息、空格键[CR]- 退出游戏:停止、退出按钮[CR]"
msgid "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]控制[/B][CR]- 选定管线:移动鼠标,上、下、左、右键[CR]- 顺时针旋转管线:右击鼠标,ESC、BACK键[CR]- 逆时针旋转管线:左击鼠标,回车键, 大写锁定[CR]- 锁定管线:鼠标中键,信息、空格键, 换键[CR]- 退出游戏:停止、退出按钮[CR]"

msgctxt "#32011"
msgid "[B]Goal[/B][CR]Your goal is to connect all terminals to the server by rotating the tiles[CR]Note, there is only ONE solution possible for each game!"
Expand Down
9 changes: 7 additions & 2 deletions resources/language/Croatian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ msgid "Exit?"
msgstr "Izaz?"

msgctxt "#32010"
msgid "[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Kontrole[/B][CR]- Fokusiraj pločicu: LEBDENJE-MIŠEM, GORE, DESNO, LIJEVO, DOLJE[CR]- Okreni fokusiranu pločicu u smjeru kazaljke sata: DESNI-KLIK, ESC, BACK[CR]- Okreni fokusiranu pločicu suprotno od smjera kazaljke sata: LIJEVI-KLIK, ENTER[CR]- Zaključaj fokusiranu pločicu: SREDNJI-KLIK, INFO, SPACE[CR]- Zatvori igru: STOP, TIPKA-IZLAZA[CR]"
msgid "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Kontrole[/B][CR]- Fokusiraj pločicu: LEBDENJE-MIŠEM, GORE, DESNO, LIJEVO, DOLJE[CR]- Okreni fokusiranu pločicu u smjeru kazaljke sata: DESNI-KLIK, ESC, BACK[CR]- Okreni fokusiranu pločicu suprotno od smjera kazaljke sata: LIJEVI-KLIK, ENTER, CAPS[CR]- Zaključaj fokusiranu pločicu: SREDNJI-KLIK, INFO, SPACE, SHIFT[CR]- Zatvori igru: STOP, TIPKA-IZLAZA[CR]"

msgctxt "#32011"
msgid "[B]Goal[/B][CR]Your goal is to connect all terminals to the server by rotating the tiles[CR]Note, there is only ONE solution possible for each game!"
Expand Down
7 changes: 6 additions & 1 deletion resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ msgid "Exit?"
msgstr ""

msgctxt "#32010"
msgid "[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgid "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr ""

msgctxt "#32011"
Expand Down
9 changes: 7 additions & 2 deletions resources/language/Galician/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ msgid "Exit?"
msgstr "Saír?"

msgctxt "#32010"
msgid "[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Controis[/B][CR]- Ficha seleccionada: RATO-POUSADO, ARRIBA, DEREITA, ESQUERDA, ABAIXO[CR]- Xirar ficha no sentido do reloxo: CLIC DEREITO, ESC, ATRAS[CR]- Xirar ficha en contra do sentido do reloxo: CLICK ESQUERDO, INTRO[CR]- Bloquear ficha: CLIC CENTRAL, INFO, ESPACIO[CR]- Saír do Xogo: DETER, BOTON SAIR[CR]"
msgid "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Controis[/B][CR]- Ficha seleccionada: RATO-POUSADO, ARRIBA, DEREITA, ESQUERDA, ABAIXO[CR]- Xirar ficha no sentido do reloxo: CLIC DEREITO, ESC, ATRAS[CR]- Xirar ficha en contra do sentido do reloxo: CLICK ESQUERDO, INTRO, BLOQ MAYÚS[CR]- Bloquear ficha: CLIC CENTRAL, INFO, ESPACIO, ⇧[CR]- Saír do Xogo: DETER, BOTON SAIR[CR]"

msgctxt "#32011"
msgid "[B]Goal[/B][CR]Your goal is to connect all terminals to the server by rotating the tiles[CR]Note, there is only ONE solution possible for each game!"
Expand Down
18 changes: 12 additions & 6 deletions resources/language/German/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ msgid "Exit?"
msgstr "Beenden?"

msgctxt "#32010"
msgid ""
"[B]Controls[/B][CR]- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]- "
"Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]- Turn focused tile "
"counter-clockwise: LEFTCLICK, ENTER[CR]- Lock focused tile: MIDDLECLICK, "
"INFO, SPACE[CR]- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Steuerung[/B][CR]- Kachel markieren: MAUSZEIGER, HOCH, RECHTS, LINKS, RUNTER[CR]- Markierte Kachel in Uhrzeigerrichtung drehen: RECHTSKLICK, ESC, ZURÜCK[CR]- Markierte Kachel entgegen des Uhrzeigersinns drehen: LINKSKLICK, ENTER[CR]- Markierte Kachel sperren: MITTELKLICK, INFO, LEERTASTE[CR]- Spiel verlassen: STOP, EXIT[CR]"
msgid "[B]Controls[/B][CR]"
"- Focus tile: MOUSE-HOVER, UP, RIGHT, LEFT, DOWN[CR]"
"- Turn focused tile clockwise: RIGHTCLICK, ESC, BACK[CR]"
"- Turn focused tile counter-clockwise: LEFTCLICK, ENTER, CAPS[CR]"
"- Lock focused tile: MIDDLECLICK, INFO, SPACE, SHIFT[CR]"
"- Exit Game: STOP, EXIT-BUTTON[CR]"
msgstr "[B]Steuerung[/B][CR]"
"- Kachel markieren: MAUSZEIGER, HOCH, RECHTS, LINKS, RUNTER[CR]"
"- Markierte Kachel in Uhrzeigerrichtung drehen: RECHTSKLICK, ESC, ZURÜCK[CR]"
"- Markierte Kachel entgegen des Uhrzeigersinns drehen: LINKSKLICK, ENTER, ⇪[CR]"
"- Markierte Kachel sperren: MITTELKLICK, INFO, LEERTASTE, ⇧[CR]"
"- Spiel verlassen: STOP, EXIT[CR]"

msgctxt "#32011"
msgid ""
Expand Down
Loading