View Full Version : Lua for PSP, or: writing games the easy way without compiler !
July 17th, 2005, 18:56
<a href="http://forums.ps2dev.org/viewtopic.php?t=2682" target="_blank" >Shine</a> has posted this news on the <a href="http://forums.ps2dev.org/viewtopic.php?t=2682" target="_blank" >PS2Dev Forums</a>:
<BLOCKQUOTE>I've compiled Lua for the PSP and ported my Snake to it (see below). It is my first Lua program, so it may look not as elegant as it would be possible with this nice language, but at least it is 237 lines only, compared to the 551 lines of the old C program.
One of the main advantages is, that you just need to edit the script.lua program on the memory stick, and after restarting the game, it will be compiled on-the-fly on the PSP, without any compiler on your PC, you need just a text editor! I've integrated a PNG loader, so you can write your own games with it, by changing the script.lua and copying all your PNGs to the game directory. And important for newbies (and sometimes for me) : It doesn't crash (or at least it should not), but if you pass a null-pointer to a function, you'll get a nice error message, with the line in the script, which caused the error. </BLOCKQUOTE>
More info at the link above.
July 17th, 2005, 19:45
cool.do you know where i can find more simple example apps like the snake one?
July 18th, 2005, 00:28
Im gonna figure this out. it seems a whole lot eaiser then borland c++
For some reason tho. I cant get it to make file.however thats probibly because im doing somthing wrong.
im gonna figure this out and then im gonna make the game I always wanted but never got to see. and im not gonna say what it is till im done cause this ideas to good to be stolen from me.
Baised on how long I figure it will take me to figure out what im doing wrong and then to create the game from random sprite images im gonna just snatch somwhere off the net ( So Sue me!- whos got the time to build the sprites and music from scratch and create the game as a one man group in a single life time?!) I figure I should have a pretty kick ass snes type rpg in about (six months)lol. Then im gonna post it up here for everbody :p
Again I dont want to hear Jack crap about the Borrowed sprite images and music from existing Snes games off peoples sites Cause if others sites have them there alerady stolen anyway,___ My Game Will see the light of day___ :p
I cant wait to figure this out and sink my teeth into this project:D
Update. I really like this program. I found out what I was doing wrong. Ive altered the snake program. Made some changes. only to find out I have a (LOT) to learn. Im Wondering tho can i just go crazy n code anyting I wish with this, If I knew how? or Am I restrected to simple snake and tetris type games ?
I know that no coder wants to take time to answer a newbes questions. but I really want to learn this so I can learn to code better. I just need to know. Is this program a step in the right direction for an aspireing coder? (seeing as I only have borland c++ as an alternitive and its an old version that I truely disslike). or am I just waisting my time With this new program?
*Sigh I must be the only person useing this :rolleyes:
July 18th, 2005, 06:18
[QUOTE=shadowprophet]im gonna figure this out and then im gonna make the game I always wanted but never got to see. and im not gonna say what it is till im done cause this ideas to good to be stolen from me.[QUOTE]
I look forward to your game Shadowprophet. :)
This is neat tool. i'll fiddle with it when I learn a little more about coding. I'm to much of a noob now.
July 18th, 2005, 06:44
:D you just became my alpha release tester. If your interested? as soon as I get it up and going (I still dont know when that will be but im working on it even now) I will send it to you. Maybe you can give me some ideas on how to make it better before I release it :p This is my first game for the psp. And I want it to be perfect.:p You dont happen to know where one can find a large source of online game sprites do you ?
lol So far just for fun ive tricked out that little snake game. now its got a ff1 character instead of a snake. and i replaced the apple and fly pngs with some interesting pics. Im still trying to figure out how encode music. What would be ultra helpful was if I could find some game source archives for this thing. see how the pros do it. but I will figure it out in time. :p
But you can bank on my fnishing this game. Ive always told my self if I ever do a game . that it would be this one. This isnt an idea that just came to me .Ive literaly been stewing it over for years. I Already have the story worked out and everything. This is gonna bring tears to peoples eyes when its done (if) i can pull this off. And ive made up my mind. It is happening :D
July 18th, 2005, 19:28
I'm cross-posting here, sorry, but this Lua port is fantastic. I managed this (http://www.dcemu.co.uk/vbulletin/showthread.php?t=7962) in just over an hour. With beer.
If this doesn't seriously shake up the amateur homebrewing, I don't know what will.
July 19th, 2005, 06:03
agreed.i never coded in my life and i even i'm starting to get to grips with it just by reading some basic tutorials over at the lua website.
also the fact you can just edit the file directly on the mem stck removes any excuse to start coding,like,now.
all i need now are some more game source codes just to compare them around and study them,so,people,keep them games a coming
July 21st, 2005, 05:16
Until last evening I'd never touched Lua. But I've used Basic and C++ a lot over the years, so it was very easy to get into by looking at a few tutorials and the code for Snake and Button Match. By the time I went to bed (admittedly ~4 AM) I'd finished porting a simplistic gag of a QBasic game called "Dating Horror" to Lua. There were a few things that didn't work quite properly or worked better being turned into functions, but for the most part I could simply go line by line and make minor changes to the syntax. For instance this
FOR x = 1 TO 10
IF RND > .5 THEN
zombie(x) = 1
math.randomseed( os.time() )
for x=1,10 do
if math.random() > .5 then
zombie[x] = 1
End result can be found here (http://rapidshare.de/files/3212277/DHorror05PSPLua.zip.html), but it's a really simple project.
I do wish there was a decent guide to what all functions are available. For instance there's a printDecimal used in several of these programs, but as far as my searches can tell that's not a standard Lua thing. Can similar things be done with strings without guessing and checking? The guy who ported Lua has included PNG support and blitImage. What else is hidden in there? But then, this is just a pre-release version anyway, so hey.
July 21st, 2005, 16:40
I think the full (or at least, better) release of Lua is due this coming weekend, hopefully Shine will document more of the functions.
PrintDecimal is useful for scores (as I used it for) but as far as I can see you can't position strings on screen in the same way, which is a shame.
It's still fantastic, though, even as it is.
August 4th, 2005, 00:08
a guide for the novice would be awesome. Maybe from a simple program that outputs text to the screen, to adding a background, and input functions. I have used BASIC and Pascal in the past, but on a very limited basis.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.