forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lua Player for PSP
Goto page Previous  1, 2, 3, 4, 5 ... 10, 11, 12  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
alex_dsnews



Joined: 03 Aug 2005
Posts: 13

PostPosted: Thu Aug 04, 2005 1:37 am    Post subject: Reply with quote

The button images definately weren't interlaced, and they definately worked using your first version of the player that you posted here.

Odd.

edit: Embedded colour profile - that'll be it, then.
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Thu Aug 04, 2005 2:13 am    Post subject: Reply with quote

SnowSurfer wrote:
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


I was able to reproduce the warning message with Lua Player 0.5 and with Lua Player 0.6 it works, even with the images which causes a warning, because version 0.6 ignores the warnings.
Back to top
View user's profile Send private message
27Bstroke6



Joined: 07 Jul 2005
Posts: 23

PostPosted: Thu Aug 04, 2005 2:32 am    Post subject: Reply with quote

The Lowser doc specifies that pressing START should exit from the current running script. This doesn't seem to work for me (using Lowser 0.5). Any clues? Thanks.
Back to top
View user's profile Send private message
SnowSurfer



Joined: 08 Jul 2005
Posts: 21

PostPosted: Thu Aug 04, 2005 4:17 am    Post subject: Reply with quote

deleted for google

Last edited by SnowSurfer on Fri Jul 09, 2010 12:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Thu Aug 04, 2005 5:23 am    Post subject: Reply with quote

SnowSurfer wrote:
how do i get a timer to work so it counts down 60seconds on an interval of 1 second at a time?

the code im using just counts down really really really fast..

any ideas? thanks again :)


waitVblankStart has an optional parameter and since the VSync frequency on PSP is 60 Hz, you can use waitVblankStart(60) for 1 second delay.

I know, it should be better documented, but someone wrote me, that he is already working at a small tutorial and I'll setup a dedicated domain with forum etc. for Lua Player, when I have some time (I want to use it for my own games on PC, too).
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 5:25 am    Post subject: Reply with quote

27Bstroke6 wrote:
The Lowser doc specifies that pressing START should exit from the current running script. This doesn't seem to work for me (using Lowser 0.5). Any clues? Thanks.


Where does it say that? You can do it manually, however, by breaking out of your main loop like so:

Code:
while true do
    ... (your app code)
    if isCtrlStart(pad) then-- assumes that you have done pad = ctrlRead()
        break
    end
end


---------------------------

SnowSurfer wrote:
how do i get a timer to work so it counts down 60seconds on an interval of 1 second at a time?

the code im using just counts down really really really fast..

any ideas? thanks again :)


From the documentation:
Documentation wrote:
void waitVblankStart([int count])

Wait for next Vblank start. If you specify a count parameter, it waits multiple times for Vblank start. This can be used for delays, for example 60 for a one seconds delay.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Laurens



Joined: 28 Jun 2005
Posts: 14

PostPosted: Thu Aug 04, 2005 5:26 am    Post subject: Reply with quote

You could use

void waitVblankStart(60) - this should wait 1 second.
_________________
If a beautiful girl tells you she's done some modeling work in the past, and you ask her what 3D software she used, you might be a gamedeveloper.
Back to top
View user's profile Send private message MSN Messenger
Nils



Joined: 03 Aug 2005
Posts: 16

PostPosted: Thu Aug 04, 2005 5:37 am    Post subject: Reply with quote

Great work Shine on the Lua player :)
I started to toy around with it, even if documentation on lua.org website is really bad.
Development is easy, but one looses too much time sending to psp / testing / reconnecting psp resending...

I ended up testing bits of my code on weblua (http://doris.sourceforge.net/lua/weblua.php) in order to have a quick small debuger.

I wondered, and i saw it has been asked already, if you would include a rotation feature for png ? Like the Flash one, object._rotation = angle. A handy feature ...

I'll port i guess one of my Flash games to Lua. I talked a bit with VgSlag, and it seems that Lua for the PSP is kinda the "Flash" of the psp, in many aspects. Lua is fast enough on the PSP to let us do virtually any 2D games.

Keep up the good work !
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 5:38 am    Post subject: Sound and music Reply with quote

I've ported Jim Shaw's port of mikmod for use with LuaPlayer. With this, any mod file (xm, s3m, mod, mad, ...) can be played as background music, and any wav file can be played as a sound effect (with stereo panning, changeable frequency and volume).

There's a major bug in it now though, that disables the playing of wav files. If you want to try out just the music part, or if you want to help with the bug, here's the modified luaplayer code (with compiled eboot):
http://ncoder.nevyn.nu/psp/LuaPlayer_mikmod_TEST.zip
Bug description in KNOWN-BUGS. If you want to compile, read "README.linking-with-mikmod". If you want to hear a good tune, install luaplayer and luaplayer% on your psp and launch Music Test from Lowser.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kinsman



Joined: 18 Jul 2005
Posts: 15
Location: Canada

PostPosted: Thu Aug 04, 2005 7:13 am    Post subject: Re: Sound and music Reply with quote

nevyn wrote:
I've ported Jim Shaw's port of mikmod for use with LuaPlayer. With this, any mod file (xm, s3m, mod, mad, ...) can be played as background music, and any wav file can be played as a sound effect (with stereo panning, changeable frequency and volume).

There's a major bug in it now though, that disables the playing of wav files.


Cool! I went and set the Pyramid Panic demo to some music :)

I think I see the problem of the sound bug. When Shine set up his image handles, he didn't use the value of the pointer as his handle - instead he wrapped the image in an array of 'Image' structs and used the index of the array as his handle. Try setting up something similar for sounds and see what happens.
Back to top
View user's profile Send private message
SnowSurfer



Joined: 08 Jul 2005
Posts: 21

PostPosted: Thu Aug 04, 2005 7:36 am    Post subject: Reply with quote

deleted for google

Last edited by SnowSurfer on Fri Jul 09, 2010 12:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
VgSlag



Joined: 30 Jun 2005
Posts: 43

PostPosted: Thu Aug 04, 2005 8:00 am    Post subject: Reply with quote

Snow:

Relational expressions
Relational operators are supplied which return the boolean values true or false.

== equal to
~= not equal to
< less than
> greater than
<= less than or equal to
>= greater than or equal to

This came from:
http://lua-users.org/wiki/ExpressionsTutorial

Kins:

Cool, I've already got some sound fx and eery music that a friend made for me for the Flash version of Pyramid Panic.

Shine:

Will nevyn's port of milkmod get put into the offical player?


Last edited by VgSlag on Thu Aug 04, 2005 8:09 am; edited 1 time in total
Back to top
View user's profile Send private message
Kinsman



Joined: 18 Jul 2005
Posts: 15
Location: Canada

PostPosted: Thu Aug 04, 2005 8:06 am    Post subject: Reply with quote

VgSlag wrote:

Shine:

Will kins port of milkmod get put into the offical player?


nevyn's :)
Back to top
View user's profile Send private message
VgSlag



Joined: 30 Jun 2005
Posts: 43

PostPosted: Thu Aug 04, 2005 8:08 am    Post subject: Reply with quote

Sorry, my mistake, will edit the original;

Snow:
Code:

timerout=0
timer=60
red = getColorNumber(255, 0, 0)
while timerout < 60 do
   waitVblankStart(60)
   timerout=timerout+1
   clear(0);
   printText(100, 50, "Timer: " .. timerout, red)
   flipScreen()
end
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 8:16 am    Post subject: Re: Sound and music Reply with quote

Kinsman wrote:
nevyn wrote:
I've ported Jim Shaw's port of mikmod for use with LuaPlayer. With this, any mod file (xm, s3m, mod, mad, ...) can be played as background music, and any wav file can be played as a sound effect (with stereo panning, changeable frequency and volume).

There's a major bug in it now though, that disables the playing of wav files.


Cool! I went and set the Pyramid Panic demo to some music :)

I think I see the problem of the sound bug. When Shine set up his image handles, he didn't use the value of the pointer as his handle - instead he wrapped the image in an array of 'Image' structs and used the index of the array as his handle. Try setting up something similar for sounds and see what happens.


They're both numbers. I don't see what the difference is. Anyhow, I tried it at least, but it doesn't work. soundfile is /still/ being reported as a nil value. I just don't get it.

The sound is definitely loaded, I can see the ms light flash for a second, and no errors are reported from anywhere. Lua keeps getting a nil value even though I'm explicitly pushing a number.

Now that I think about it though, I have never... Oh holy CRAP what a stupid mistake. Perhaps if I read the manual now and then...
You have to return the number of arguments that you have pushed as the function return value. D'OH! I thought that stuff was automatic. Now that's working. I have to fix some new bugs, then it's ready to go.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SnowSurfer



Joined: 08 Jul 2005
Posts: 21

PostPosted: Thu Aug 04, 2005 8:32 am    Post subject: Reply with quote

deleted for google

Last edited by SnowSurfer on Fri Jul 09, 2010 12:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 9:15 am    Post subject: LuaPlayer with Mikmod done! Reply with quote

Hooray! It works! Music, sounds, panning, frequencies, everything :)

Check out the package:
http://ncoder.nevyn.nu/psp/LuaPlayer_mikmod.zip

Binary "nice" package:
http://ncoder.nevyn.nu/Lowser/Lowser_bundle_0.12.zip

Interface:
Code:
loadAndPlayMusicFile(filename, bool loop)
stopAndUnloadMusic()
Sound loadSound(filename) - ONLY MONO, stereo will crash your PSP
unloadSound(sound)
Voice playSound(sound)
stopSound(voice)
setVoiceVolume(voice) - 0-255
setVoicePanning(voice) - 0-255, 128 is center
setVoiceFrequency(voice), 0-44000
bool musicIsPlaying()
bool voiceIsPlaying(voice)


Example in luaplayer/Applications/Music Test/index.lua
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kinsman



Joined: 18 Jul 2005
Posts: 15
Location: Canada

PostPosted: Thu Aug 04, 2005 10:37 am    Post subject: Re: LuaPlayer with Mikmod done! Reply with quote

nevyn wrote:
Hooray! It works! Music, sounds, panning, frequencies, everything :)



So far, so good. I added Mario jumping noises to the Pyramid Panic demo :)

The sound is playing awfully quietly. I don't think it's a library problem, since you're using a sample-playing function, and the background music is drowning out the sound effects.

When you play the sound effect, I see you're setting the panning straight away - would setting the volume straight away have an effect?

Also, where can I find a copy of the mikmod library? I can't seem to find it in PSPSDK, or in the toolchain.
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 10:49 am    Post subject: Re: LuaPlayer with Mikmod done! Reply with quote

Kinsman wrote:
nevyn wrote:
Hooray! It works! Music, sounds, panning, frequencies, everything :)



So far, so good. I added Mario jumping noises to the Pyramid Panic demo :)

The sound is playing awfully quietly. I don't think it's a library problem, since you're using a sample-playing function, and the background music is drowning out the sound effects.

When you play the sound effect, I see you're setting the panning straight away - would setting the volume straight away have an effect?

Also, where can I find a copy of the mikmod library? I can't seem to find it in PSPSDK, or in the toolchain.


Hmm. In my Music Test, I set the volume to 255 when I start the sample. You're right, that sample is playing pretty quietly... I could provide a function to lower the music volume. Yeah, I think I'll add that... Check back in an hour.

As for the mikmod library, see
http://forums.ps2dev.org/viewtopic.php?t=2540
and
http://ncoder.nevyn.nu/psp/mikmodlib.zip (ugly repack)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kinsman



Joined: 18 Jul 2005
Posts: 15
Location: Canada

PostPosted: Thu Aug 04, 2005 11:27 am    Post subject: Re: LuaPlayer with Mikmod done! Reply with quote

I'm about to head for bed, but I hunted through the mikmod source code and found something in mdriver.c, lines 26-28:

Code:
UBYTE md_volume         = 96;       /* Global sound volume (0-128) */
UBYTE md_musicvolume    = 128;      /* volume of song */
UBYTE md_sndfxvolume    = 128;      /* volume of sound effects */


Maybe you can fiddle with the global variables - turn up the master volume a bit, then turn down the music volume until it sounds about right compared to the sound effects.

I expected to see md_musicvolume turned up much higher than md_sndfxvolume based on the behaviour I was seeing, but oh well.

I don't think it'd be good to have the sound quiet all around - players would have to turn their PSP volume up to hear a Lua game, then turn it down again when moving to something else..
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 11:32 am    Post subject: Re: LuaPlayer with Mikmod done! Reply with quote

Kinsman wrote:
I'm about to head for bed, but I hunted through the mikmod source code and found something in mdriver.c, lines 26-28:

Code:
UBYTE md_volume         = 96;       /* Global sound volume (0-128) */
UBYTE md_musicvolume    = 128;      /* volume of song */
UBYTE md_sndfxvolume    = 128;      /* volume of sound effects */


Maybe you can fiddle with the global variables - turn up the master volume a bit, then turn down the music volume until it sounds about right compared to the sound effects.

I expected to see md_musicvolume turned up much higher than md_sndfxvolume based on the behaviour I was seeing, but oh well.

I don't think it'd be good to have the sound quiet all around - players would have to turn their PSP volume up to hear a Lua game, then turn it down again when moving to something else..


One step ahead of you ;)

http://ncoder.nevyn.nu/psp/LuaPlayer_mikmod.zip
http://ncoder.nevyn.nu/lowser/Lowser_bundle_0.12.zip

Both are updated with the following lua functions:

setMusicVolume(arg) -- 0-128
setSFXVolume(arg) -- 0-128
setReverb(arg) -- 0-15 ( 0 = no reverb)
setPanSep(arg) -- 0-128 ( 0 = mono, 128 = full separation)


I have also changed the initial volume values:
md_volume = 128;
md_musicvolume = 96;
md_sndfxvolume = 128;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kinsman



Joined: 18 Jul 2005
Posts: 15
Location: Canada

PostPosted: Thu Aug 04, 2005 9:04 pm    Post subject: Re: LuaPlayer with Mikmod done! Reply with quote

Tried it out - got an error; 'tried to reference setGlobalVolume (a nil value)'.

Not sure what it could be, and don't have time at the moment to check..
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 9:12 pm    Post subject: Re: LuaPlayer with Mikmod done! Reply with quote

Kinsman wrote:
Tried it out - got an error; 'tried to reference setGlobalVolume (a nil value)'.

Not sure what it could be, and don't have time at the moment to check..


There is no such function, "setGlobalVolume"... Only setMusicVolume and setSFXVolume. I don't see the reason for setting the mikmod global volume programatically; there's the psp global volume that the user can adjust him/herself.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
VgSlag



Joined: 30 Jun 2005
Posts: 43

PostPosted: Thu Aug 04, 2005 10:14 pm    Post subject: Reply with quote

nevyn, have you spoke to shine abou tadding this to the official release?
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 10:18 pm    Post subject: Reply with quote

VgSlag wrote:
nevyn, have you spoke to shine abou tadding this to the official release?


Yeah, it'll be added to the official release. Oobles mailed me and gave me cvn commit access! So if it's okay with Shine, I'll be adding it myself :)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SnowSurfer



Joined: 08 Jul 2005
Posts: 21

PostPosted: Thu Aug 04, 2005 10:20 pm    Post subject: Reply with quote

deleted for google

Last edited by SnowSurfer on Fri Jul 09, 2010 12:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
VgSlag



Joined: 30 Jun 2005
Posts: 43

PostPosted: Thu Aug 04, 2005 10:34 pm    Post subject: Reply with quote

nevyn, that's brilliant news!

I bought some sounds for the phone version of my game and my friend that does music made me some.

I'm going to source or make a jumping sound and add some rooms over the weekend. Will up a new version on Sunday.

Will all functionality remain the same when it gets added to the official version?
Back to top
View user's profile Send private message
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 10:35 pm    Post subject: Reply with quote

SnowSurfer wrote:
is there anyway that i can have two different functions running at the same time such as my timer needs to be running (and counting down) while the game is being played..

if i put it in a new function and call it, the game wont show up.

if i put it in the main game code it will just hang on the timer until the time is up.




There are two ways of doing stuff simultaneously. Either you do it little-by-little in the main loop, or you thread it. The first one is way simpler.

Code:
timeout = 0
while timeout < (60 * 60) do -- 60 seconds times framerate
    timeout = timeout + 1
    clear(0)
    printText(100,50,"Timer: ".. 60 - timeout/60, red)
    [ anything else your app would want to do in this frame ]
    waitVblankStart()
    flipScreen()
end


Threads in Lua is called coroutines, but those are probably way out of your league...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nevyn



Joined: 31 Jul 2005
Posts: 136
Location: Sweden

PostPosted: Thu Aug 04, 2005 10:40 pm    Post subject: Reply with quote

VgSlag wrote:
nevyn, that's brilliant news!

I bought some sounds for the phone version of my game and my friend that does music made me some.

I'm going to source or make a jumping sound and add some rooms over the weekend. Will up a new version on Sunday.

Will all functionality remain the same when it gets added to the official version?


Looking forward to the new version of your game!

I think the interface is all okay, I don't know what Shine thinks of it though. If I were to add it now it'd be identical, except for one thing: the freeSound() doesn't belong in lua since it's a garbage collected environment and shouldn't be needed. I'll have to read up on garbage collection to fix that, though... For now, just never mind freeSound() and be content that theoretically, your sound will be automatically freed sometime.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SnowSurfer



Joined: 08 Jul 2005
Posts: 21

PostPosted: Thu Aug 04, 2005 10:42 pm    Post subject: Reply with quote

nevyn im reading about coroutines in the wiki right now

it is...interesting to say the least
http://lua-users.org/wiki/CoroutinesTutorial

i am going to try what you said when i get home from breakfast, thanks for the help.

edit: yeahhhhhhhhhh! it works, thanks nevyn :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Goto page Previous  1, 2, 3, 4, 5 ... 10, 11, 12  Next
Page 4 of 12

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group