Cuboid Clone

Welcome to another episode “jeez i’m so bored what shall i do && my girlfriend is looking for a fun game to play knows one but doesnt run on her machine && can i clone one?”

ok that’s not exactly it but quite close. so i thought i’d clone cuboid.
actually a PS3 only game afaik, so i thought some it wouldnt hurt.
http://home.arcor.de/positiveelectron/files/project-files/Cuboid-Clone.zip
here it is. if it doesnt run due to complaining about sound stuff. uncomment line 18 (sry for the windows users that line sorta slipped in). note, the game has no sound yet.

it comes with 2(two) thrilling and challanging levels, you can easily write your own ones.
featuring some of the cool animation as seen in the real cuboid.
see here for the original game http://www.youtube.com/watch?v=bheCWlrtp-o

took me 6hours straight to write it (i watched video’s and chatted beside so it wasnt really hard work)

feel free to comment, report bugs, make additions, add content,levels,sounds whatever.

greetings to everyone

[EDIT]:
for the ones who dont want to download it. thats what it looks like:

nice game!
add some fancy effects and you have a competitioner for the original :slight_smile:

Very nice! Simple but really fun to play; maybe we can add some cool effects to this game and ship it as sample program :slight_smile:

i had some more time and added the first few cuboid levels.
you can copy and paste them into a new textfile named level+levelnumber (without the txt. in the end. for example level3 )
that would be level2:

000000111
000111131
111111111
121111
111

there is no need to fill the empty-space with zeroes. it just looks better in most editors
level3:

          111
          131
          111
           1
           1
           1
           1
           1
111       111
1211111111111
111       111   

level4:

       111
       1311
       1111
          1
      111 1
      111 1
 1111111111
 111
 121
 111      

and finally.
level5

1111111
1  1131
11  111
111
121
111

guess next step is to add more stuff. like in the real game,too. break-able tiles, portals. etc.

change the background color to black, add a counter how many steps it took. a web-database for levels (and editor, maybe just recording the moves a player makes). and you’ve created a very nice game and a good sample for panda.

added a few new features. like a sound (whohoo…coool stuff).
a propper cube-texture (again… yay)
and drumroll a level generator which automatically generates new levels if you run out of the pre-made ones.
so even if the 18 levels included now arent enough for you you can play to almost infinity and beyond. if you liked a level, you can save it and it will be added to your collection. please upload good levels, (the generator makes pretty easy stuff most of the time so good levels are rare)
[EDIT]
whopsie… fixed a one in 12,9bio cases bug in the level generation code… and cleaned up console output. you can now pass a parameter to the app when starting it so you can jump into the level.
like
python cuboid.py 8
will start at level 8.

and more additions: another sound, another animation. some fixes for a poor windows-user with unfortunate opengl-drivers.
and…drumroll
the new “level19”

0010000000
0011111100
1111111000
1100011000
1112101000
0001111000
0001111000
0000010000
0000011130

which is propably one of the hardest to solve maps generated by my mapgenerator. unless you have th right idea it will take you some time to solve it, it IS solveable btw.

to create a good level generator (for complex levels) i’d try to store the positions the block was upright, and prevent the generator from moving to positions at upright state where it already was upright. this could possibly increase complexity by preventing mutiple ways the level can be solved. (could also be that it doesnt change anything at all)

another, more complex method would be to first generate the level and later have a pathfinding mechanism that searches the fastest path. if it’s too short it can be discarded.

edit: i think when you reach the final position the tile and the block move a bit away in the x or y coodinate (while moving down).

edit2: after i’ve reached the end of the level (in the generated levels) i can still continue to move, together with the save function this gets a bit curious.

a skip function could be nice as well. if i know the solution but walked 3 times in a row wrong i can get fed up.

the levels i liked while playing:
nouser.org/WD/tmp/panda-cuboid-levels.zip

great work :slight_smile:

19 was not very hard for me. The backwards path from the end goes very far before forking significantly. 15 was much more annoying, but thats probably because it crashed more more often than usual on that one. I’m getting no audio, but I still get audio errors and crashes quite a bit.

:audio(error): corruption in stream queue
Bus error

Mac OSX 10.5

Never played the original, but just from checking out the video, you got your clone behaving very similarly. I agree that all it needs is some artwork and more levels, and it’s a game. :slight_smile:

@Craig: the game is not supposed to crash at all.if you have sound issues try to comment out line 23, or change the audio system to something more OSX friendly. maybe fmod

@FenrirWolf. thx :slight_smile: thought the tile-movement idea is pro-rsoft’s idea

@Hypnos. i had the same idea about optimizing the generator last night. recording the blocks “current Tile” values. if one matches. dischard the entire path between the 2 matches. and thx for the levels. have to go to university now, but i’ll play them later on :slight_smile:

i guess next up is new gameplay elements. editor fixes and maybe new grafics (if i can get some)

iiiit’s tuesday, and time for another update.
this time i want to introduce a new cuboid (say hello mr cuboid) which was made by Nemesis13 , it includes gloss ,spec, normal and diffusive textures. (since i havent added lights you dont see all its beauty but you can check it in pview, looks cool)
more contributions are highly welcome. especially a nice 3d background.

on the gameplay side we have green tiles, they break if you put the whole weight of the block on a single one of them. so be careful.
there also are a few new sounds for the new tiles.
unfortunately, the mapgenerator doesnt know about those new tiles yet.

the codeside didnt change much, thought it’s propably the last version i release before doing a code-cleanup. seperating files and stuff. i’m close to 600 lines now and this really starts to get neccessary.

for everyone who likes to add some levels manually. i found this nice youtube playlist which makes a perfect reference for writing your own levels. http://www.youtube.com/view_play_list?p=5A05A77A4A2DB4C1
i already added a few of them with the new type of tiles.

[EDIT] and if you know some suited CC-licensed background music. let me know about it :slight_smile:

despite my previous announcement. nemesis13 provided me with another tile model. which i added, while fixing the sound-volumes a bit. and adding a 3d-background which i threw together in blender in a hurry. so… enjoy :slight_smile: we’ll be back after some code maintainance

trying to save gives me a error in the last version currently available:

Traceback (most recent call last):
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/EventManager.py", line 61, in eventLoopTask
    self.doEvents()
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/EventManager.py", line 55, in doEvents
    processFunc(self.eventQueue.dequeueEvent())
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/EventManager.py", line 122, in processEvent
    messenger.send(eventName, paramList)
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/Messenger.py", line 325, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/Messenger.py", line 410, in __dispatch
    method (*(extraArgs + sentArgs))
  File "/Applications/Panda3D/1.7.0/lib/direct/gui/DirectButton.py", line 103, in commandFunc
    apply(self['command'], self['extraArgs'])
  File "/Users/rspoerri/Downloads/Cuboid-Clone 3/cuboid.py", line 226, in savemap
    if i < xmin:
UnboundLocalError: local variable 'xmin' referenced before assignment
:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
  File "/Users/rspoerri/Downloads/Cuboid-Clone 3/cuboid.py", line 620, in <module>
    run()
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/ShowBase.py", line 2478, in run
    self.taskMgr.run()
  File "/Applications/Panda3D/1.7.0/lib/direct/task/Task.py", line 482, in run
    self.step()
  File "/Applications/Panda3D/1.7.0/lib/direct/task/Task.py", line 440, in step
    self.mgr.poll()
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/EventManager.py", line 61, in eventLoopTask
    self.doEvents()
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/EventManager.py", line 55, in doEvents
    processFunc(self.eventQueue.dequeueEvent())
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/EventManager.py", line 122, in processEvent
    messenger.send(eventName, paramList)
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/Messenger.py", line 325, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "/Applications/Panda3D/1.7.0/lib/direct/showbase/Messenger.py", line 410, in __dispatch
    method (*(extraArgs + sentArgs))
  File "/Applications/Panda3D/1.7.0/lib/direct/gui/DirectButton.py", line 103, in commandFunc
    apply(self['command'], self['extraArgs'])
  File "/Users/rspoerri/Downloads/Cuboid-Clone 3/cuboid.py", line 226, in savemap
    if i < xmin:
UnboundLocalError: local variable 'xmin' referenced before assignment
Wed Oct 21 16:43:23 Reto-Spoerris-MacBook-Pro.local pythonw[4357] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 4659
Wed Oct 21 16:43:23 Reto-Spoerris-MacBook-Pro.local pythonw[4357] <Error>: kCGErrorIllegalArgument: CGSRemoveSurface: Invalid window 0x1233

whupsie. looks like i introduced quite some errors when adding boundary checks for the maps.
i’ll just found more “once in a blue moon errors”.

for now you can just add the following before line 226

xmin,ymin = 60,60

i’ll cut out the level generation code in a seperate file and clean it up later on.

[edit] more whupsie … totaly broke the level saving code… i tried to fix it. download link is upadted

small update:
code rewrite is going along somewhat ok. the logic-flow is still a bit strange but it already is an big improvment over the last version.
functionality is almost the same. the levelgenerator is still missing. but i added something like a main menu in exchange.
the mapfiles and the level-loader, aswell as the game-rule-checking are now a bit more flexible.

next thing on my todo:
-clean the code further up,
-add bridges and switches and other new gameplay elements,
-recode the level generator,
-add ingame info like number of moves and time

download link is still the same from the first post

…I call’em FOOLS :smiley:
really amazing game Thomas
by the way I modded your loader to use a much simpler (to me) ang more easy to read level file format, so to have a quick idea on how will be the map, as much as, i.e. this:

     ttt
stttttgt
     ttt

for the level 0, where the letters intuitively tells what is that tile (t for simple tile, s for start and so on).
If you are interested snatch all my mods here and if you like it I’ll make a file converter from actual file format to this.

as you can see in the posts above. the original levelformat was like this.
but it has certain limits. it’s not really suited to set up linked tiles such as switches which filp or move tiles(i intended to add those features later on). that’s why i decided for a rather complex format.

right now i have a rather well modulized version which have not released yet. the level-generator is still broken thought. if you want to i can upload it later today. new one would also use rigidbodycombiner for better performance . less cpu usage on slower machines.

ah I missed that, but I guess I’d done anyhow, cos I wanted an easier way to make my levels so never mind Thomas - I’ll wait the next ‘official’ release and maybe I’ll make the opposite, an exporter from ascii format to the actual ingame.

well i wrote converters from my old to the new level format myself (when i migrated to the new map format)

when i did that i planend to rewrite the levelgenerator and add an ingame level-editor. both tasks are still un-touched :stuck_out_tongue:

http://home.arcor.de/positiveelectron/files/project-files/Cuboid-Clone%20rewrite1.zip