Crazy idea: GML in C++!

Posted by Onyx on Sept. 2, 2006, 6:48 a.m.

I had a crazy idea last night: what if you could use GML statements in C++? Let me explain it better:

I figured that you could make a .cpp file that contains functions named same as statements in GML. Then you could simply include this file in the same manner you include your normal C++ libs. Offcourse, this is really simplyfied explanation.

So, when you write draw_text(0,0,"Hello World") it would acctualy call function that looks like this:

void draw_text(int x, int y, string text)
{
  cout << text
}

Here the x and y acctualy do nothing but you get the picture. So, programming in C++ would be like creating a "one script game" with all code written in room creation event. Just imagine it: simplicity of GML with power of C++!

I didn't say it will be easy. I didn't say I can do it right now, I'm starting college soon and I'll probably take C++ there. As I allready know a bit of C I belive I won't have much troubles learning it. And good ol' GM gave me idea of how OOP works. I plan to gain egnouh skill to make a pong game in C++ and then try to tackle this thing (probably adding egnouh functions so you can make a pong game).

So, do you think it's possible? Do you even think it would be usefull?

Comence commentig!

Comments

APlusHost 18 years, 3 months ago

Well you cud do it but it would be kind of pointless i don't see the point in making it.

OL 18 years, 3 months ago

Or just learn C++

gamehawk 18 years, 3 months ago

That sounds great, and would be a great learning project for you. I'd rather code in DX though.

Onyx 18 years, 3 months ago

Quote:
I'd rather code in DX though.

That's just what I was thinking about: you probably know it's not that simple for beginner to learn kow to program in DirectX. But this way someone who knows GML can easliy use it using "GML functions". And I would release it as open source so someone who knows GML can learn C++ that way: he knows WHAT e.g. draw_sprite() does, now he can learn HOW to do it in C++. Also, noone sad you can't use it mixed with "plain" C++, so to someone who knows C++ it can be

something to save his time: if you make a game you need something like instance_create and draw_sprite all the time. You could offcourse write your own function, but why when you have all of them in a single file.

Boy, that was a looong comment.

Eternal 18 years, 3 months ago

It'd function like the Dark Game SDK then?

Also, there is a way to get the x and the y to work. I'm not sure how, but I know there is, since using the Dark Game SDK you have to be able to use set_cursor… but whatever.

Onyx 18 years, 3 months ago

@Eternal - offcourse it's possible. I just whiped out this one fast. And, as I allready said, I don't know much C++ right now, but that will soon change.

gamehawk 18 years, 3 months ago

I'd start by making a C++ to GML converter that way it takes a step out of the work for them, easier than library programming, and you could mess with C++ code after.

poultry 18 years, 3 months ago

GameHawk is dumb.

gamehawk 18 years, 3 months ago

Why am I dumb?

Ciribot 18 years, 3 months ago

ChIkEn is tasty.