| View previous topic :: View next topic |
| Author |
Message |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Wed Jun 06, 2007 5:33 am Post subject: lua or C++? |
|
|
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 |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Thu Jun 07, 2007 7:44 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Thu Jun 07, 2007 8:00 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
_df_

Joined: 01 Jun 2007 Posts: 9
|
Posted: Fri Jun 08, 2007 4:32 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Fri Jun 08, 2007 4:36 pm Post subject: C vs C++ |
|
|
Is there any difference / advantage between c and c++? _________________ Behold! The Underminer got hold of a PSP |
|
| Back to top |
|
 |
_df_

Joined: 01 Jun 2007 Posts: 9
|
Posted: Sat Jun 09, 2007 2:52 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Sat Jun 09, 2007 7:41 am Post subject: |
|
|
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!@#$) |
|
| Back to top |
|
 |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Mon Jun 11, 2007 6:46 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
_df_

Joined: 01 Jun 2007 Posts: 9
|
Posted: Mon Jun 11, 2007 7:04 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Mon Jun 11, 2007 8:06 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Sun Aug 19, 2007 12:16 am Post subject: sorry |
|
|
Yeah, my remark was kinda stupid _________________ Behold! The Underminer got hold of a PSP |
|
| Back to top |
|
 |
|