Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von emericaska8r why not just use the .20 version? 0.16 is much faster....
-
11-19-2007, 11:51 PM #8101QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
0.16 is much faster.
Zitat von emericaska8r
-
11-20-2007, 08:34 PM #8102
oh yea true... maybe you could use the updated part in .20 and recompile that in the .16 version? don't know how all that stuff works so i couldn't tell you
-
11-22-2007, 04:24 PM #8103
- Registriert seit
- Jan 2007
- Beiträge
- 10
- Points
- 3.514
- Level
- 37
- Downloads
- 0
- Uploads
- 0
heelp motion!
hi guys , i ve got problem with neo motion kit and lua ...there isn't any compatibility!how i can map psp button? last question:I can ever use motion kit with lua? help please!
-
11-23-2007, 08:53 AM #8104Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
yes if someone adds the commands into luaplayer
but at the moment they are not included
you will probably have to make a custom lua player to use the motion kit by programming the commands------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
11-23-2007, 09:14 AM #8105QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
It would just be great if someone took the time on their hands to modify Lua Player to be able to connect with the Motion Kit.
Shouldn't the guys at LuaPlayer.org already have done it? it's over a year since Lua Player 0.20 was released..
Absolutely right. It has to do with the Image.createEmpty(width, height) extended alpha abilities, and i think it started in Lua Player 0.17, if i remember it right.
Zitat von Nielkie
I would like to have some kind of switch between the two, like:
I think that will solve the problem, but maybe i'm wrong.Code:Image.createEmpty(width, height, fullapha boolean)
Geändert von HaxxBlaster (11-23-2007 um 09:32 AM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
11-23-2007, 09:34 AM #8106Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i would do it if i knew the commands or had the motion kit aslong as my compiler worked but at the moment it doesnt
if i get my compiler to work i will ask someone for the commands and do it for youGeändert von FaT3oYCG (11-23-2007 um 09:51 AM Uhr)
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
11-23-2007, 04:03 PM #8107QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Well, when/if the SIO lib is fixed in the next luaplayer, it should be possible to do it directly in luaplayer.
Zitat von FaT3oYCG
Something like this?
Code:System.sioInit(510416) --wait awhile because it takes a few seconds in initialize... Xaccel = 0 Yaccel = 0 for i=1,10 do System.sioWrite("1") --string.char(tonumber("31",16)) Xaccel = Xaccel + tonumber(System.sioRead()) --I'm not sure if this will work... System.sioWrite("2") Yaccel = Yaccel + tonumber(System.sioRead()) end Xaccel = Xaccel / 10 Yaccel = Yaccel / 10
Also, Googleing found this, though I'm not sure it is made for the motion kit.Geändert von Nielkie (05-21-2008 um 11:30 PM Uhr)
-
11-23-2007, 07:18 PM #8108QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
If so, that would be great!
Zitat von Nielkie
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
11-24-2007, 08:49 AM #8109
- Registriert seit
- Jan 2007
- Beiträge
- 10
- Points
- 3.514
- Level
- 37
- Downloads
- 0
- Uploads
- 0
If so, that would be great!
yeah...
-
11-25-2007, 11:04 AM #8110Look at my user title :p
- Registriert seit
- Feb 2006
- Ort
- Texas
- Beiträge
- 1.183
- Points
- 14.103
- Level
- 77
- Downloads
- 0
- Uploads
- 0
hey everybody got a question about coding for your player to pick up the items (i can do the code up to a point), but my question do i need to have another image with my character with say a gun in his hands to blit and replace the old image of the character without the gun? if so is there a snippet that i could look at to show me how to do that. thnx in advance ofr any help.
**********, ********** :p
http://img143.imageshack.us/img143/6...boysfanij8.gif
-
11-25-2007, 02:02 PM #8111QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Zitat von %chrono trigger%
Code:player = {} player.x = 0 player.y = 0 player.weapon = "gun" player.img = { ["gun"] = Image.load("player_gun.png"), ["none"] = Image.load("player.png"), ["sword"] = Image.load("player_sword.png") } screen:blit(player.x,player.y,player.img[player.weapon])
-
11-25-2007, 03:52 PM #8112Look at my user title :p
- Registriert seit
- Feb 2006
- Ort
- Texas
- Beiträge
- 1.183
- Points
- 14.103
- Level
- 77
- Downloads
- 0
- Uploads
- 0
thnxs that really helps :)
-----edit---------
ok i implemented that, but my old image isnt being replaced by the new one its just displaying both is there a certain function that would replace it im sort of confused. I think its because im using a if check collision function to deteermine if the image should be blitted which probaly isnt effective ill post that part of the code in a bit if need be
-= Double Post =-
srry for the double post mods, but i found the problem well sort of lol
ok so i solved my first problem by changing that code to:Code:if collision(Pic,Player) then screen:blit(Player.x,Player.y,Player.img[Player.weapon]) screen.flip() screen.waitVblankStart(30) screen:clear() end
which works, but my other image is still there, so i have my second image blitted on top of my first image which not only lags my game severly, but makes it look stupid. So basically i need to know how i can i guess replace and image.Code:if Player.x >= Pic[1].x then screen:blit(Player.x,Player.y,Player.img[Player.weapon]) screen.flip() screen.waitVblankStart(30) screen:clear() end
thnx in advance for the helpGeändert von %chrono trigger% (11-25-2007 um 05:11 PM Uhr) Grund: Automerged Doublepost
**********, ********** :p
http://img143.imageshack.us/img143/6...boysfanij8.gif
-
11-25-2007, 09:42 PM #8113QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Why do you have a random waitVBlankstart there? Why are you fliping and clearing the screen?
Yeah, that makes no sense.I think its because im using a if check collision function to deteermine if the image should be blitted
You can't just 'replace' an image, I suggest you restructure your code.
Something like this:
Code:player = {} player.x = 0 player.y = 0 player.weapon = "gun" player.img = { ["gun"] = Image.load("player_gun.png"), --Image of the player with a gun ["none"] = Image.load("player.png"), --Image of the player widthout any weapon ["sword"] = Image.load("player_sword.png") --Image of the player with a sword } while true do pad = Controls.read() screen.clear() screen:blit(player.x,player.y,player.img[player.weapon]) --Blits the player if player picks up gun then player.weapon = "gun" end if pad:left then player.x = player.x - 1 end if pad:right then player.x = player.x + 1 end --etc.. screen.waitVblankStart() screen.flip() end
-
11-25-2007, 10:14 PM #8114Look at my user title :p
- Registriert seit
- Feb 2006
- Ort
- Texas
- Beiträge
- 1.183
- Points
- 14.103
- Level
- 77
- Downloads
- 0
- Uploads
- 0
ill look throught that thnx, and also about the random waitVBlankstart and fliping and clearing the screen its because i had it from when i changed my code and didnt take it out thnx for finding that since i have alot more code than this already done and i guess it got copy pasted with it or something, and i had the collision function was because this was part of my other game stickguy wich was a bust, but the coding was good. Again thnx ill take a look through your code and fix mine.
**********, ********** :p
http://img143.imageshack.us/img143/6...boysfanij8.gif
-
11-26-2007, 11:14 AM #8115Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i was thinking of making an unreal tournament game for the psp coded in lua but i was just wondering if you think it would be better to do it in 3d and for it to take forever of to do it in 2d not be as good but take half the time just want to know what you think thanks
- if i was doing it in 3d i would also have to take some time to learn 3d too
- if it was in 2d i would probably have an alpha done in 3 weeks thanks------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
11-26-2007, 11:17 AM #8116
Do it in 3D. It would be sooo much cooler.
-
11-26-2007, 12:06 PM #8117Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
anyone know where i can find some tutorials or simply somewhere that tells me what each of the 3d lua functions do
i have found the functions but i would like to know their meanings anyone know where i can find that out
thanks
- otherwise im doining it in 2d soz------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
11-26-2007, 02:01 PM #8118
Someone is already working on a FPS engine in LUA, and it's in 3D. Unfortunately I don't remember who it was since I saw his video of the engine on Youtube. But I'm sure he would be of help.
To answer your question, you have to give more info on your LUA experience. And the way someone asks the questions can already tell a lot about that person's experience. So we already have a start there :)
You don't just "learn" 3D in the programming sense just like you don't "learn" games. The biggest leap in adjusting from 2D to 3D is in the physics. You might be able to do a simple Doom-type FPS but something in Unreal Tournament style has more complex physics and control.
We cannot help explain the functions to you unless you tell us where you found them, right? ;)i have found the functions but i would like to know their meanings anyone know where i can find that outGameSnooper - Random drawing of gaming news
The 32 Bit Shell - My development blog (also includes gaming oddities)
-
11-26-2007, 02:48 PM #8119
Can someone create a simple 3D FPS tutorial? Thanks!
-
11-26-2007, 03:14 PM #8120QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
No. That would be ridiculous.
[I fail @ life]
-
11-26-2007, 03:16 PM #8121
How is it ridiculous?
Fine, just a simple 3D tut.
-
11-26-2007, 03:37 PM #8122QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
That's still pretty ridiculous.
There's much, much more to a 3D engine than just graphics. And I don't see much chance of calculus being done properly in Lua, so the likelihood of physics being at all accurate is pretty low.[I fail @ life]
-
11-26-2007, 03:53 PM #8123
Yea but you could still make a 3D tutorial.
All I want it to be able to do is walk around.
-
11-26-2007, 03:56 PM #8124Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
here is what i have read now i would only like a simple explanation for each please as i dont know what each one specifically does or in which order they are meant to be placed when being used but first of all it would help if i knew what they meant
thanks
3D GU mapping
Gu.start3d(), Gu.clearColor, Gu.clearDepth, Gu.clear, Gum.matrixMode, Gum.loadIdentity, Gum.perspective, Gum.translate, Gum.rotateXYZ, Gu.texImage, Gu.texFunc, Gu.texEnvColor, Gu.texFilter, Gu.texScale, Gu.texOffset, Gu.ambientColor, Gu.enable, Gu.disable, Gu.blendFunc, Gu.light, Gu.lightAtt, Gu.lightColor, Gu.lightMode, Gu.lightSpot and Gum.drawArray.------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
11-26-2007, 04:29 PM #8125lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
I am not sure but cant you get an idea of what they do by looking at the LuaPLayer source?
-
11-26-2007, 06:30 PM #8126QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
This is a really basic question, but how would I go about having an image blitted to the screen upon the pressing of a button? I don't want it to be showing only when pressing the button, however, for I can do that fine. Basically, I want an image to appear when a button is pressed, but not go away. This is still a problem I've yet to figure out....
-
11-26-2007, 06:54 PM #8127
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
Code:showimg = false img = Image.load("someimg.png") while true do pad = Controls.read() screen:clear() if pad:cross() then showimg = true end if showimg then screen:blit(0,0,img) end screen.waitVblankStart() screen.flip() end
-
11-26-2007, 07:18 PM #8128QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Thanks- I knew it would be a simple solution. Actually, I thought I tried something like that... obviously not!
Another question.... what I am trying to do is blit the same image in many different spots on the screen based on where the "cursor" is at that moment. How would you recommend doing that? Could I save the current (when the button is pressed) coordinates of the "cursor" into an unchanging variable? Because right now the blitted image is moving with the "cursor." Thanks for any help!
-
11-26-2007, 07:37 PM #8129
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
Code:locations = {} function addLocation(x,y) table.insert(locations,{x=x,y=y}) end while true do pad = Controls.read() screen:clear() if pad:cross() then addLocation(cursorx,cursory) end for i = 1, table.getn(locations) do screen:blit(locations[i].x,locations[i].y,img) end screen.waitVblankStart() screen.flip() end
-
11-26-2007, 11:47 PM #8130QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Zitat von FaT3oYCG
Have a look at the 3D cube example that comes with Lua. It's pretty much direct PSPgl commands.
I also remember a tut from a while back, I'll see if I can find it.
EDIT: Found it (From the GDI)


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum