lua or C++?

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

Moderators: Shine, Insert_witty_name

Post Reply
the underminer
Posts: 123
Joined: Mon Oct 03, 2005 4:25 am
Location: Netherlands

lua or C++?

Post by the underminer »

You might expect this question from a noob, but in my case; I've coded lua for a very long time and would profile myself as an 'addvanced' lua coder. I'm thinking about switching to c++ for the obvious speed and memory advantages. But is C++ really worth the effort to learn coding all over again?
(I guess I'll pick it up pretty fast with lua experience) I'd like to know how much faster/better blitting is in C++ and how much memory is free.
Behold! The Underminer got hold of a PSP
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

Your answer would be C++, its time to break the mold and move onto a more advanced programming style. However with C++ its a whole new ballgame. While you get more commands and styles of code to go over in C++, Not only speed, you loose alot of simplicty that comes with LUA. Since you are moving from a scripted enviroment to a more syntax oriented enviroment.

From what I know about programming for the PSP is that you get the full ammount of Memory that is imbedded in the PSP which would be 31 megabytes. Not only the ammount of power in the C++. You can experience up to 60 fps which is the cap of the video processor on the device. However you can process up to thousands of times video as well as full functions per second depending on the clock speed of the processor. I would say that C++ is vastly superior to LUA in terms of speed.

The blit process in LUA is so horribly coded that when a blit is called it does not execute its own process, but instead its pushed together and halts every command after. So instead of streamlined application that has speed as well as a scripting language. it forces the user to have a very limited ammount of power in the language. (A software cap due to programming).

In C++ you can develop threads that accomodate 3d as well as 2d with large ammounts of memory more so than you can do in LUA.

The choice is simple. Learn to Program for real.
the underminer
Posts: 123
Joined: Mon Oct 03, 2005 4:25 am
Location: Netherlands

Post by the underminer »

thnx romero, threads is another very tempting advantage of C++. I don't really understand what you're saying about video. I've never seen video being used in homebrew ever.

Still, when I finish Galactic Breakout, I will take a big brake out of programming, do some other stuff, and when I'm ready to take on a big project again I'll just get cygwin running; and see how things will turn out.

I hear it's also possible to keep USB running just like with lua, so you can update the code fast.
Behold! The Underminer got hold of a PSP
User avatar
_df_
Posts: 9
Joined: Fri Jun 01, 2007 12:45 pm

Post by _df_ »

lua isnt as slow as people make out. its faster than python and ruby which it is often paired against.

besides, learn c++ and embed lua :)

lua gives you a lot of things c++ doesnt (like full lambda calculus and full functional programming).

Im a C guy and hate c++ but learn whatever takes your fancy.
the underminer
Posts: 123
Joined: Mon Oct 03, 2005 4:25 am
Location: Netherlands

C vs C++

Post by the underminer »

Is there any difference / advantage between c and c++?
Behold! The Underminer got hold of a PSP
User avatar
_df_
Posts: 9
Joined: Fri Jun 01, 2007 12:45 pm

Post by _df_ »

like many, that question has a lot of answers depending on how you want to look at it.

anything I could answer with would be enough to start a language flame war :)

I think most people would suggest you learn C++ over C and you cant really go wrong with that.
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

I would suggest working with C or C++ I have no real prefrence. Just as long as you work at a lower level of program than an interface within an interface. as much as I would like to say C/C++ is easier to use than LUA it would be a lie, However whenever you work with C/C++ you will have a larger and stronger ammount of power for your applications.

Here are a few examples of what you can and cannot do.

Drawbacks to C/C++
Harder language to learn. - You will struggle with the language
Harder to code for. - The Code for LUA is soo much simpler
Got to kill app/psp before restarting it. - YES THIS SUCKS.
Takes more time to get things done. - Its definatly not like blit("filename")
Most Variables dont change type (It cant be numbers then letters.. only one type)


Advantages for C/C++
More powerfull. - You can extract almost the full power of the PSP.
Smaller Code. - Code is compiled into a minimalistic format.
Take advantage of the hardware.
Create and Take control over modules.
Take advantage of the full ammount of memory.
Even ability to add LUA functionality to your program. (Oh noes!@#$)
the underminer
Posts: 123
Joined: Mon Oct 03, 2005 4:25 am
Location: Netherlands

Post by the underminer »

romero126 wrote: Even ability to add LUA functionality to your program. (Oh noes!@#$)
Indeed, Coding C++ and embedding lua would be totally missing the point of using C++ at all.

Like having a x86 PC and running MacOS X with a windows emulator.
Behold! The Underminer got hold of a PSP
User avatar
_df_
Posts: 9
Joined: Fri Jun 01, 2007 12:45 pm

Post by _df_ »

the underminer wrote:Indeed, Coding C++ and embedding lua would be totally missing the point of using C++ at all.
this totally misses the point, its like saying why does lua exist at all? why do we have c++ when we have c? etc

write your framework in c++, use lua to drive it the parts that lua is good at driving (scripting your games/level design/data entry).

lua is a lot more powerfull than c++, its just a different tool with a different job.

you havnt even started to learn c++ and already you have switched off half your brain and think all problems are square pegs and square holes.

c++ is powerful. marry c++ with game monkey or lua and it becomes far far more powerful.
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

The merger of a scripting language with a game language actually does add a ton of functionality to the scene. With a series of things, number 1 it adds functionality where the dynamicness of the code is required like scripted events, Instead of hardcoding everything for it you merely need only to code an engine which runs your code. and You script gameplay in, it doesnt have to be LUA per-say but it does need to be some sort of scripting/interpreting language.

It will definatly cut down the level creation time in half instead of codeing each encounter line by line in C++ which can be terribly tedious.

Hint for scripted events.
Goto X,Y
Speak (i like pie)
Display_Model "make me dance" (time 2ms)
Display_Model "make me dance2" (time 2ms)
Resume Game.
the underminer
Posts: 123
Joined: Mon Oct 03, 2005 4:25 am
Location: Netherlands

sorry

Post by the underminer »

Yeah, my remark was kinda stupid
Behold! The Underminer got hold of a PSP
Post Reply