| View previous topic :: View next topic |
| Author |
Message |
VgSlag
Joined: 30 Jun 2005 Posts: 43
|
Posted: Tue Aug 09, 2005 3:21 pm Post subject: |
|
|
Thanks shine, I'll update my game at lunch time at work and add some sounds to it then up a new version.
G |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Tue Aug 09, 2005 9:38 pm Post subject: |
|
|
http://haggar.pocketheaven.com/preview.zip <- Updated for the new API.
Don't post news about this updated Dr. Mario though (if any psp news site ppl are watching) ;) |
|
| Back to top |
|
 |
VgSlag
Joined: 30 Jun 2005 Posts: 43
|
Posted: Tue Aug 09, 2005 10:14 pm Post subject: |
|
|
| I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop? |
|
| Back to top |
|
 |
SnowSurfer
Joined: 08 Jul 2005 Posts: 21
|
Posted: Wed Aug 10, 2005 12:19 am Post subject: |
|
|
| nice work shine, are you still chugging away on the program so we can run lua scripts on the computer to test instead of uploading it to my psp everytime? |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Wed Aug 10, 2005 12:29 am Post subject: |
|
|
| SnowSurfer wrote: | | nice work shine, are you still chugging away on the program so we can run lua scripts on the computer to test instead of uploading it to my psp everytime? |
That would be nice.
And um... would be nice with music/sound pause. |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Wed Aug 10, 2005 12:36 am Post subject: |
|
|
| VgSlag wrote: | | I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop? |
I guess you could do this:
| Code: | if not mysound:playing() then
mysound:play()
end |
hm... or maybe not |
|
| Back to top |
|
 |
VgSlag
Joined: 30 Jun 2005 Posts: 43
|
Posted: Wed Aug 10, 2005 12:39 am Post subject: |
|
|
I didn't see that listed in the functions.txt.. only said it was available for Music and voice.
Will give it a shot incase they missed it out.
EDIT: Sorry, I think I was misreading the file. |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Wed Aug 10, 2005 12:41 am Post subject: |
|
|
| VgSlag wrote: | | I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop? |
Hmm... Mikmod has the ability, I'll have to write a wrapper. Gimme a while.
If you want to do it with the current API, it's possible with a loop:
| Code: | sound = Sound.load("whatever.wav")
voice = sound.play()
while true do
game loop...
if not voice:playing() then
voice = sound:play()
end
end |
Note the distinction between the data of a soundfile and a currently playing voice (sort of an "instance" of a sound)
Can't do music pausing, sorry. It's a bug in mikmod. [Edit: Or maybe.... If I... Hmm... I'll look into it.]
Sound pausing, I'll look into it. |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Wed Aug 10, 2005 12:47 am Post subject: |
|
|
| nevyn wrote: | | VgSlag wrote: | | I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop? |
Hmm... Mikmod has the ability, I'll have to write a wrapper. Gimme a while.
If you want to do it with the current API, it's possible with a loop:
| Code: | sound = Sound.load("whatever.wav")
voice = sound.play()
while true do
game loop...
if not voice:playing() then
voice = sound:play()
end
end |
Note the distinction between the data of a soundfile and a currently playing voice (sort of an "instance" of a sound)
Can't do music pausing, sorry. It's a bug in mikmod. [Edit: Or maybe.... If I... Hmm... I'll look into it.]
Sound pausing, I'll look into it. |
They added mikmod to psp media center I think, and you can pause the music there... Maybe you could take a look at the media center code or something? if they've released the source that is... |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Wed Aug 10, 2005 12:51 am Post subject: |
|
|
| nevyn wrote: | | Code: | sound = Sound.load("whatever.wav")
voice = sound.play()
while true do
game loop...
if not voice:playing() then
voice = sound:play()
end
end |
|
This is not a good idea, because if you want to play "looped" sounds, you will hear a gap between two plays. If Mikmod supports it, this should be used and called from Lua. |
|
| Back to top |
|
 |
VgSlag
Joined: 30 Jun 2005 Posts: 43
|
Posted: Wed Aug 10, 2005 12:54 am Post subject: |
|
|
I've got it working with the above code but you have your true and false mixed up that the function returns.
voice:playing() returns true when it's not playing, and false when it is or at least it seems that way.
With:
| Code: |
-- Has the sound finished?
if sound_torch_playing:playing() == false then
-- Yes, restart it
sound_torch_playing = sound_torch:play()
end
|
The above causes the sound to keep starting over itself where as:
| Code: |
-- Has the sound finished?
if sound_torch_playing:playing() == true then
-- Yes, restart it
sound_torch_playing = sound_torch:play()
end
|
The above makes it work.
G |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Wed Aug 10, 2005 2:14 am Post subject: |
|
|
I agree with Shine, my solution isn't exactly beautiful. There's no actual need to resort to these hacks anyway, as the release version of 0.7 WILL contain code to properly loop sounds.
Edit: Yes, I saw the bug with Sound:playing(), it'll be fixed... (forgot to negate a result)
Edit again: I managed to ugly-hack past the mikmod bug to allow pausing through Music.pause() and Music.resume(). Next up: pausing and looping of samples... |
|
| Back to top |
|
 |
VgSlag
Joined: 30 Jun 2005 Posts: 43
|
Posted: Wed Aug 10, 2005 7:24 am Post subject: |
|
|
Nicwe one Nev... wasn't hassling, just saying. I realise it's a nightmare when people start mentioning bugs with a beta release :)
Cheers for your work Nev and Shine. |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Wed Aug 10, 2005 7:45 am Post subject: |
|
|
| VgSlag wrote: | Nicwe one Nev... wasn't hassling, just saying. I realise it's a nightmare when people start mentioning bugs with a beta release :)
Cheers for your work Nev and Shine. |
That's exactly what beta releases are for, so no worries :P Thanks for your feedback, it's very helpful :) If any more bugs crop up, please tell! |
|
| Back to top |
|
 |
indianajonesilm
Joined: 08 Feb 2005 Posts: 15
|
Posted: Wed Aug 10, 2005 8:06 am Post subject: |
|
|
Hello all! I'm attempting to make an air hockey game, but I've noticed a small problem with my paddles. Sometimes they appear corrupted when I start the game.
It happens about once every four times I start the game. I was wondering if it's something I'm doing wrong. Any advice would be appreciated. Thank you.
Here is a normal screen shot:
Here is the script and stuff:
http://webpages.charter.net/aldanafx/stuff/psp_air_hockey.zip
P.S.
Thank you Shine and all who are contributing to Lua Player, I'm having so much fun learning to program. Thanks again. |
|
| Back to top |
|
 |
emumaniac
Joined: 08 May 2005 Posts: 79
|
Posted: Wed Aug 10, 2005 8:43 am Post subject: |
|
|
| im a major air hockey fan, cant wait for a fully playable version :) |
|
| Back to top |
|
 |
the-dan
Joined: 21 Jul 2005 Posts: 7
|
Posted: Wed Aug 10, 2005 9:37 am Post subject: |
|
|
hah nice indianajoneslim. for some reason i noticed that it locked up for a second with the controls and wouldnt move briefly, maybe a sound locking issue who knows.. but speaking of sound i like it, especially the yahoo! all this lua stuff makes me want to get back into it hehe. keep it up man =D also, would there be hard slap shots that would knock the disc/puck off the table? that could be some interesting play lol
- Dan |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Wed Aug 10, 2005 10:41 am Post subject: |
|
|
Updated luaplayer at the repository. 0.7b7 adds music and sample looping, and music pausing and resuming. I tried sample pausing, but the resuming would crash the psp. Without a debugger, I don't feel like giving that one another try...
(It's hard to find time over to write code after my girlfriend came over for an extended visit :P I plan to fix Lowser tomorrow though, and add usb mode to Lowser... I have a great idea for a new Lowser interface, having a Dasher-like UI using the analog stick. Wish I had time to implement it...) |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Wed Aug 10, 2005 8:35 pm Post subject: |
|
|
| Are there any way to rotate text 90 degrees right or left? I'm thinking about doing some vertical games and stuff. |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Wed Aug 10, 2005 9:16 pm Post subject: |
|
|
| MikeHaggar wrote: | | Are there any way to rotate text 90 degrees right or left? I'm thinking about doing some vertical games and stuff. |
Nope, not at the moment, sorry... I'd like to add rotozooming, but graphics is not my department... *makes a hinting gesture towards Shine* :P |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Wed Aug 10, 2005 10:26 pm Post subject: |
|
|
| MikeHaggar wrote: | | Are there any way to rotate text 90 degrees right or left? I'm thinking about doing some vertical games and stuff. |
Thanks for this idea, there were some bugs which prevented you from doing this in Lua, so a new version can be downloaded, where these bugs are fixed and the changes from Nevyn are included: luaplayer-0.7b7.zip
Now it is possible to write your rotate function in Lua without problems, see the rotate.lua in the samples folder.
 |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Wed Aug 10, 2005 11:10 pm Post subject: |
|
|
| indianajonesilm wrote: | | Hello all! I'm attempting to make an air hockey game. |
I sorta dislike rigid movement, so I couldn't help but to add acceleration to your game :P Hope you like it :)
(Lowser-adapted it while at it, too)
http://ncoder.nevyn.nu/psp/pspairhockey.zip |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Thu Aug 11, 2005 12:36 am Post subject: |
|
|
Some more Lua for fun
| Code: |
-- change this to select the view area
depth = 32
x0 = -0.65
y0 = -0.7
x1 = -0.5
y1 = -0.6
-- some nice palette
palette = {}
for i=0,depth do
b = math.floor(i / depth * 1024)
if b > 255 then
b = 255
end
g = math.floor((i - depth / 3) / depth * 1024)
if g > 255 then
g = 255
end
if g < 0 then
g = 0
end
r = math.floor((i - depth / 3 * 2) / depth * 1024)
if r > 255 then
r = 255
end
if r < 0 then
r = 0
end
palette[i] = Color.new(r, g, b)
end
palette[depth-1] = Color.new(0, 0, 0)
-- draw mandelbrot fractal
w = 480
h = 272
image = Image.createEmpty(w, h)
dx = x1 - x0
dy = y1 - y0
for y=0,h-1 do
for x=0,w-1 do
r = 0; n = 0; b = x / w * dx + x0; e = y / h * dy + y0; i = 0
while i < depth-1 and r * r < 4 do
d = r; r = r * r - n * n + b; n = 2 * d * n + e; i = i + 1
end
image:pixel(x, y, palette[i])
end
screen:blit(0, 0, image)
screen.waitVblankStart()
screen.flip()
end
screen:save("screenshot.tga")
while true do
screen.waitVblankStart()
end
|
This needs some 2 minutes to draw the picture, because it is not optimized, but it is worth the time:
 |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Thu Aug 11, 2005 1:44 am Post subject: |
|
|
| Shine wrote: |
Now it is possible to write your rotate function in Lua without problems, see the rotate.lua in the samples folder.
|
Big thanks! |
|
| Back to top |
|
 |
jambox
Joined: 11 Aug 2005 Posts: 3
|
Posted: Thu Aug 11, 2005 6:37 am Post subject: |
|
|
edit: oops, double post
Last edited by jambox on Thu Aug 11, 2005 6:39 am; edited 1 time in total |
|
| Back to top |
|
 |
jambox
Joined: 11 Aug 2005 Posts: 3
|
Posted: Thu Aug 11, 2005 6:38 am Post subject: |
|
|
| nevyn wrote: | | Updated luaplayer at the repository. 0.7b7 ... I plan to fix Lowser tomorrow though, and add usb mode to Lowser... |
I tried the included 1.5 eboots and, although I'm not sure if I set it up right, was unable to load the Lowser script. Is that normal? The error is: attempt to call global 'getColorNumber' (a nil value).
I wasn't sure if that's expected with this version or not. (This is my first time to try Lua Player.) |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Thu Aug 11, 2005 6:44 am Post subject: |
|
|
| jambox wrote: | | nevyn wrote: | | Updated luaplayer at the repository. 0.7b7 ... I plan to fix Lowser tomorrow though, and add usb mode to Lowser... |
I tried the included 1.5 eboots and, although I'm not sure if I set it up right, was unable to load the Lowser script. Is that normal? The error is: attempt to call global 'getColorNumber' (a nil value).
I wasn't sure if that's expected with this version or not. (This is my first time to try Lua Player.) |
This is entirely expected. The 0.7b7 is, as you can tell by the 'b', a beta. Lowser isn't updated to work with the new version yet. I recommend that, if you just want to try out LuaPlayer, you download version 0.6 from www.frank-buss.de/luaplayer/ . The non-beta version of 0.7 will be out in a few days. |
|
| Back to top |
|
 |
jambox
Joined: 11 Aug 2005 Posts: 3
|
Posted: Thu Aug 11, 2005 7:21 am Post subject: |
|
|
| nevyn wrote: | | jambox wrote: | | nevyn wrote: | | Updated luaplayer at the repository. 0.7b7 ... I plan to fix Lowser tomorrow though, and add usb mode to Lowser... |
I tried the included 1.5 eboots and, although I'm not sure if I set it up right, was unable to load the Lowser script. Is that normal? The error is: attempt to call global 'getColorNumber' (a nil value).
I wasn't sure if that's expected with this version or not. (This is my first time to try Lua Player.) |
This is entirely expected. The 0.7b7 is, as you can tell by the 'b', a beta. Lowser isn't updated to work with the new version yet. I recommend that, if you just want to try out LuaPlayer, you download version 0.6 from www.frank-buss.de/luaplayer/ . The non-beta version of 0.7 will be out in a few days. |
Great! Thanks for the quick response. I'm looking forward to getting back into programming (even if it is the easy route :).. |
|
| Back to top |
|
 |
nevyn
Joined: 31 Jul 2005 Posts: 136 Location: Sweden
|
Posted: Thu Aug 11, 2005 7:34 am Post subject: |
|
|
I've updated Lowser to work with the new API. Activate USB mode by pressing L inside Lowser.
Everything seems to be in order now... Should we release this as the real 0.7?
btw shine, love that song you have in Snake! Jeoren Tel rocks :) |
|
| Back to top |
|
 |
Soban
Joined: 06 Aug 2005 Posts: 14
|
Posted: Thu Aug 11, 2005 7:59 am Post subject: |
|
|
| For some reason there's a typo in graphics.c line 22 of the latest commit. It's trivial to fix, but annoying. |
|
| Back to top |
|
 |
|