🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Pros and cons of implementing my own script language

Started by
4 comments, last by darkbard 20 years, 10 months ago
Hi guys I''m writeing a tool for make RPG, and i''m trying to implement my own script language. I write it down but know someone ask to me that shold be better to implements a scripting language like Python or Lua, whitout creating a new one. So I ask to you: is better to implement my own language or to use an existing one??Why the mosto of games implements their own scripting language? I hope you understand, bye
Advertisement
Hey,
I''m also writing an RPG. I started to design a scripting language, then gave up and used Lua. I find Lua great, I think you should use it. Writing your own language isn''t very easy, and Lua works well, and is very easy to use.
The biggest benefit of rolling your own is that your scripting language will be domain-specific. Keywords and operations can reflect the reality of the game, making the language much closer to what you need.

Of course, the deterrent is the amount of time and difficulty in rolling your own. Plus, modern "scripting" languages have a bunch of OO stuffed into them, and you can usually simulate domain languages with decent classes.

Why do so many professional games roll their own? One reason might be control and safety: if the user can script their own Python, they have immense control over the game engine. If they''re restricted to an APL (application programming language), you can control how much they can do.

And a lot of game houses reuse the same tools/APLs/whatever on several different games. Coding your own scripting language for a one-off game might not be worth it. Coding one that can be extended and reused multiple times probably is.

Just a thought.
I''ve tried to make a scripting language, but the parser get to big and messy so I quit. There is a way to write a language without writing a parser and this is using generic parser. here is a tutorial:
A C-like scriping language

However, even that is pretty much to do, so if you choose Python or Lua, you can spend more time creating a game! =)

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. The who understand binary and those who don''t"
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
You still have the option of how much of your game you reveal to the external language, so whether you use your own script, or python, or lua, you can still choose how much power to give hackers.

The benefit of rolling your own is you have ultimate control over how it is. You can probably maximise efficiency with your own scripting language.

The downside is, one of the main reasons to use a scripting language is to speed up development and let you simplify some aspects of coding. If you''re goal is to speed up developement, and you want to write your own script, that could slow you down for the time it takes you to make the script.

The upside of using an external language, is how versatile the available scripting languages already are. If you use lua or python, you can use them for simple scripts, but you can also do very advanced stuff with them as well. And you still have control over how much of the game is exposed to scripting.

The downside is, you still have to figure out how to connect the language to your game, and you kind of have to do it how they have designed the scripting language. And for the script, you don''t have quite as much freedom at how its laid out.


If you feel adventurous and want to have control over your productivity, make your own. If you want to get on with the game, use an existing language.


It''s kind of the same with most things. If you want to make a game, liscence/use someone elses work. If you want freedom, do it yourself. I''m definately one to leech off others work as much as possible so I can focus on the game rather than the coding
I would suggest implementing your own scripting langauge as a learning experience. Most likely it will not make it big, as the current generation of scripting languages have their complexities that might be hard to implement into your language. However, after completing a release quality version of your scripting language, you should be more than ready enough to help on the bigger scripting languages (be it Lua, Python, Perl, etc).

And of course, your language could hit it big, and if that happens all the power to you.

A decent, but slightly dated, book on creating your language is
The Design and Construction of Compilers
. A little bit of a hard read until you figure out their Backus Naur Form, but still rewarding none the less.
[ Six Hour Game Contest | ( Thread | Blog | Wiki | 6hour Bio ) ][ Website | (Blog | Gallery ) ]

This topic is closed to new replies.

Advertisement