#51426 - cybereality - Fri Aug 19, 2005 2:20 pm
I am concidering writing a custom scripting language for the DS to ease development of games. I am mainly a Flash programmer (though I am familiar with many languages including java and C++). I would hate to have to write gameplay code using C++ and I think a scripting language would save a lot of time in the long run. I imagine the language being similar to Blitz3D if any of you have used that. Basically the language would cover up all the complex wiring of the engine and allow you to just focus on gameplay. For example, the following psuedo-code would load a level, load a character and accept controls:
Code: |
// initialize scene
initialize3dScene();
// load assets
castle = load3dModel(castle.x);
castleTexure = loadTexture(castle.pcx);
textureModel(castle, castleTexture);
mario = load3dModel(mario.x);
marioTexture = loadTexture(mario.pcx);
textureModel(mario, marioTexture);
// setup scene
move3dObject(mario, 150, 0, 50);
// main loop
while(1){
// player controls
if(Button.UP){
adjust3dObject(mario, 0, 0, 5);
} else if(Button.DOWN){
adjust3dObject(mario, 0, 0, -5);
} else if(Button.LEFT){
adjust3dObject(mario, 5, 0, 0);
} else if(Button.RIGHT){
adjust3dObject(mario, -5, 0, 0);
}
// update screen buffer
update3dScene();
}
|
I think this could be very helpful for creating modular code and facilitate rapid-prototyping of games. If this idea proves successful I will release the language along with a dev environment that will support it. Is this something of interest to the homebrew community? If anyone else has some experience with DS development (my NeoFlash should be coming soon), please point me in the right direction. Thanks
// cybereality
#51435 - mike260 - Fri Aug 19, 2005 3:42 pm
Designing and implementing a whole new language might be overkill; does Lua not suit your needs?
On the other hand, writing a high-level 3D library to expose through a scripting-language is a great idea.
#51437 - Phan - Fri Aug 19, 2005 4:11 pm
Sounds pretty good. It would be simpler than what we have now, thats for sure.
#51452 - sajiimori - Fri Aug 19, 2005 7:38 pm
The pseudocode you posted looks so similar to C that I wonder why you wouldn't just use C. Lua offers things that C++ does not, including garbage collection, closures, and coroutines.
#51464 - Volta - Sat Aug 20, 2005 12:06 am
In fact, he's actually proposing a kind of HAM DS...
It's currently really difficult to program something "useful" (a real game, I mean) on the DS because there is no such templates or structure built. LIBNDS is a really good start but for some features (micro, sound, tiles compared to the gba) it is still difficult for a DS newbie programmer to code something nice on a short period of time (which is essential if we want a strong community).
#51486 - cybereality - Sat Aug 20, 2005 8:53 am
Volta, I think you got my idea exactly. The point would be that the engine would be open to the community so we all wouldn't be re-writing the same code and wasting time. I know you could set something up similar in C using functions, but this would handle all the backend stuff automatically. Once it worked it could just be imported as a library and reuseable. Again, I am just getting into the DSdev scene and I have not used all the tools available. What I have seen looks like it may get complex with a more full featured game, so I was looking for a simple solution. There could be default templates for lets say a menu screen or a 3d scene, collision, etc. I also wanted create something that would allow beginner programmers or flash programmers to get started creating games quickly. Once I get deeper into DS development, I'll know better if this is even going to be necessary. I am not familiar with HAM, whats that (google didn't turn up anything useful)? Thanks.
// cybereality
#51489 - Shoxz - Sat Aug 20, 2005 10:13 am
make the script like VB and ill love you :P
_________________
-Shoxz,
Webdesigner
PHP, HTML, and VB programmer
Also known as Unreal, and Kez.
#51499 - sajiimori - Sat Aug 20, 2005 7:06 pm
Okay, so you want a library, not a new language.
#51503 - Volta - Sat Aug 20, 2005 7:54 pm
I think that a new language would be a waste of time - as you say, we only need "shortcuts" to achieve specific tasks. Of course, it's not about creating something for newbies only, but for example, if it's possible to access each button via a defined variable which a name that make sence (instead of having to check a bit in a registry), it would be nice.
HAM GBA was the perfect example. Using it, I created a small technical demo of a tile based system with a collision map and depth of field. It was only what I needed to get a job in a videogame company (of course, I had other studies, but that's another story). What I mean is that I was able to create something impressive that was not resource consuming.
LIBNDS is a good example but it's not complete. Guys are working hard to improve it but it seems that for some coders, if something is easy to do (using a variable "BTNY_PRESSED" instead of a registry bit to check), it has no merit. I say False: easier programmation will only help us to make more complex (read: complete) projects.
#51505 - mike260 - Sat Aug 20, 2005 8:29 pm
Volta wrote: |
LIBNDS is a good example but it's not complete. Guys are working hard to improve it but it seems that for some coders, if something is easy to do (using a variable "BTNY_PRESSED" instead of a registry bit to check), it has no merit. I say False: easier programmation will only help us to make more complex (read: complete) projects. |
Why don't you contribute this code yourself?
#51512 - sajiimori - Sat Aug 20, 2005 9:36 pm
Volta, bitfield checks aren't just harder than having separate defines for checking every key. Try writing the anyKeyPressed() function using each method. Also try writing bothPressed(key, key).
#51514 - Sausage Boy - Sat Aug 20, 2005 10:03 pm
libnds isn't supposed to be like ham, it's merely a set of defines and macro's to give meaningful names to the registers. It's not supposed to be like ham. But, you can easily write your own lib, there is PA_lib for those who can't handle the raw power...
_________________
"no offense, but this is the gayest game ever"
#51515 - Volta - Sat Aug 20, 2005 11:25 pm
mike260 wrote: |
Why don't you contribute this code yourself? |
It was not a critic and I don't say that libnds is a bad thing; as Sausage Boy said, libnds is just not like ham.
It's not about "raw power" it's about good, simplified and clean code.
#51518 - cybereality - Sun Aug 21, 2005 12:23 am
Yeah, right on. Creating a good game should be about good concepts and solid gameplay programming, not just low-level coding. Looking back, I think this would basically just be a library. At first I imagined it as a stand-alone front end to the many DSdev tools already available. So you could code the game in the simplified language, run test builts that would display in the 3d preview window and export an NDS file directly from the program. Think of it as a DS Development Studio type of program. This may be not worth the effort to put together, but if it worked well it would save us all a lot of time. I just got my NeoFlash this morning and I tested out a few of the demos available online. Good stuff. I am totally stoked on writing some of my own demos this weekend. Then at least I can get a feel for the current development environment.
// cybereality
#53503 - Darkain - Thu Sep 08, 2005 8:51 pm
i see quite a few people mention Lua, which i used to use myself as well. earlier this year, i switched all of my Lua projects over to LuaPlus, which is geared more specifically to integrate into C++, while retaining all of the features that Lua had. i think LuaPlus is a little trickier to setup for the first time, but when you get the hang of it, it does offer some NICE added functionality that i always wished that Lua had in it.
_________________
-=- Darkain Dragoon -=-
http://www.darkain.com
DarkStar for Nintendo DS
#53528 - Mollusk - Fri Sep 09, 2005 12:10 am
If the problem is just libnds being to 'low-level', then PAlib should be just what you are looking for...
Libnds was never meant to make DS developpement extremely easy to newbies, but just turn the incomprehensible DS registers into comprehensible stuff... That's why nobody can code without it !
#53529 - sajiimori - Fri Sep 09, 2005 12:23 am
Have you seen luabind? It's pure magic...
Code: |
class Thing
{
public:
static void staticMethod();
void instanceMethod();
};
void separateFunction(Thing*);
lua_State* state;
void exportEverythingToLua()
{
module(state)
[
namespace_("Thing")
[
def("staticMethod", &Thing::staticMethod)
],
class_<Thing>("Thing")
.def("instanceMethod", &Thing::instanceMethod)
.def("separateFunction", &separateFunction)
];
}
// In Lua file...
Thing.staticMethod()
t = Thing()
t:instanceMethod()
t:separateFunction()
|
#53530 - mike260 - Fri Sep 09, 2005 12:37 am
Does LuaPlus let you use a class for lua_Number? I'd like lua to use my fixedpoint class, but lua_Number is used in unions which is a no-no for classes with user-defined constructors.