Archived

This topic is now archived and is closed to further replies.

Peter19852001

About game scripting language

Recommended Posts

Peter19852001    126
Hi! I now have a simple language in mind and would like to implement it. I want to do this simply because I want to get experience. I have not done this before though I have learnt programming for a few years and have done a few little games. So I would like to know your opinion. The language has following features(for now) --functional style --prefix notation --token seperated by space --no assignment operator provided --recursion encouraged --run on small VM --array as main data structure --no garbage collection maybe more What do you think?

Share this post


Link to post
Share on other sites
RhoneRanger    100
writing a scripting language is no menial task. There are thousands upon thousands of lines of code that go into it.

If you have "never" done it before, you are in for a HUGE surprise! Especially doing all the things you want to do.

I would start out by doing a scripting language in Python or something similar while learning about creating a scripting language using flex and bison (or lexx and yak).

Share this post


Link to post
Share on other sites
Wutz2003    122
I once tried to implement a super-limited scripting language for a simple little game in VB. I thought all I had to do was to parse for some words in the script text (=function names) and then do something with the numbers that come right after the word (=parameters). Sounded logical to me. I ended up having tons of Select Case''s (switch statements in C), and as the game became more and more complicated, I was about ready to OD on some weird drug and broadcast my withering away live on the internet (but eventually, I didn''t do it).

Then I decided to use the VBScript Control Object that some nice guy at Microsoft had programmed for (stupid) people like me, and all my problems were solved

Share this post


Link to post
Share on other sites
skap20    122
Read Jack Crenshaw''s "Let''s Build a Compiler" on http://compilers.iecc.com. Using his methods, simple compiler (or scripting language) construction is really easy. I was surprised when I started getting into compilers I thought it was so complicated. But for a simple language it really is easy!

Share this post


Link to post
Share on other sites
stodge    144
quote:
So my point is, if there''s no clean way to do it in VB, then there''s no possibility to do it whatsoever.


lol - Yeah like VB is the only way of doing anything!

Writing a scripting language is a HUGE undertaking. I would recommend using an existing one, such as Python or Lua. There are loads of scripting languages around so try a few out and see which suits your needs best.

Share this post


Link to post
Share on other sites
__Daedalus__    480
Perhaps the book "Game Scripting Mastery" would help you out. I got mine ordered of amazon but it takes 1 - 2 weeks to come in :-(

Don''t let these people put you off :-) I do everything for my game including writing the engine and the artwork, sound ... what a nightmare. One minute i''m sitting with a game engine book and then next day I have a 3ds max fundamentals book LOL.

Share this post


Link to post
Share on other sites
Hey Peter,

I started off on my own scripting language by following
this about two years ago.

Its been hard work, late nights, and lots of debugging. It wasn't easy, but it was well worth it.

From knowing just about nothing about compilers and VM's, in two years i've created a pretty darn good scripting language: the compiler, VM and source lever debugger. My best work yet.

My advice to you: Go for it!
If you get stuck, you're welcome to contact me. I'd like to share what I've learnt.

Good luck

EDIT: Typo in the link....

[edited by - Jaco vd Westhuizen on January 30, 2003 5:41:38 AM]

Share this post


Link to post
Share on other sites
Dino    172
Why not just use normal C/C++ language and place what normally would be scripts in a DLL. The only advantage the scripting language gives you (especially if it''s interpreted at runtime rather than compiled into a psuedo-assembly code) is the ability to alter the script at runtime and have it execute the new code without having to restart the game.

I was thinking of writing my own scripting language at one point. I even took some compiler classes at Drexel U. But after a bit of research and seeing the pros and cons of a scripting language, I opted for the DLL approach.



Dino M. Gambone
Good judgement is gained through experience. Experience, however, is gained through bad judgement.

Share this post


Link to post
Share on other sites
Extrarius    1412
quote:
Original post by Dino
Why not just use normal C/C++ language and place what normally would be scripts in a DLL.[...]
I agree that using a DLL for logic is a good idea for many games (as Half-Life did), but for many other types of games, its not as great.

A good example of where a dll wouldn't work so well is warcraft 3. If each map included a dll with all the code in it, going on battle.net and playing a map made by somebody else could be a bad thing for your computer. You would have no way of knowing if they put the code to delete every file on your hard drive in there, but you would find out fast when you download the map the first time and the "ShowMiniMap" function is called to let you preview the map while you wait for the game to fill up. It wouldn't be pretty.

When the scripting language controls the logic of the entire game, it might be a good idea to use a dll instead, but if it controls per-level things, it is probably better to make it a scripting language.

[edited by - Extrarius on January 30, 2003 9:28:49 AM]

Share this post


Link to post
Share on other sites
crackingod    122
Hidden
I would like to implement Python in my Engine, Any resources???
I already read the gamasutra article, I would like something with some examples and some more technical stuff

Share this post


Link to post
Bu6mAn    122
Is LUA suitable, for developing a VirtualMachine like scripting system? Using opcodes for instance, like the old Lucas Arts SCUMM Engine did? Or in that case is it better to develop my own?

Greets, Alan //

Share this post


Link to post
Share on other sites
Fruny    1658
quote:
Original post by crackingod
I would like to implement Python in my Engine, Any resources???
I already read the gamasutra article, I would like something with some examples and some more technical stuff


Extending and Embedding the Python Interpreter
Extending and Embedding Hints.



[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

Share this post


Link to post
Share on other sites
Fruny    1658
quote:
Original post by Bu6mAn
Is LUA suitable, for developing a VirtualMachine like scripting system? Using opcodes for instance, like the old Lucas Arts SCUMM Engine did? Or in that case is it better to develop my own?



You''re better off directly interfacing with Lua than using it to write a bytecode interpreter.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

Share this post


Link to post
Share on other sites
quote:
Original post by stodge
Jaco: Care to share a demo of your scripting language? I''m sure many people would be interested in seeing it.

Thanks


I''ve got a couple of things to sort out still, but will definately release a little demo soon.

Share this post


Link to post
Share on other sites
Bu6mAn    122
quote:
Original post by Fruny
You're better off directly interfacing with Lua than using it to write a bytecode interpreter.


Thought so, but i'm not sure yet which implementation (Pure Interpreter or VM) is better for my engine project. The approach that Lucasarts used was the VM, but we should keep in mind that machines were pretty slow in those times (actually it first was developed for the C64).

I've read that the pure interpreter is one of the slowest imlpementations for a scripting system, and the Virtual Machine would be much better, but will keep on researching. Any thougts?

I'm currently reading this series (http://www.gamedev.net/reference/articles/article1633.asp) to understand the VM implementation, i would like to have the pure interpreter approach too, so if anyone knows some tutorials or articles worth reading..let me know.

Thanks again //

[edited by - Bu6mAn on January 31, 2003 10:40:07 AM]

[edited by - Bu6mAn on January 31, 2003 10:41:36 AM]

Share this post


Link to post
Share on other sites