This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#11922 - New Lua game: pixel-painter
Attached to Project:
Rockbox
Opened by Stefan Schneider-Kennedy (splondike) - Sunday, 06 February 2011, 07:04 GMT+2
Opened by Stefan Schneider-Kennedy (splondike) - Sunday, 06 February 2011, 07:04 GMT+2
|
DetailsHello, I've written a new Lua game which I hope to see included in the official distribution. It's called pixel painter and is based on the game of the same name by Pavel Bakhilau (http://js1k.com/2010-first/demo/453).
I have tested it on my Fuzev2 and also on the following emulators: gigabeat, iaudiox5, ipodcolor, ipodnano2g, ipodvideo,iriverh10 and sansae200v2. The nature of the game means it will only work on colour players. I can't seem to get the touch screen emulators to work properly, so it won't work with those devices either. Please download it and give it a try. What would be especially useful is if you could try starting a new (hard difficulty) game while playing music. If the playback is interrupted either temporarily or permanently please let me know (see http://forums.rockbox.org/index.php/topic,27120.msg177434.html)! Also, the speed of 'calculating par...' on various players would be good to know. On my Fuze it takes ~3s to calculate on hard difficulty. Save and score files are saved to .rocbox/rocks/games/pixel-painter.* if you'd like to completely remove the plugin. |
This task depends upon
I say it "seems" and not that it "is", because it seems there's no keymap for iPods! I can't move the color selector up and down :(
Oh, and some warnings (like the invalid move one seem too last for too long... I ended up rebooting the device.
Cheers, and keep up the good work!
Gabriel
First, what iPod are you using? It seems to work on all the emulators I mentioned using the same scrolling movement you'd use for navigating menus. The menu button opens the game menu on all the emulators. You can also skip left to quit exit the game (which saves it as well).
The invalid move popup doesn't block. As soon as you change colour or make a selection it will disappear. Perhaps I should revise how it's displayed as I guess people mightn't realise this.
Can someone with an iPod confirm this is my device's Rockbox fault, so we make sure it works or doesn't work on real iPods?
I wrote a little script to test what 'keycodes' your player is sending, and what the lua plugin is mapping them to (attached). Please run it and press/scroll when it asks you to. It will dump the results to 'action-codes.txt', could you please upload that file here? Don't worry if you see some redundancy amongst the prompts (i.e. Up and Menu are the same thing).
I'm using daily builds.
Also, if you have the time, could you try running the script with the released version of the code to see if it's a recent change which is causing the issue?
Your game is very nice to play ^^
I will try player music and simutaneously play this game, see if anything happens. I will let you know.
Now then, if I use your game in a more extreme condition ( EQ + pitch at limit ) so that I have 90% - 100% of the processor being used and start your game, your game works perfectly under this condition as well.
The only thing in that condition is that sometimes nearing the end of the game it randomly closes... ( or maybe I accidently touch the scroll wheel...)
If you could consider changing the button of what closes your program for the sansa e200's? Maybe the record key or menu ( down ) button would be more practical...
Also, for non color targets, you could use symbols instead of color.
Thankyou For This Awsome Game You Have ^^
Thanks for your report about the (temporary) music cutoff, I'll try making the garbage collection a bit more aggressive/smarter and we'll see if that fixes it. Before then, could you try editing the program and replacing the first few lines of the get_colours_count function with this and see if it fixes the music skip:
function get_colours_count(board, x, y, original_colour)
rb.yield()
local board_dimension = table.getn(board)
local count_table = {0, 0, 0, 0, 0, 0}
Regarding the random closing, are you sure you're not pressing the 'safe exit' button (which is 'up' for the e200)? You can check by opening the game again, and it should resume from where you left off. If it does, it was the safe exit button. I take it from your comment that you've already worked this out? There should also be a menu button (hold down home on Fuze) which lets you change the difficulty, start a new game etc. I don't have the e200 emulator at the moment, so I can't check what the menu button is on that.
I thought of the symbols thing, and even drew some. The main trouble is they're difficult to scale for different screen resolutions.
I used to have a fuze, but I brought it back to the store later ( back in 2008/09? ) because rockbox did not support it =P
I could try your new code see how it goes. ( Ahha, I am hopefully doing it right, and not crash it due to my own errors...) It isn't really much of an inconvenience, your game only does it once ( when it starts ) while it can happen on boomshine ( already on rockbox ) many times throughout the game.
Up? I did not press that key. I could have accidently hit the scroll wheel ( which also closes your game. ) I think it might have resumed again...I can check again... It does not happen often ( and yes, most likely my error, and not yours . ) So I could of hit the safe button. If the scroll wheel is the up key, then I probably hit that.
I see... Hm. I guess you would have to scale different drawings / draw different sized ones for other targets / simulate them? Other thing to do would be much harder ( let your game scale them for the target it is on . )
I am unsure how to help with the screen resolution problem...
"calculating par" seems to take a bit longer now, but does not interrupt music playback anymore.
My music playback is still stopping nearing the end of the game. Also, after a couple seconds that the music stopped , I got a '" Data abort at 01F979D8 (0) '"
Above is normal playback conditions ( No EQ, or pitch setting at limit )
Now then, with EQ & Pitch at its limit ( in the debug screen my processor is 100% 80MHz )
Music playback not stopping when "calculating par"
Seems playable still
Music still sometimes stopping nearing the end of the game...
I will test it out more later with EQ & Pitch at limit.
Scrolling quits the game? How do you change the selected colour? Running the scripts I linked in my earlier comments and posting the results would help me to understand what's going on here :).
About the 'Data abort' crash, if you can reproduce it, could you write the entire message to this thread? I can make it happen if I run a lua script to use up all the player's memory, but I'm not sure why this would happen after calculate_par has executed. When you ran into the error did you continue playing after the music stopped? If so -and you can make the data abort thing happen consistently-, could you just leave the player and see if it 'data aborts' without you having to do anything. I suspect there may be a memory leak somewhere in the lua plugin/rockbox port. Could you also run the third 'test script' i've got in my opening comment in this thread: http://forums.rockbox.org/index.php/topic,27120.msg177434.html . Finally, what version of rockbox are you running?
Thanks again, you're very helpful :).
Yes, scrolling exits the game on a sansa e200, I think it is the ' safe exit ' button you talked about. It does load the game back up after I scroll. I accidently keep hitting it when pressing the select ( middle ) button.
The button is the middle for for changing colors. It isn't anything that you have done =) I just keep hitting the safe exit button by accident. ^^
It happened randomly...I am not sure if I could reproduce it... But I do know what I did to get there , yes.
No, I do not think I could resume that game.
I shall try leaving it to see if there is a memory leakage.
I am running the latest, 3.7.1 rockbox
I will see what numbers pop up? =)
Music , gotcha ^^
@Gabriel Thanks for that. The enumeration is quite different to mine, i'll see if I can work out why that is, and if it suggests anything.
With RB.yield easy , medium & hard mode , normal playback & EQ , pitch at limit ( cpu 90% to 100% )
without RB.Yield ( same tests )
With new script you told me to include...( same tests )
I can post what tests I did...
with RB.yield ( summary )
Easy Mode: Takes 6 - 9 seconds to calculate par , No problems...music does not stop.
Medium: Takes 28 to 39 sec to calculate par... Music playback stops frequently nearing end of game ( 1 to 6 more moves to make to end game )
Hard : About a minute to calculate par...
@Gabriel Thanks for that. The enumeration is quite different to mine, i'll see if I can work out why that is, and if it suggests anything.
@Gabriel: Are you using a customized version of RB? I searched the entire source tree and can't find any mention of the 'ACTION_KBD_SCROLL_BACK' action, which is what your build seems to be expecting when you scroll the wheel.
It's still strange as the patch only interferes with this specific script... are you using rb.actions namespace to get the wheel events, or using integers directly (like I did on the return values for do_menu on my contacts script - still waiting for feedback!).
I'll try with the official build in the next days (currently I can't connect my iPod to my computer) and post the results, as well as the outputs for output-codes and dump-action-codes scripts.
Sorry for making you spend time fixing non-existing bugs... although I'm yet to know if the problem also occurs on the official build. I'd be nice to have another nano2g user leaving his/her feedback.
I could make scrolling work better probably by using a different action context (other than keyboard), unfortunately this means I can't use the menu button.
Looking forward to your results :).
I like the game a lot, it's a good time waster (in the good sense). I'm now going to modify it in order to work with my custom build...
I'll reply here when I test it.
Will it be included by default?
But if you really want to improve it, you could:
- optimize the part calculation algorithm: it's currently slow and I often beat it. I'm sure that basing it on perimeter rather than area (at least at the beginning of the game), would make it much smarter.
- include a «music playback» item in the game menu. A lot of other games have this option, and I find it very practice.
Thanks for this game with helps me when I'm bored in the subway
Much less features. Maybe some bugs. Please test and report bugs...
The playback menu thing isn't exposed to the Lua plugin at present, I'd need to add it.
I tried out your version, it's obviously a lot faster, and the par algorithm gives better results. A couple of issues:
1. The par and moves run off my screen even when I make the font very small. The way I did it in mine was by truncating the Moves/Par text until all of the number shows (see the draw_status function).
2. You have a rounding error when drawing the board due to CELL_SIZE being a double I think. This means on my screen (Fuze v2) you see lots of black lines through the board at random intervals.
Are you interested in refining your version to the extent to which I've brought mine, or were you just looking to have a better algorithm for your opponent? I'd be happy to help a bit if you're interested in extending your code. If not, I'll continue getting my Lua version tested and merged.
The playback menu thing isn't exposed to the Lua plugin at present, I'd need to add it.
I tried out your version, it's obviously a lot faster, and the par algorithm gives better results. A couple of issues:
1. The par and moves run off my screen even when I make the font very small. The way I did it in mine was by truncating the Moves/Par text until all of the number shows (see the draw_status function).
2. You have a rounding error when drawing the board due to CELL_SIZE being a double I think. This means on my screen (Fuze v2) you see lots of black lines through the board at random intervals.
Are you interested in refining your version to the extent to which I've brought mine, or were you just looking to have a better algorithm for your opponent? I'd be happy to help a bit if you're interested in extending your code. If not, I'll continue getting my Lua version tested and merged.
If you want to “help a bit”, can you please help me implementing the "save game" feature ?
No essential feature lacks now. But I still need to correct the bug that appears when LCD_HEIGHT is not a multiple of SIZE...