I like game development. Really, I do. But I find sitting in front of a computer and programming in C/C++ all day very boring. So, here's what I would like to do...

I would like to write my own compiler using C that would allow me to write games using a custom BASIC-like language. Of course, it wouldn't be exactly like BASIC. It would include classes, inline assembly, etc. This same approach was taken by Naughty Dog for their Jak and Daxter series of games. They created a custom LISP variant called GOAL (Game Oriented Assembly Lisp).

I know that I would need to do what I originally said I didn't want to do (sitting in front of a computer all day and programming in C/C++), but I'm willing to do that if it means I can use a powerful BASIC variant to program my games.

So, what exactly should I start with? Should I use Bison to parse the language? Does anyone know of a good compiler design tutorial? Is this even a good idea?

You'll spend more time debugging your compiler than you will be making games, in my opinion.

You're right. But, this new language would be available for everyone to use. So my relentless debugging would help a lot of newbies who want to get into game development (yes... alright... I'm talking about myself here)

Community projects are great, and if you're truly dedicated to writing this language, then perhaps it has a chance. Just keep in mind that the freely-available-software world doesn't need another project that's just going to get orphaned.

That said, have you looked at any of the other 'starter' programming languages targetted at game programming?

BlitzBasic? DarkBasic? PyGame?

If not, I highly suggest you do and see if any of those fill your needs. If they don't, and you decide to go ahead with your own language, I suggest filling a niche that they don't, otherwise you might find it harder to get a community together when you'll be competing against these larger, established "easy-to-program" languages.

Disclaimer: I've never used any of those, but we do get a lot of posts from people who do, who are mostly newbies.

I've never tried BlitzBasic, but I do have some comments on DarkBasic and PyGame:

For me, DarkBASIC seems limiting. I don't know why, but when I open up that ugly IDE, I just get the feeling that I'm in a box. With my language, I want it to be simple enough for a newbie, but powerful enough for the average programmer who's had a few years of experience.

PyGame is nice, but Python is not my ideal language for writing games. I don't like that just anyone can edit the source. Sure, it might be ok for some games that I just let people do what they want with, but Python isn't for commercial games. I could use py2exe, but the programs it puts out are for Windows only and tend to be very large.

My main design hurdle right now is the decision on usability. Should the language be designed for games alone? Or should I include other functions/libraries that make it suitable for everyday application development? To me, designing it for game programming only would be slightly easier. But allowing general application development would make it available to a wider range of programmers.

If you want to program games, why waste at the minimum a year of your time, not programming games?

The more powerfull you make the language, without 'limiting' it as you say, you induce complexity, which in turns, makes it harder to use, which in turn, doesn't make it newbie friendly.

What is so boring about C/C++ that would make your language such a joy to use?

I could go on, but I think I nailed a few key points there. I don't want to be a downer on your idea, but it just seems far fetched, and not really worth your time.

Under no circumstances do I think it's a collosal waste of time! Writing a compiler and virtual machine was the most fun coding I have ever done, and I encourache everybody to at least try it out! Especially in these times where every new game seems to have some form of scripting...

In response to 1 and 2: Peroxide script tutorials is where I learned the trade. The language is not the most complex, but it does work, and the framework is easy to expand. His 'hello world' example looks like this:

// A 'hack' to print a string from script.. send it via a 'setint' on the player as the name..
void printLog(string msg)
{
setint(TYPE_PLY, msg, 2, 0);
}
program helloWorld trigger_on_init
{
printLog("Hello world from PxdScript!");
}

and my expanded test script-code looks like this (built on his framework):

This took about two moths to do, and that was while building the engine on the side.

I do not agree that making a language too powerful will make it complex, on the contrary. Making a powerful script language is all about removing the low-level stuff from the user, and make simpler high-level interfaces that they can use instead. A good example of this is UnrealScript's networking architecture, where instead of having to write code for transferring data to and from the server, they simply mark what is to be sent, and what conditions have to be met for the transfer to occur. The compiler code to do this doesn't even have to complex, just flag class-members as stated in the scripts, and have the runtime send it.

I too would also like to now what is so boring about C++? I use it all the time, and I love it!

[1] No, but I have to start somewhere. >_> [2] No, but again, I have to start somewhere [3] Because, as I said, I don't like to write games in C. I like to write other stuff in C, just not games. [4] Well, I'm not going to make it completely easy. That would just be another BASIC clone. I think Classes, trash collection, inline assembly, etc would be a good addition to the traditional BASIC language. But, newbies wouldn't have to use those features if they didn't want to. By "limiting", I was speaking in terms of the feature set. [5] When I'm writing a game, I like to think from the design side. C/C++ is just not the language for me when I try to make a game. If I had something simple, yet powerful, I'm sure making games would be a lot easier for me.

About my time... honestly, I have a ton of it. I've been thinking for the last 3 days about something I should work on. A compiler finally popped into my head and I decided to give it a try. Besides, who says you have to use it? Or anyone else? I'm really making it for my benefit because I think it would help me in the long run. If other people like it and want to use it, more power to them. When you say it's a waste of time, you're speaking from your point of view. But, here's the thing... you're not making the compiler. I am. So, it's really up to me whether it's a waste of time or not.

Half of the things I end up coding turn into wastes of time. That said, they're wicked learning experiences.

I wrote my own compiler tools for some work-related language stuff, and it was a *pain*. That said, it was super interesting, and it helped me understand why gcc/cl do the things they do, and it was very rewarding.

I won't rain on your parade, but just know that it *can* be very difficult. I do wish you luck however.

You could join an existing open-source Basic compiler project like Mattathias Basic which is a freeware sequel to Amos Basic on the old Amiga computers and an open-source counterpart to DarkBasic. We are aiming to make it cross-platform compliant so that it will still generate code for the next generation PowerPC-based Amigas as well as for PC. If you're interested you might like to join the mailing list and read up on the progress first.

If you're looking for something closed-source that will only work on Linux, Mac, and PC, you're better off looking into buying BlitzMax instead. It's object-oriented like Mattathias but broke the backward-compatability mold with their Amiga version to better support the PC.

A custom language doesn't have to take a ton of time. I used Flex++ and Bison++ to generate my own compiler, and with no previous compiler building experience I have my own language in less than 3 months time.

[4] Well, I'm not going to make it completely easy. That would just be another BASIC clone. I think Classes, trash collection, inline assembly, etc would be a good addition to the traditional BASIC language. But, newbies wouldn't have to use those features if they didn't want to. By "limiting", I was speaking in terms of the feature set.

Agreed, beginner developers would not need to use the more advanced features. But to create anything really deep, you would need to use those features. You can make it easier to interface with low level operations, agreed. I just don't see why you don't create a C++ class to do that for you, instead of an entirely new language. But, as you said, you don't like using C to program games in.@cypher543

[5] When I'm writing a game, I like to think from the design side. C/C++ is just not the language for me when I try to make a game. If I had something simple, yet powerful, I'm sure making games would be a lot easier for me.

From what you are saying, it sounds as if you are an experienced programmer, expecially if you are willing to takle creating a new language(with the feature set you have described). So, why are you finding it so difficult programming in C/C++ for games? What makes a game so much harder than other apps you have written? The design side should be very code non specific. You should never even talk about what language you are going to use in your game design. The eventual implementation of your design will have tons to do with C++, not the creating of the design itself.@cypher543

About my time... honestly, I have a ton of it. I've been thinking for the last 3 days about something I should work on. A compiler finally popped into my head and I decided to give it a try. Besides, who says you have to use it? Or anyone else? I'm really making it for my benefit because I think it would help me in the long run. If other people like it and want to use it, more power to them. When you say it's a waste of time, you're speaking from your point of view. But, here's the thing... you're not making the compiler. I am. So, it's really up to me whether it's a waste of time or not.

Agreed, it is your time, you can do with it as you please. But you also asked on a forum what people though of your idea, your time. Don't ask if you don't want answers. I don't think I was being rude in saying I thought it was a waste of time given your target goals, which is game programming, not tools programming(from the information you provided). If you indeed do feel that you are more interested in programming a language than go for it, it sounds like a great challange, and a blast. But if your goal is to program games? Then no, this is not worth your time.@Kenneth Gorking

I do not agree that making a language too powerful will make it complex, on the contrary. Making a powerful script language is all about removing the low-level stuff from the user, and make simpler high-level interfaces that they can use instead.

From what I gathered he wasn't talking about a simple scripting language, he was talking a fully featured programming language, his feature set seemed to indicate that as well. As I said above yea, you can reduce the complexity by making higher level interfaces to low level stuff, but in the end, your going to need to do more than basic read and writes, especially when it comes to games programming. Like inline assembly, he wants that, how is that easier in his proposed language than in C++?

Cypher, in the end, it comes down to, do you want to program games right now, or later? If you want to program games right now, then this is a waste of your time, as you won't be programming games for quite a while(going under the assumption this is a fully featured language, not just a limited feature set scripting language). If you can wait, and you really like the idea of your proposed language, then go for it, it sounds like it would be a good time.

They created a custom LISP variant called GOAL (Game Oriented Assembly Lisp).

I'd just like to add that creating a variant of Lisp is a whole different ball-game than creating a completely different language compiler. Search around for LISP and "Domain Specific Languages". Lisp programmers tend to morph the language to suite there needs, rather than create a whole new language.

I'm not trying to dissuade you, but I don't think the Jak and Daxter's guys went the the trouble of a lexer and parser. They probably used the Lisp compiler and directly editited the code tree with macros.

I don't think I was being rude in saying I thought it was a waste of time given your target goals, which is game programming, not tools programming(from the information you provided).

I'm sorry if I sounded annoyed. I didn't think you were being rude, at all. My target goal isn't really game programming, it's making game programming easier for myself and for people like me who tend to not get the whole process.

Anyway, I think what I'm going to do is just write the basic compiler, then expand it with an OpenGL library. That way, people can write their own engines for it. Maybe I'll work on my own, that way newbies have something to work with. I know this is going to take awhile, but I'm so completely bored right now, and I need some exciting to do.

I would say it would be well worth your time then, since you seem to want to focus more on a game language, rather than game development itself.

Before you begin, it would be good to check out what some of the other game programming scripting languages do, and check on their forums to see what people do/don't like. That would give you a good idea of possibly where to start when implementing a feature set.

If you want to start some where you should buy a thew good books on the subject, there is no substitute for this as online resources are generally sparse and/or poor. Tutorials are not enough, you need to understand theory aswell, i suggest starting here.

Lastly do yourself a favour and use a more appropriate programming language for this such as SML, O'Caml, or haskell.

snk_kid: you keep amazing me with good links about language ponderings..I had almost given up on finding those..there really isn't much good stuff(or it's hard to find) dealing with "new" languages.. thx

Once you've got your head wrapped around these concepts the rest will just be learning syntax which is 1 a day job.@cypher543

Besides, I think Flex/Bison look very cool, and I doubt they generate lexers and grammar for SML, O'Caml, or haskell.

Each of those language have there own versions of lex & yacc (which is what flex & bison desecend from). C is just awful for compiler development even when you have tools to help out. Don't let the fact that GCC is written in C make you think otherwise because it really is a bad idea and it doesn't mean you can't write a GCC front-end in any language because you can so it's all mute.

The first place to start when creating a custom language (IMO) is the dragon book (it's proper name is "Compilers: Principles, Techniques and Tools"). It is the classical reference, and doesn't cover new or really advanced stuff. You might want to look at "Advanced Compiler Design and Implementation" by Muchnick, "Engineering a Compiler" by Cooper and "Programming Language Pragmatics" by Scott, but I don't know these books. Then there is alot of stuff on the .net.