Lua player core development

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

Moderators: Shine, Insert_witty_name

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

Lua player core development

Post by Shine »

Ok, this is the thread for the C-side of the Lua Player and for ideas for the API. I think the next thing to implement is the PhysicsFS, which allows you to pack all your game resources in one zip file. Laurens wants to do this. Together with Nevyn's Lowser, it simplifies the deployment and makes the player more safe, because it can't write and read everywhere any more, which is a good idea, if it will be ported to other platforms, like PC and Mac.
Last edited by Shine on Mon Dec 05, 2005 3:14 am, edited 2 times in total.
Laurens
Posts: 14
Joined: Tue Jun 28, 2005 10:26 pm

Post by Laurens »

I've been working at this. Unfortunately, it's not a question of just recompiling it for the psp. So, I need to port it. I've been hard at work at it, and I think I'm about 1/3rd done.

I'm about to head off to a 1-week holiday, so I'll be back in the land of the Internet at the 22nd of August. So, more news after that!
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.
XRS
Posts: 32
Joined: Sun May 15, 2005 7:09 pm

Post by XRS »

Cool, i´ll wait to try that "C-Side" cause i know something about C :P
Keep up the good work!
liquid8d
Posts: 66
Joined: Thu Jun 30, 2005 6:29 am

Post by liquid8d »

I had mentioned previously but don't know how high a priority it might be.. I'd like to see some network implementation in there..
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

XRS wrote:Cool, i´ll wait to try that "C-Side" cause i know something about C
I meant the Lua Player itself, which is written in C, there will be no C script support, which is executed by the Lua Player. But if you know C, you can help with the base, too.
liquid8d wrote:I had mentioned previously but don't know how high a priority it might be.. I'd like to see some network implementation in there..
It is not very high on my priority list, I'm wating until the network support is more complete in the PSPSDK, then it will be easier, but feel free to implement it yourself and I'll integrate it in Lua Player. PhysicsFS is more important and I would like to have affine transformation for image blitting and vector graphics.
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

liquid8d wrote:I had mentioned previously but don't know how high a priority it might be.. I'd like to see some network implementation in there..
Dude, it's coming. Patience. John_K is working on a standard BSD sockets interface. When he's done, networking should be just a few hours' hacking away. (Networking is /my/ top priority ;) )
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

I think there's something wrong with the colors when you do a screen:clear.

Check this:
http://haggar.pocketheaven.com/fade.lua.txt

Left and Right = Change Red value
Square and Circle = Change Blue value
L and R-Trigger = Change Green value
Analogue Left and Right = Change Alpha
Select = Change between FillRect and ScreenClear

If you press Select and then change a color value, like Red, then it gets weird. And how does the alpha work?
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

How about adding system:beep(int,int)?
Plays the sound of a beep of a specified frequency and duration through the "console speaker".

Some kind of sound that simulates PC-like beep.

Then one can get some kind of sound without adding wave files and stuff ;)
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

MikeHaggar wrote:How about adding system:beep(int,int)?
Plays the sound of a beep of a specified frequency and duration through the "console speaker".

Some kind of sound that simulates PC-like beep.

Then one can get some kind of sound without adding wave files and stuff ;)
Yes, this is a good idea. I've tested wave generation in this thread and the slow part is the wave write function, but the sample generation is very fast. I think a new function Sound.new(table) for mono sounds and Sound.new(table, table) for stereo sounds would be nice.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

MikeHaggar wrote:I think there's something wrong with the colors when you do a screen:clear.
Yes, there was a bug. Using black worked, but every other color could cause problems. I've fixed this in version 0.9.
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

Ok :)
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

The Crateria Scroller doesn't work with the stormtrooper image any more. It used to work in 0.8.


And with Music.playFile you can't give it full path to filename like ms0:/psp/music/1.xm, but you have to do a System.currentDirectory(ms0:/psp/music/) to get it to work.
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

Hmm... How about adding image:fillEllipse?
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

MikeHaggar wrote:Hmm... How about adding image:fillEllipse?
There was talk about adding libArt, which would bring all primitives as vector graphics.
Laurens
Posts: 14
Joined: Tue Jun 28, 2005 10:26 pm

Post by Laurens »

Hi guys, I'm sorta back from my holiday. I do have some work to pick up & a deadline to make, (and to read 2 weeks worth of svn commits ;)), so it will be 1st of september before I can continue on PSP development, but I'm very eager to continue with the porting of physfs! Talk to you soon!
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.
KaL
Posts: 41
Joined: Sun Apr 03, 2005 9:59 pm

Post by KaL »

LuaGL ?
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

KaL wrote:LuaGL ?
Yes, I'm working on this. Currently the first triangle is spinning:

Image

Below is the code. I've used luaglut for it, which allows to programs with OpenGL calls which looks nearly the same as in C, but there are still problems integrating the 2D Lua Player functions with pspgl, which I'm using as the backend, because some OpenGL functions are missing, but the pspgl team is working on it.

Really nice is the fast turnaround time: When I enable USB, I can change the OpenGL source, save it and one hit on "start" reloads it. This is faster than in normal C/C++ IDEs, where you have to recompile it and helps me a lot for testing and learning OpenGL :-)

Code: Select all

white = Color.new(255, 255, 255)
glViewport(0, 0, 480, 272)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(75, 16/9, 0.5, 1000)
glShadeModel(GL_SMOOTH)
glMatrixMode(GL_MODELVIEW)
	
angle = 0
while true do
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
	glLoadIdentity()
	gluLookAt(0, 0, 2.5, 0, 0, 0, 0, 1, 0)
	glRotatef(angle, 0, 0, 1)
	
	glBegin(GL_TRIANGLES)
		glColor3f(1, 0, 0)
		glVertex3f(-2, -2, 0)
		glColor3f(0, 1, 0)
		glVertex3f(2, -2, 0)
		glColor3f(0, 0, 1)
		glVertex3f(0, 2, 0)
	glEnd()
	glFlush()
	
	angle = angle + 0.5
	screen:print(0, 0, "current angle: " .. angle, white)
	
	if angle == 100 then screen:save("opengl.png") end
	screen.waitVblankStart()
	screen.flip()

	if Controls.read():start() then break end
end
chaos
Posts: 135
Joined: Sun Apr 10, 2005 5:05 pm

Post by chaos »

nice...
Chaosmachine Studios: High Quality Homebrew.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

what about a image:scale() ?
may enable some nice zoom-out/in effects

greets
PS: or is there already a workaround?
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

LuMo wrote:what about a image:scale() ?
may enable some nice zoom-out/in effects

greets
PS: or is there already a workaround?
As Nevyn already wrote:
There was talk about adding libArt, which would bring all primitives as vector graphics.
libArt can be found at http://www.levien.com/libart/ . I don't know the details of the library, but looks like the way to go. Perhaps there is already a Lua wrapper for it somewhere? I didn't checked all Google results for "libart lua", perhaps it must be written from scratch. Then we have to design a nice Lua interface to libart first and someone with some time has to implement it :-)
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

i would help, but i can't get the psptoolchain set up properly
tried and failed multiple (even with following the steps in tutorials exactly)
maybe i get me a linux guru to help ;)
greets
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

LuMo wrote:i would help, but i can't get the psptoolchain set up properly
tried and failed multiple (even with following the steps in tutorials exactly)
maybe i get me a linux guru to help ;)
greets
This is the wrong thread for general PSP SDK talk. Ask in the PSPSDK forum instead. (Oh, and actually supplying the error you get/the specific problem you have would help, too)
alinear
Posts: 5
Joined: Tue Sep 06, 2005 2:27 pm
Location: Brooklyn, NY, USA
Contact:

Post by alinear »

Firstly very nice work on LuaPlayer. I've been using it to experiment a bit, and it is a quite nice and rapid way to develop or prototype on PSP.

Wanted to offer some 2 cents on the sound (mikmod) implementation. I worked with a variation of mikmod ages ago on Nintendo64 (produced music for some commercial N64 games, got the engine working on there with the help of its original author - Jean Paul Mikkers).

It would be nice to have some more control over XM playback via mikmod, especially:

- The ability to set the volume for, or mute/unmute individual channels in a playing multitrack module (mod/xm/s3m/etc.). This is nice for doing dynamic music mixing... having music that mixes voices in and out to match gameplay or screen events.

- Use of reverse/bidirectional loops is fairly handy and in some cases critical for XM playback support. It saves a lot of memory/rom to be able to engineer samples with bidirectional looping enabled.

- The ability to set callback(s) from within the (playing) music file(s). For example, setting a callback on the start of each pattern, or the start of each pattern step, or on specific effects bytes values being passed in the pattern channels is handy for synchronizing visual events to music or doing things like making music-oriented games. It would also make it very easy to synch a 'sound effects' based realtime/dynamic sequencer with a 'music' based background sequencer.

- The ability to trigger a specific pattern in a music file to play (instead of play from start). This is handy for using patterns to define sound effects or short musical pieces all stored in a single tracker music file... handy way to leverage a small bank of sample data into a lot of different sounds or cues.

I also look forward to anything you manage to get working with openGL in Luaplayer. On the graphics side it would certainly be handy to have rotation, blending, blend modes (additive, subtractive, overlay, etc.), and so on.

Again -- great work!
haust
Posts: 25
Joined: Sat Oct 01, 2005 12:37 am
Location: France

Post by haust »

Shine, Nevyn do you plan to have some kind of features set for a Lua Player v1.0 or will you just add features as they come and use version number just to say "hey new release" ??

vh
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

is it possible that the svn-path changed from
svn://svn.ps2dev.org/pspware/LuaPlayer/
to
svn://svn.ps2dev.org/pspware/trunk/LuaPlayer
? (hope this is the right one)

further two more questions...
- A recent version of opoo's PSP toolchain `
^^^^ also possble with windows sdk? anyone tested?
- zlib, libpng, liblua, liblualib, mikmodlib
where can i svn those? (i am browsing the ps2dev-svn server for quite a time, without luck)
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

LuMo wrote:is it possible that the svn-path changed from
svn://svn.ps2dev.org/pspware/LuaPlayer/
to
svn://svn.ps2dev.org/pspware/trunk/LuaPlayer
? (hope this is the right one)
/pspware/trunk/LuaPlayer is the right one, was never at /pspware/LuaPlayer.
LuMo wrote: further two more questions...
- A recent version of opoo's PSP toolchain `
^^^^ also possble with windows sdk? anyone tested?
What's "windows sdk"? I'm using Cygwin and update it all the time from svn, when something important changes (I'm subscribed to the SVN mailinglist).
LuMo wrote: - zlib, libpng, liblua, liblualib, mikmodlib
where can i svn those? (i am browsing the ps2dev-svn server for quite a time, without luck)
Try psp/Trunk from http://svn.pspdev.org/ .
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

hmm then there is a mistake in: Readme (LuaPlayer Core developers).txt [luaplayer-source v.10]
Acquisition and build
============================
% svn checkout svn://svn.ps2dev.org/pspware/LuaPlayer/
with windows sdk i mean PSPide C++ (by milhouse)

will try cygwin again

thanks for your help
will check cygwin now, and check back afterwards
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Ref: Shine's OpenGL script to spin a triangle found in this thread.

Attempted to run the script on either Win or PSP but I got error msg:
"error: index.lua:2: attempt to call global `glViewport' (a nil value)"

Is openGL really implemented to LP? If so, which version?

Thanks.
Geo Massar
Retired Engineer
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

not in .10 i guess shine tested this on a nightly build on his comp.
note: its about 7 hours later and toolchain is still running *WOAH*
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

IT IS DONE (after 9hours!!!)

for now all went fine...
sucessfully compiled the following packages with make and make install:
  • libpng
    lua
    mikmod
    mikmodlib
    zlib
after that i tried to compile LuaPlayer... failed!

gave me the following error message:
| sp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/luaplayer.o src/luaplayer.c
src/luaplayer.c:9:17: error: lua.h: No such file or directory
src/luaplayer.c:10:20: error: lualib.h: No such file or directory
src/luaplayer.c:11:21: error: lauxlib.h: No such file or directory
In file included from src/luaplayer.c:13:
src/luaplayer.h:53: error: syntax error before '*' token
src/luaplayer.h:57: error: syntax error before '*' token
src/luaplayer.h:58: error: syntax error before '*' token
src/luaplayer.h:59: error: syntax error before '*' token
src/luaplayer.h:60: error: syntax error before '*' token
src/luaplayer.h:61: error: syntax error before '*' token
src/luaplayer.h:63: error: syntax error before '*' token
src/luaplayer.c:16: error: syntax error before '*' token
src/luaplayer.c:16: warning: type defaults to 'int' in declaration of 'L'
src/luaplayer.c:16: warning: data definition has no type or storage class
src/luaplayer.c: In function 'runScript':
src/luaplayer.c:20: warning: implicit declaration of function 'lua_open'
src/luaplayer.c:20: warning: assignment makes pointer from integer without a cas
t
src/luaplayer.c:23: warning: implicit declaration of function 'luaopen_io'
src/luaplayer.c:24: warning: implicit declaration of function 'luaopen_base'
src/luaplayer.c:25: warning: implicit declaration of function 'luaopen_table'
src/luaplayer.c:26: warning: implicit declaration of function 'luaopen_string'
src/luaplayer.c:27: warning: implicit declaration of function 'luaopen_math'
src/luaplayer.c:28: warning: implicit declaration of function 'luaopen_loadlib'
src/luaplayer.c:38: warning: implicit declaration of function 'luaL_loadfile'
src/luaplayer.c:40: warning: implicit declaration of function 'luaL_loadbuffer'
src/luaplayer.c:43: warning: implicit declaration of function 'lua_pcall'
src/luaplayer.c:43: error: 'LUA_MULTRET' undeclared (first use in this function)
src/luaplayer.c:43: error: (Each undeclared identifier is reported only once
src/luaplayer.c:43: error: for each function it appears in.)
src/luaplayer.c:46: warning: implicit declaration of function 'printf'
src/luaplayer.c:46: warning: incompatible implicit declaration of built-in funct
ion 'printf'
src/luaplayer.c:46: warning: implicit declaration of function 'lua_tostring'
src/luaplayer.c:46: warning: format '%s' expects type 'char *', but argument 2 h
as type 'int'
src/luaplayer.c:47: warning: implicit declaration of function 'lua_pop'
src/luaplayer.c:49: warning: implicit declaration of function 'lua_close'
make: *** [src/luaplayer.o] Error 1
[UPDATE] Lua did not compile ok
had to force it:
make -f Makefile.psp
make install -f Makefile.psp
now i am getting new errors :/
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/luaplayer.o src/luaplayer.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/luacontrols.o src/luacontrols.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/luagraphics.o src/luagraphics.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/luasound.o src/luasound.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/luasystem.o src/luasystem.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/utility.o src/utility.c
bin2c src/auxiliary/boot.lua boot.c bootString
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/main.o src/main.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -c -o src/framebuffer.o src/framebuffer.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -fno-strict-aliasi
ng -L. -L/usr/local/pspdev/psp/sdk/lib src/graphics.o src/sound.o src/luaplay
er.o src/luacontrols.o src/luagraphics.o src/luasound.o src/luasystem.o src/util
ity.o src/main.o src/framebuffer.o -llua -llualib -lpng -lz -lpspgu -lm -lmikmod
-lmmio -lpspaudiolib -lpspaudio -lpspusb -lpspusbstor -lpsppower -lpspdebug -lp
spdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -lpspkernel -o luaplayer.elf
/usr/local/pspdev/lib/gcc/psp/4.0.1/../../../../psp/lib/liblua.a: could not read
symbols: Archive has no index; run ranlib to add one
collect2: ld returned 1 exit status
make: *** [luaplayer.elf] Error 1
any ideas?
TIA
Lumo
Last edited by LuMo on Sun Oct 02, 2005 7:41 pm, edited 1 time in total.
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Post Reply