Archived

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

DJ_House

Scripts for games

Recommended Posts

DJ_House    122
I''m looking to start work on an adventure game, BUT how do I do the scripting? I read the article on here that uses VB, which didn''t help at all. So if I should create my own scripting language, where do I even begin? I can''t even think of the theory behind creating your own scripting language.

Share this post


Link to post
Share on other sites
frankd    164
Have a look at my post earlier on. Some bloke recommended python as a tie-in scripting language. www.python.org I think.

Frank

Share this post


Link to post
Share on other sites
LilBudyWizer    491
That is one way to use scripts, but if you mean scripts like a screenplay then no. Rather it is like macro languages for applications like word processors and spreadsheets.

Share this post


Link to post
Share on other sites
BeamMeUp    122
You don''t necessarily need a scripting language for game dialogue. Scripting languages are generally more powerful than that, and require a lot more time to write. Instead, you could save a dialogue list, full of different strings that characters can say. Each string in the file has a different ID number. Load that list into memory (or access it when necessary), and give characters a variable (''DialogueID'', for example) that tells your program which string they will say.

Of course, this is a very simple method, but it''s an easier alternative to a scripting language. The major downfall is that each character can only say one thing. But it all depends on the complexity of your game... have you considered using .dll files? Quake 2 uses one or more for each of its game types, but I''m not sure if you can write your own .dlls in VB.

Anyway, I hope that helped.

-----------

C++ is the language of the not-so-ancients.
Learn to speak it well.


BeamMeUp

Share this post


Link to post
Share on other sites
Blackstream    122
Hey, if you want ideas, try taking a look at one of the best Level Editors and Scripting Language in the world (IMHO, of course). It is called ZZT. Go to the Epic MegaGames website, the other website that the company that made Unreal owns, and download ZZT (its freeware now, BTW). True it is an ASCII thing, but it has probably the best scripting language ever. I suppose you could call it an interpreter as well... I wouldn''t though because of the way the interface works. You''ll see.

-Blackstream

Share this post


Link to post
Share on other sites
LilBudyWizer    491
I would recommend doing it BeamMeUp''s way first. That moves you a step forward, raises some issues like how you get the id on the character and gets you moving in the right direction. Dialog can get pretty complex, but you have to start simple. A step up would be to put an additional id in the file and use that id on the character so they make a whole series of statements or random statements such as rumours or tips. A step up from there is a branching dialog which takes a seperate file. The new file has three columns. When the user initiates a dialog with the character you search for the id from the character in the first column. There may be multiple matchs which is the differant things the user can say. The third column gives the id of the characters response to the selected statement. The second column gives a value that is searched for in the first column giving the the next set of statements the user can select from. Finally you add a fourth column to that list. That indicates if the option is always present, present only when a need of the character is unmet or present only when the characters need is met. Now you have the ability to give the user quests. If they haven''t completed the quest they can ask about the quest, but if they completed they get and option to say they completed it.

Those files are a simple form of script. You basically save them in a CSV file like you could save from MS Excel. Someone else can then modify your dialog without touching the code. You could even make a dialog editor that displays it in a tree so it is easy to follow. You could also save the character information in a file and provide an editor for that. You can go quite a ways with this basic approach. You can add more and more columns to the second list to cover things like alignment, reputation, time of day, whether it is the second tuesday of an odd month of an even year or whatever you dream up. At some point you have a huge mass of code covering all the possiblities with most of them not being used except in specialized circumstances. That is where scripting really comes into play. You just assign a user a script and run it whenever the user initiates a dialog. That script handles checking all relevant conditions and responding accordingly. You provide functions for checking state and character information as well as being able to display a list of statements for the user to select from returning their selection. Something like Python is a complete language so they can do anything they want with that information. As a programmer all you have to do is provide accessiblity to the information they need to make the right decision and the ability to interact with the user.

Without a designer all it really does is declutter your code. Instead of all those statements in your code or a table of values that make you check all possible conditions it is in a script. With a designer it saves you from having to change your program every time they get a wild hair to do yet another type of check. More importantly it lets you focus on giving them access to the information they need rather than how they want to use it. Generally it results in a far more functional product because usually only one person works on a specific source at a given time and that person might have higher priorities while someone else is relatively idle. By getting it out of your source they can make the modifications without interferring with the programmer.

Share this post


Link to post
Share on other sites