Lua Player for PSP

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

Shine wrote:I've setup a webpage for Lua Player. I hope the screenshots of Lowser and the upcoming game by VgSlag are ok. Write me a PM, if you like a link to your webpage.
Great! I'm working on prettifying Lowser now... I added a site of my own for Lowser at http://ncoder.nevyn.nu/lowser/ .

(That VgSlag stuff looks awesome!)


LuaPlayer stuff:
Can you change so that when an error occurs, the LuaPlayer waits for a keypress, and then refetches script.lua from disk and plays it? It's a tad bit annoying restarting LuaPlayer for every debug run... It's probably more user friendly, too.
emumaniac
Posts: 79
Joined: Sun May 08, 2005 12:22 am

Post by emumaniac »

ahh thats great news that you have set up pages for both Lua Player and Lowser, anychance of having a small news section to say whats new etc :)
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

nevyn wrote: LuaPlayer stuff:
Can you change so that when an error occurs, the LuaPlayer waits for a keypress, and then refetches script.lua from disk and plays it? It's a tad bit annoying restarting LuaPlayer for every debug run... It's probably more user friendly, too.
i was also looking for something like this but if you cant do it, its ok

another question that I had was is there any guides on converting from say.. c++ to lua (noob question i know) but i was just looking for major changes.

alright thank you very much shine for providing this, me (being a noobish coder for psp) can program :)

also is there a way to test the code on my computer before putting it on psp? thx
LiquidIce
Posts: 55
Joined: Mon Apr 04, 2005 1:15 am
Contact:

Post by LiquidIce »

This is the first debug release of my South Park Robotron Game for the PSP.

It is packaged for a 1.5 PSP, otherwise put the script.lua and all of the .PNG files into your Lua directory.

Press the start button to start the game.

Dpad moves Cartman up/down/left/right
Triangle,Cross,Square,Circle shoots cheezy poofs in different directions
Kill the Kennys to get points.

When your health goes to 0 the game ends.

If you want to play again, restart Lua

I am still having trouble with my loops. It seems like each time I shoot the game gets slower. The source code is included if you want to take a look or use part of it in your own game. The hitTest function might be useful if you want to test to see if one graphic intersects another.

Here are some pics:

Image

Image

Image

I am still working out some of the bugs. I have a lot more planned for this game including: better text, sound, different enemies with different flight paths, and new weapons.

Let me know what you think. Thanks for all of the help I've gotten here! These forums are such a great wealth of knowledge.

Download the South Park Robotron Beta:
http://s45.yousendit.com/d.aspx?id=18B7 ... O9BIPP1RN9
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

Hi Shine,

I've been working on removing any copyrighted gfx from my game, all gfx are now in.

I'm still having issues with my engine getting stuck on walls but will look at it today. ALso speed is still slow for me but I'll ask you about that when I upload a version.

Here is how it looks at the moment :)

Image

G
Slopey
Posts: 24
Joined: Sun Jul 31, 2005 8:13 pm

Post by Slopey »

Managed to get my head round most of it now thanks to the examples above :)

Is there any way to test out the script on the PC? Copying to the PSP and running through the menus to test stuff is getting a little tedious! ;) I've tried it with the PBP emulator, but no joy.
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

Slopey wrote:Managed to get my head round most of it now thanks to the examples above :)

Is there any way to test out the script on the PC? Copying to the PSP and running through the menus to test stuff is getting a little tedious! ;) I've tried it with the PBP emulator, but no joy.
I have a card reader, so I just launch LuaPlayer, run my app, test it, eject the card and mount it in the computer and replace the files, and then launch my app from within myself. Well, that's only possible because my app is an app launcher... It could work for others, too, if the below fix was added to LuaPlayer.

I've been looking at the LuaPlayer sources, and it looks possible to patch up to relaunch the script after a crash by replacing line 101 in main.c:

Code: Select all

runScript("script.lua");
with

Code: Select all

sceCtrlData pad, newpad;
while(true) {
    runScript("script.lua");
    sceCtrlReadBufferPositive(&pad, 1);
    sceCtrlReadBufferPositive(&newpad, 1);
    debugOutput("Press any key to restart Lua Player", 35)
    while(pad.Buttons != newpad.Buttons) {
        sceCtrlReadBufferPositive(&newpad, 1);
        sceDisplayWaitVblankStart()
    }
    initGraphics();
}
I haven't tried this, because I don't have the toolchain installed...
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

Ok,

The basic engine is done, you can't leave the room yet, I'll work on that when it's running better.

D-pad left/right and X to jump, Triangle to take a screenshot.

This is where I need your help, am I doing the rendering correctly? Am I messing up my blitting which is making it not run very fast or is this the limit of the Lua player currently?

I haven't included the EBOOT in the rar.
http://www.flash-git.net/pyramidPanic.rar

Just incase you're interested I'm porting my phone game, Pyramid Panic, to Lua.

You can see some screenshots here:

Image
Image
Image
Image

G
LiquidIce
Posts: 55
Joined: Mon Apr 04, 2005 1:15 am
Contact:

Post by LiquidIce »

If it was possible to restart the script, and do USB file transfers from within Lua, then LuaPlayer is my new best friend. If I understand correctly, samples are in the svn which show how to activate the USB for file transfers. Can we make those function calls into a Lua function?
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

Agreed, that functionality would speed up dev time no end.
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

has anyone been able to get lua to work in pspe...can't seem to get it started for some reason..heres the error code im getting
load D:\psp stuff\pspe\ms0\PSP\GAME\SOFT1\EBOOT.PBP
PBP format
illegal address
PC = 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
[/quote]
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

VgSlag: nice game! Just remove the loop in line 430 and it is lightning fast. And perhaps you should take a look at the tiling concept from the Snake game instead of using 100 PNG images :-)

Slopey: I'm working on a PC version, but I don't have much time beside my work, so a first version will be released perhaps this weekend. I want to release it for Windows, Mac and Linux at the same time, so it could take a bit longer. With a initGraphics(width, height, optional fullscreen) function it would be a nice environment for games on PC and Mac, too.

For the behaviour on errors I think it would be good to provide a function, which can control what to do, perhaps:

- silent restart the game
- just exit
- error message with the options to exit or to restart

BTW: I haven't tried it, but looks like the Lua docu says, that a Lua loader could load a script within a function, which is called with pcall to catch errors, which are returned as multiple return values.
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

Shine, wow!

I realise now that I was waiting for vblank everytime i call that func and was looping 4 times so it was 4x slower than needs to be yeah?

It looks so amazing running fast!

I had all my tiles cut up from my other version of the game and have a level editor already built in Flash so I'll keep it as tiles for the moment.

Thanks for all this! :)

I'm updating the rar on my site in a second to have a loop removed but slower than full speed version :)
Evil Inside
Posts: 17
Joined: Thu Jul 21, 2005 4:42 am

Post by Evil Inside »

Holy crap guys, great work. These games look awesome.

This is going to expand the PSP homebrew scene dramatically.

Shine, reading that you are releasing a PSP development tool for Mac OS makes me scream like a little girl. Can you include a tool to make 1.5 packages with hidden corrupt files? There are currently no Mac OS tools to do this that I am aware of.

I can't wait to play around with the new version.
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

New version is up, running full speed! I even had to slow it down.

I've added animated tiles, only torches are in at the moment but I'm going to be doing the lava too.

I haven't included the EBOOT in the rar.
http://www.flash-git.net/pyramidPanic.rar

G
Slopey
Posts: 24
Joined: Sun Jul 31, 2005 8:13 pm

Post by Slopey »

Many thanks Shine, I wait the PC version with bated breath :) (luckily I'm away until next week so I won't be able to do anything until then anyway).

Anyways - I've finally knocked up a test dungeon crawler to test out a few ideas for a game I want to do (a Bards Tale clone) in Lua. Basic screenie:

Image

Not bad for an hours work, and I'm quite liking Lua. One day I'll learn C++, one day!!
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

VgSlag wrote:New version is up, running full speed! I even had to slow it down.

I've added animated tiles, only torches are in at the moment but I'm going to be doing the lava too.

I haven't included the EBOOT in the rar.
http://www.flash-git.net/pyramidPanic.rar

G
Looks good :) Nice fluid movement! Some nitpicks: Mario-style, jump heights can be varied by holding the button; in your game, jumps is of a fixed height, which feels awkward... Also, if you hold the jump button, he keeps jumping when hitting the ground, also non-expected behavior...

If you want Lowser compatibility, name your script file index.lua and put an icon.png in there ;) (you could of course have two copies of the file, a script.lua and an index.lua, to keep compatibility with Lowser-less users...) Oh, and the possibility to quit the game would be nice, too...
Slopey wrote:One day I'll learn C++, one day!!
Don't bother, if you'd like to stay sane :P
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

can someone please tell me why this simple code wont draw a background? i keep getting a crc error.

(i am just playing around at the moment to try to get a background to show..)
background = loadImage("background.png")
fillBackground(0, 0, 480, 272)

green = getColorNumber(0, 255, 0)

printText(200, 100, "testing 1,2,3", green)

flipScreen()
thanks
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

fillBackground is not supported any more in Lua Player 0.5 (you should update from my webpage). CRC error looks like a corrupted PNG image. This should work (assuming a valid PNG image) :

Code: Select all

background = loadImage("background.png")
blitImage(0, 0, background)

green = getColorNumber(0, 255, 0)

printText(200, 100, "testing 1,2,3", green)

flipScreen()
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

thanks shine, i had interlaced the image when i saved it so it caused an error.

im making a game where you have to hit a button a certain number of times within a certain limit to win (simple but im just trying to make something that works before i move onto something bigger and better)
emumaniac
Posts: 79
Joined: Sun May 08, 2005 12:22 am

Post by emumaniac »

any chance of a release of some of these new Lua games :) with eboots ;)
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

emumaniac, mine so far is just an engine.

I need to add enemies, a "goal" and build levels.
I've recently split up with my girlfriend so have some free time at weekends now, I'll be working on mine this saturday and maybe Thursday evening.

Once I have a full level up I'll do a soft release of something.

G
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

what does

libpng warning: Incomplete compressed datastream in iccp chunk
libng warning: Profile size field missing from iccp chunk

mean?

thanks:)
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

SnowSurfer wrote:what does

libpng warning: Incomplete compressed datastream in iccp chunk
libng warning: Profile size field missing from iccp chunk

mean?
Looks like your program, with which you created the PNG images, creates not 100% valid PNG images. Can you post one of your image? If the warnings can be ignored, perhaps I can disable it, but I need a sample to reproduce the error.
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

yeah heres one i used, i did it with photoshop cs...and when it asked if i wanted them interlaced or not i said no

http://www.members.cox.net/snowsurfns/background.png
http://www.members.cox.net/snowsurfns/presstart.png

i also used the icons for buttons from the button match program, I am going to try and make my own and see if that is the problem

edit!!!!

ok i got it to work, it was the button pictures from the button match program, i made my own buttons and low and behold it works fine..

i put the bad pictures in a handy zip for you to look at

http://www.members.cox.net/snowsurfns/Buttons.zip
alex_dsnews
Posts: 13
Joined: Wed Aug 03, 2005 9:48 pm

Post by alex_dsnews »

I haven't tried 0.5 yet of LuaPlayer, but I'm surprised my buttons don't work in it - they were done in Photoshop 5.5... Any ideas?
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

your guess is as good as mine, i was surprised they didnt work either..

side note: shine in your main program code you start it with "while true do" while what is true exactly? or is that just your way of starting it irregardless of condition?

i can get things to work that I put in that section of code, but if I try to print something on the screen (text) it wont print

while true do
green = getColorNumber(0, 255, 0)
printText(300, 100, "test", green)
blitImage(0, 0, background)
blitImage(200, 100, nextbutton)
flipScreen()
end
thanks
VgSlag
Posts: 43
Joined: Thu Jun 30, 2005 5:36 pm

Post by VgSlag »

Does:

Code: Select all

while true do 
green = getColorNumber(0, 255, 0) 
blitImage(0, 0, background) 
blitImage(200, 100, nextbutton) 
printText(300, 100, "test", green) 
flipScreen() 
end
Work?
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

SnowSurfer wrote:i put the bad pictures in a handy zip for you to look at

http://www.members.cox.net/snowsurfns/Buttons.zip
When downloading, the file size is 0 bytes. But I've updated the Lua Player to version 0.6, now it should not print warning messages when loading PNG images. It is a bugfix release, only, no new features.
alex_dsnews wrote: I haven't tried 0.5 yet of LuaPlayer, but I'm surprised my buttons don't work in it - they were done in Photoshop 5.5... Any ideas?
I don't have a magic crystal ball, so post the image or I can't help :-) But perhaps it is interlace, which is currently not supported.
SnowSurfer wrote: side note: shine in your main program code you start it with "while true do" while what is true exactly? or is that just your way of starting it irregardless of condition?
Yes, this is a common practice in programming for an endless loop. "while" runs the body, if the expression is true and "true" is always true.
SnowSurfer wrote: i can get things to work that I put in that section of code, but if I try to print something on the screen (text) it wont print
Take a look at your source again and try to visualize step-by-step what the interpreter does while executing your program.

Edited: And you should always add a waitVblankStart() before flipScreen(), unless you know what you do, otherwise it will flicker and the Home button don't work.
SnowSurfer
Posts: 21
Joined: Fri Jul 08, 2005 2:59 am

Post by SnowSurfer »

hmm i wonder why they zip didnt work.

i used the waitvblankstart() (thanks shine) along with printing the text message after bliting the images and it printed the text. thanks vgslag

so it worked. ok back to coding :)

edit: zip should work now if you still want to look shine, i ran out of space on my webserver and it didnt upload right the first time sorry

edit2: how do we concatinate? when printing text, i tried doing it with a '+' sign but it said "attempt to perform aritmitect on string value"

edit3: concatination is done using a ..

code example "printText(50, 50,"Hit the " .. nextbuttonpic, red)"

yes im answering my own questions but it may help someone instead of me keeping it to myself
Post Reply