Kodi Community Forum

Full Version: 2048 Game for XBMC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

in case you don't know 2048, its a small puzzle game which is very popular at the moment, you can play it e.g. here: http://gabrielecirulli.github.io/2048/
Be warned, it makes addicted Wink

I created a XBMC Version of it and would be happy if some of you could test it, it is still not finished but the game logic is complete (except you can't win).

Here are the rules and controls:
- If tiles with same value overlap they join into one tile with double value
- goal is to get the 2048 tile (not implemented yet) but you will see your own highscore
- After any (successful) move a new random tile is spawn
- you loose when no moves are available
- Press up/down/right/left to move the tiles
- Press menu to exit

I implemented it as dialog so you can play while commercial breaks, listening to music and so on...
Later it will be possible to change the size and location of the dialog.

You can download version 0.0.2 here: http://goo.gl/v5zrH3

I don't want to have it public yet so I decided to post it here first to get some feedback - tell me if you don't like such threads here (team internal) and I will move or delete it.

regards,
sphere
Hehe, very cool.
2048 is a great time killer / waster Wink
Nice, didn't know that game but seems really addictive. Will give it a try.

btw - we need a games extension point - having them mixed with program addons or scripts is meh. I like all your games btw - movie quiz has some navigation oddities though. And seeing this game reminded me of my Flash game attempts 10 years ago:
- http://images.elements-net.de/flash/breakout.swf
- http://images.elements-net.de/flash/parallax2.swf (you have to click and hold in order to move - and you can click some objects)
- http://projects.elements-net.de/puzzle/puzzle_fl6.swf (I'd like to see such a game using f.e. movie posters/fanart)
First remarks:
- How do you close the game? Wink
- Apparently, you don't add a random tile when a "merge" happens. The original game always adds a tile.
(2014-03-22, 14:34)da-anda Wrote: [ -> ]Nice, didn't know that game but seems really addictive. Will give it a try.

btw - we need a games extension point - having them mixed with program addons or scripts is meh. I like all your games btw - movie quiz has some navigation oddities though. And seeing this game reminded me of my Flash game attempts 10 years ago:
- http://images.elements-net.de/flash/breakout.swf
- http://images.elements-net.de/flash/parallax2.swf (you have to click and hold in order to move - and you can click some objects)
- http://projects.elements-net.de/puzzle/puzzle_fl6.swf (I'd like to see such a game using f.e. movie posters/fanart)
MovieQuiz is not from me Wink, but WhatTheMovie and Netwalk are.
Interesting games you made Wink

(2014-03-22, 14:41)Koying Wrote: [ -> ]First remarks:
- How do you close the game? Wink
- Apparently, you don't add a random tile when a "merge" happens. The original game always adds a tile.

Read my initial post: "Press menu to exit" Wink
Regarding the missing add, you are right, you found a bug, thanks!
(2014-03-22, 15:10)sphere Wrote: [ -> ]Read my initial post: "Press menu to exit" Wink
Sorry about that. I have to improve my diagonal reading skills Wink
May I suggest adding at least "BACK" as a way to exit, if possible. Seems more natural.

[edit]
Well, "ContextMenu" doesn't work (on keyboard / Win). Not sure what MENU key I'm supposed to press..
damn you, I just wasted 2h on this Smile
(2014-03-22, 15:18)Koying Wrote: [ -> ]
(2014-03-22, 15:10)sphere Wrote: [ -> ]Read my initial post: "Press menu to exit" Wink
Sorry about that. I have to improve my diagonal reading skills Wink
May I suggest adding at least "BACK" as a way to exit, if possible. Seems more natural.

[edit]
Well, "ContextMenu" doesn't work (on keyboard / Win). Not sure what MENU key I'm supposed to press..
Good idea, i changed it to exit on back. Menu (which is "m" on keyboard) now restarts the game. context-menu will open the move-and-resize-mode later.

Quote:Apparently, you don't add a random tile when a "merge" happens. The original game always adds a tile.
Btw, I cant seem to reproduce this, could you please re-check


(2014-03-22, 15:20)wsnipex Wrote: [ -> ]damn you, I just wasted 2h on this Smile
Hehe, you wasted the time in the original browser game or in my xbmc add-on? Wink
(2014-03-22, 16:02)sphere Wrote: [ -> ]
Quote:Apparently, you don't add a random tile when a "merge" happens. The original game always adds a tile.
Btw, I cant seem to reproduce this, could you please re-check
Sure:
https://www.dropbox.com/s/frgsjvotfjb3ae....18.45.png
UP
https://www.dropbox.com/s/cht3y0x7zxhcts....18.53.png

No added tile. On your 0.0.1, obviously.
If not already on your TODO, would be great to have some kind of auto-save, too, if possible.
A 2048 game tends to last longer than a commercial break Wink
Here is version 0.0.2: http://goo.gl/v5zrH3

Changelog:
0.0.2
- changed: restart game on menu-key, exit with back-key
- changed: switch icon and tile pictures (to be pixel_perfect)
- fixed: potential missing random tile spawn
@sphere - with "movie quiz" I was referring to "what the movie" (had a 50% chance to guess the right name Wink ) - it has some UI/navigation oddities. Wanted to chat with you about it, but haven't seen you on IRC since then. But let's not get OT with it.
BTW - "back" should exit any of your games. Don't assume everybody has a keyboard and tons of buttons available. I was trapped several times. Also, don't catch/misuse any playback related buttons, there might be music playing in the background Wink (IIRC one game had issues with this).
Oh, the no added tile is probably due to:

Code:
17:02:40 T:13752   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: (2, 'No such file or directory', 'D:\\cbro\\src\\xbmc-github\\portable_data\\userdata\\addon_data\\script.game.2048\\highscore.txt')
                                            Traceback (most recent call last):
                                              File "D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py", line 487, in onAction
                                                moved = self.grid.move('left')
                                              File "D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py", line 464, in move
                                                self.highscore.value = self.score
                                              File "D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py", line 116, in _set
                                                self.__save()
                                              File "D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py", line 107, in __save
                                                with open(self._filepath, 'w') as f:
                                            IOError: (2, 'No such file or directory', 'D:\\cbro\\src\\xbmc-github\\portable_data\\userdata\\addon_data\\script.game.2048\\highscore.txt')
                                            -->End of Python script error report<--

I indeed have no "addon_data\script.game.2048" directory (on Windows, still).
(2014-03-22, 18:10)Koying Wrote: [ -> ]Oh, the no added tile is probably due to:

Thanks! That is the reason. I re-uploaded a fixed version 0.0.2, could you try again?
Btw, now the highscore should also be stored between sessions Wink
Got an error while installing the zip, but the bug is solved Smile

Note that I get this when exiting.

Code:
17:49:42 T:11656   ERROR: EXCEPTION: Object should be of type Control
17:49:42 T:11656   ERROR: Exception
17:49:42 T:11656   ERROR: RuntimeError
17:49:42 T:11656   ERROR: :
17:49:42 T:11656   ERROR: 'Object should be of type Control'
17:49:42 T:11656   ERROR:  in
17:49:42 T:11656   ERROR: <bound method Tile.__del__ of 2 ((0, 0))>
17:49:42 T:11656   ERROR:  ignored
17:49:42 T:11656   ERROR: EXCEPTION: Object should be of type Control
17:49:42 T:11656   ERROR: Exception
17:49:42 T:11656   ERROR: RuntimeError
17:49:42 T:11656   ERROR: :
17:49:42 T:11656   ERROR: 'Object should be of type Control'
17:49:42 T:11656   ERROR:  in
17:49:42 T:11656   ERROR: <bound method Tile.__del__ of 2 ((0, 3))>
17:49:42 T:11656   ERROR:  ignored
17:49:42 T:11656    INFO: CPythonInvoker(18, D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py): script successfully run
17:49:42 T:11656 WARNING: CPythonInvoker(18, D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py): the python script "D:\cbro\src\xbmc-github\portable_data\addons\script.game.2048\game.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcaddon::Addon,class PythonBindings::XBMCAddon_xbmcgui_WindowXMLDialog_Director
17:49:42 T:11656    INFO: Python script stopped
Pages: 1 2