|
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
View previous topic :: View next topic |
Author |
Message |
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Thu Jun 15, 2006 10:28 pm Post subject: PS2 Lua Player |
|
|
Now that we have a recent (5.1) and functional lua interpreter running on the PS2 (still have few minor issues but they will be corrected in the next few days), it would be great to see coming a PS2 Lua player ! Aiming to enjoy on our beloved black box those nice lua games available today "only" on the PSP.
Having reviewed a bit the PSP player, I noticed that there is no abstraction layer with all the "system calls", meaning that a script will not be able to run both on PS2 or PSP.
So I would appreciate if interested people (if there is any) could give their feedback/idea(s) for the implementation of a PS2 player :)
Hoping to see you soon here...
evilo.
NB : for those interested lua is in the svn repository
http://svn.ps2dev.org/listing.php?repname=ps2&path=%2Ftrunk%2Fps2sdk-ports%2Flua%2F&rev=0&sc=0
Last edited by evilo on Sun Aug 13, 2006 11:04 am; edited 1 time in total |
|
Back to top |
|
|
tmator_
Joined: 10 Jun 2006 Posts: 9
|
Posted: Thu Jun 15, 2006 11:59 pm Post subject: |
|
|
i'm ready to start ps2luaplayer |
|
Back to top |
|
|
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Fri Jun 16, 2006 2:16 am Post subject: |
|
|
Well, one would need to have multiple ways to run the LUA script files, hopefully with USB Stick/HDD support, so one doesn't have to burn 100's of CD's everytime to debug ;) |
|
Back to top |
|
|
tmator_
Joined: 10 Jun 2006 Posts: 9
|
Posted: Fri Jun 16, 2006 3:01 am Post subject: |
|
|
there is network to debug on ps2 ;) |
|
Back to top |
|
|
SSpeare
Joined: 23 May 2006 Posts: 63
|
Posted: Fri Jun 16, 2006 10:41 pm Post subject: |
|
|
I think it will be too hard (or impossible) as evilo has mentioned to support PSP LuaPlayer scripts on the PS2. Also, the capabilities of both machines are so different, a different interface is really needed.
So, what we need to do is start by defining what functionality we'd like to see in a Lua 4 PS2 and then figuring out how to get there. We can post suggestions here and then maybe use a Wiki to really fill out the API.
Simple beginning:
2d drawing operations (2d sprites, blitting, etc)
3d drawing operations (3d objects, rotations & translations, camera, etc)
pad input (multitap support)
sound (music, sfx)
?? |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Fri Jun 16, 2006 11:49 pm Post subject: |
|
|
In my opinion (making a very quick analysis), and seeing the PSP lua player implementation, main parts are :
* luaplayer : This is the player itself, I would recommend just loading script by host in the first time, then once we'll have a first stable version, we'll add others possibilities (usb, hdd or whatever)
* luacontrols : This can be easily ported to PS2, functions name are independent of the target machine (without mentioning that buttons names are almost identical). Only one pad support could be coded in a first time.
* luasound : The PSP version is based on mikmodlib, we could also use it. It gives the advantage of some portability for this part and if I'm not wrong, someone was working on porting it to the ps2 (I'll check with him), so the work is already half done.
* luagraphics : Functions names can be maintained, however there is a huge work to be done here. Here we have two choices :
- SDL (that relies on gsKit), that already implements most of the needed features (sprite managing, blitting, font, etc....)
- gsKIt, surely better to use it directly, as using SDL would add an additional layer (lua script -> luagraphics-> SDL -> gsKit -> GS)
* luatimer : This can be recoded easily as well. Additionally ntba has coded a timer library (that contains missing time functions from the ps2sdk : http://www.ntba2.de/?p=libps2time) so we just need to plug it in.
* luawlan : no wlan support in the PS2, but we could add network play, would be even nice to be able to interconnect lua on the psp through wifi and lua on the ps2 through network.
* lua3d : I don't know yet... but gsKit is the key as for the luagraphics, this can be done in a second step.
* luasystem : this part has to be reviewed completely...
Speaking about priority for a first step, I would say :
1. luaplayer (loading from host)
2 .luacontrols (only 1 pad support)
3. luagraphics (as complete as possible)
4. luasound (mikmodlib)
5. luatimer (in case it's really needed by games in a first time).
Second step :
- enhance previous points :
- add lua3d, luawlan (-> lualan), luasystem,etc..
I would also suggest to everyone participating to agree on a first simple game, and to concentrate on the first features needed to get it running.
Evilo.
Last edited by evilo on Sat Jun 17, 2006 3:57 am; edited 2 times in total |
|
Back to top |
|
|
SSpeare
Joined: 23 May 2006 Posts: 63
|
|
Back to top |
|
|
Drakonite Site Admin
Joined: 17 Jan 2004 Posts: 989
|
Posted: Sat Jun 17, 2006 6:15 am Post subject: |
|
|
evilo wrote: |
* luacontrols : This can be easily ported to PS2, functions name are independent of the target machine (without mentioning that buttons names are almost identical). Only one pad support could be coded in a first time.
|
I don't know much about how luacontrols is setup... but this part should be pretty easy to do... I think aiming to have support for up to four players should be the goal. I have some code for pad that looks really good, but I'll have to see if I can use it or not..
evilo wrote: |
* luagraphics : Functions names can be maintained, however there is a huge work to be done here. Here we have two choices :
- SDL (that relies on gsKit), that already implements most of the needed features (sprite managing, blitting, font, etc....)
- gsKIt, surely better to use it directly, as using SDL would add an additional layer (lua script -> luagraphics-> SDL -> gsKit -> GS)
|
I'd highly recommend going with gskit and staying away from SDL. Along with removing an extra layer it would also give a big speed boost, as unless someone has done some major work on it, SDL does all graphics in software (which is quite slow!) _________________ Shoot Pixels Not People!
Makeshift Development |
|
Back to top |
|
|
SSpeare
Joined: 23 May 2006 Posts: 63
|
Posted: Sat Jun 17, 2006 7:14 am Post subject: |
|
|
Here's what I have done (but it needs to be formed into a nice API):
input:
lp2ReadInput() - updates the state of all the pads
pads - this global variable has the number of pads plugged in
pad[x] - this contains the state of pad x at the last update.
pad[x].SELECT - true/false whether SELECT button was pressed
-- etc for START, LEFT,RIGHT,UP,DOWN, CROSS,CIRCLE,TRIANGLE,SQUARE, R1,R2,R3,L1,L2,L3
pad[x].RJOY_V - value of joystick access between 0-255 (127 is center)
-- etc for RJOY_H, LJOY_V, LJOY_H
normJoyAxis(value) - lua helper function that converts analog stick data into the range [-1,1] with a dead zone between 92 - 162 (based on some tests with different joysticks)
3d:
lp2BeginScene(r,g,b) - sets up the beginning of a frame
lp2MatrixMode(LP2.PROJECTION) - set Matrix Mode to LP2.PROJECTION or LP2.MODELVIEW (like OpenGL)
lp2LoadIdentity() - load identity into current matrix
lp2Perspective(fov, aspect, znear, zfar)- multiply current matrix by the perspective matrix defined
lp2Rotate(angle, x,y,z) - angle and x,y,z vector to rotate current matrix around
lp2Translate(x,y,z) - Translates current matrix by given amount.
lp2PushMatrix() - push current matrix
lp2PopMatrix() - pop current matrix
lp2WaitVSync() - Wait for a VSync
lp2EndScene(r,g,b) - End the scene and clear the screen (clears screen on PS2, renders vertex queues)
lp2RenderBuffers(verts, vertArray, colorArray, points, pointArray) - renders buffers of vertices and colors in the triangles specified by pointArray.
lp2Begin(LP2.TRIANGLES) - begin rendering vertices as triangles
lp2End() - finished rendering vertices
lp2Vertex(x,y,z) - x,y,z of vertex to render
lp2Color(r, g, b) - r,g,b of vertex to render
I also have a character animation/rendering class built in Lua and a model exporter for Blender that current only exports meshes. Working on skeleton and animation exporting.
Big TODOs are texturing and animation support.
But, all this will need reworked into reusable components for others.
Oh, and the whole thing runs in OpenGL and is mostly identical to the PS2. |
|
Back to top |
|
|
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sat Jun 17, 2006 11:32 pm Post subject: Re: PS2 Lua Player ? |
|
|
evilo wrote: | Now that we have a recent (5.1) and functional lua interpreter running on the PS2 (still have few minor issues but they will be corrected in the next few days), it would be great to see coming a PS2 Lua player ! |
This is a good idea.
evilo wrote: |
Having reviewed a bit the PSP player, I noticed that there is no abstraction layer with all the "system calls", meaning that a script will not be able to run both on PS2 or PSP.
|
There is some kind of abstraction layer: For the Windows player I've just emulated all the needed PSP functions. But you are right, maybe it would be better to create a more high level abstraction layer. One idea would be to seperate more cleanly the Lua part and the implementation part, like in luagraphics.cpp and graphics.cpp. The driver then is graphics.cpp, only.
I don't have a PS2 any more, is an OpenGL implementation available for it? I ask becaus I want to change the graphics part to OpenGL, emulating all current luagraphics functions with OpenGL. This should be even faster for some operations, like fillRect and image blitting, when caching multiple images in VRAM as a texture. And then it would be easier to port it to other platforms, e.g. PS3 and MacOSX. |
|
Back to top |
|
|
daurnimator
Joined: 11 Dec 2005 Posts: 38 Location: melbourne, australia
|
Posted: Fri Jun 30, 2006 2:49 am Post subject: |
|
|
has anyone gotten further on this?
whos working on it? |
|
Back to top |
|
|
SSpeare
Joined: 23 May 2006 Posts: 63
|
Posted: Fri Jun 30, 2006 3:18 am Post subject: |
|
|
I've got some code that implements parts of this. But, I've been involved in packing and moving and I don't have my PC set up again. Hopefully I'll get it up some time this weekend and start refactoring what I've got into a more library-esque distribution.
That, and I need to figure out how to get my updates into svn since I don't have an internet connection at home. |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Fri Jun 30, 2006 3:41 am Post subject: |
|
|
Hi,
I'm working on it, together with tmator and sspeare !
I've been off these last days, but I started to make a skeleton of the ps2 player, and started working on the control part.
tmator has been working on the mikmodlib, that is used on the psp for all the sound stuff, so we plan to use it as well for the PS2 (dunno if he finally got it working). The plan beeing to be as close as possible of the PSP one, in order to give some kind of interoperability between the two players :)
if you want to join, you're welcome. As soon as I'll have a first clean skeleton with a few things inside maybe i'll put it into svn if other are working on it as well.
regards,
evilo. |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Tue Jul 04, 2006 8:27 pm Post subject: |
|
|
Just to give a quick update on the project : I now have LuaControls library implemented.
I know that it's not so much, and that there is nothing to make a big fuzz about, but this is a first step done for the player :)
now I'm able to run this kind of script :
Code: |
-- A very simple pad test script
print("Lua pad test program by evilo", "Press buttons for testing")
while true do
-- screen.waitVblankStart()
pad = Controls.read()
if pad:circle() then
print("circle pressed")
end
if pad:cross() then
print("cross pressed")
end
if pad:triangle() then
print("triangle pressed")
end
if pad:square() then
print("square pressed")
end
if pad:select() then
print("select pressed")
end
if pad:start() then
print("start pressed")
end
if pad:up() then
print("up pressed")
end
if pad:down() then
print("down pressed")
end
if pad:left() then
print("left pressed")
end
if pad:right() then
print("right pressed")
end
if pad:l1() then
print("l1 pressed")
end
if pad:r1() then
print("r1 pressed")
end
if pad:l2() then
print("l2 pressed")
end
if pad:r2() then
print("r2 pressed")
end
if pad:l3() then
print("l3 pressed")
end
if pad:r3() then
print("r3 pressed")
end
end
|
drakonite: right now, there is support for one pad only (port 0, slot 0), later i think to add a new function Controls.read(pad number) in order to use the others.
next step is the graphic part with LuaGraphics (using gsKit).
cheers ! |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Thu Jul 13, 2006 6:01 am Post subject: |
|
|
A little hello from LuaPlayer on the PS2 :)
Code: |
green = Color.new(0, 255, 0)
screen:print(200, 100, "Hello World!", green)
for i=0,20 do
x0 = i/20*479
y1 = 271-i/20*271
screen:drawLine(x0, 271, 479, y1, green)
end
screen.flip()
while true do
screen.waitVblankStart()
end
|
Luagraphics need more testing, but this is a nice step !
a quick status :
LuaControls : one pad support implemented
LuaGraphics : see above :)
LuaSounds : on it's way :)
More to come !! |
|
Back to top |
|
|
gawd
Joined: 09 Feb 2005 Posts: 28 Location: Israel
|
Posted: Thu Jul 13, 2006 6:07 am Post subject: |
|
|
OMFG!
Congratulations!
Give PS2DEV a kickstarts!
-.... and use audsrv!
:) |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Thu Jul 13, 2006 6:12 am Post subject: |
|
|
thanks :)
it's used for mikmodlib :)
and gsKit for the graphic part :) |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Sun Aug 13, 2006 10:32 am Post subject: |
|
|
Some fresh news from the PS2 Lua Player :
I made some progress, and as you can see it can now run some more complex script like Luamines ! (version 0.03 by Dragula96)
For those interested you can also find here :
http://psxdev.info/evilo/download/luaplayer/luaplayer_luamines.avi a video (30Mo) of the game running. The game is a bit slow to show up and you'll see the "Lua Powered" splash for a few seconds because of the loading time (all images used by the lua script are loaded from host). Also, font display seems a bit screwed up on the video, but this is because of the divx compression (check the screen capture above).
a Quick status :
----------------
LuaControls : one pad support
LuaGraphics : need more work on the blitting functions to use gsKit properly
LuaTimer : done
LuaSounds : no sound output yet :(
Still in alpha stage and a work in progress anyway :) _________________ http://psxdev.info/evilo/ |
|
Back to top |
|
|
daurnimator
Joined: 11 Dec 2005 Posts: 38 Location: melbourne, australia
|
Posted: Sun Aug 13, 2006 1:42 pm Post subject: |
|
|
nice work
can't wait for this to be working well :D |
|
Back to top |
|
|
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Sun Aug 13, 2006 10:11 pm Post subject: |
|
|
wow great work i cant wait until the sounds is finsihed |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
Posted: Mon Aug 28, 2006 10:08 pm Post subject: |
|
|
Hi guys,
some updates on the LuaPlayer for PS2. Most of the libs are now implemented (except lua3d and luawlan that anyway won't be implemented for the first release), so the player is now really advanced.
I posted a new video on my blog (http://psxdev.info/evilo/), showing the lowser app running and then executing DrMario (note that, yes, the loading time is slow, this is due to loading through the network for debbugging purpose). Note also that the drMario script is the unmodified current PSP version :)
cheers :) _________________ http://psxdev.info/evilo/ |
|
Back to top |
|
|
sparrow
Joined: 13 Apr 2006 Posts: 24
|
Posted: Sat Sep 16, 2006 12:29 pm Post subject: |
|
|
evilo, you're doing a GREAT job! :D
When is the first public release going out? I just can't wait to play that Lua games on my PS2!
Cheers,
Sparrow |
|
Back to top |
|
|
daurnimator
Joined: 11 Dec 2005 Posts: 38 Location: melbourne, australia
|
Posted: Sat Oct 14, 2006 7:30 pm Post subject: |
|
|
any progress on this?
evilo? |
|
Back to top |
|
|
evilo
Joined: 22 Apr 2004 Posts: 230
|
|
Back to top |
|
|
jgrimm
Joined: 29 Nov 2009 Posts: 27
|
Posted: Sun Jan 03, 2010 6:28 am Post subject: |
|
|
i was wondering if ps2 lua player has network support at the moment? also i do likethe idea of connecting ps2 and psp. with network support, is it possible to code a web browser? i relly want a web browser for ps2 and i dont have ps2linux so i cant use one |
|
Back to top |
|
|
dlanor
Joined: 28 Oct 2004 Posts: 269 Location: Stockholm, Sweden
|
Posted: Sun Jan 03, 2010 9:59 pm Post subject: |
|
|
jgrimm wrote: | i was wondering if ps2 lua player has network support at the moment? also i do likethe idea of connecting ps2 and psp. with network support, is it possible to code a web browser? i relly want a web browser for ps2 and i dont have ps2linux so i cant use one
| Be aware that you are the first person to post in this thread for over three years, so don't expect the previous posters to be ready to continue discussions where they left off.
As for making a real web browser, I doubt very much that the PS2 lua player is a suitable tool for it. If working at all it would be bound to become extremely limited in all its capabilities.
Best regards: dlanor |
|
Back to top |
|
|
|
|
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
|