Jump to content
  • Advertisement

Archived

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

jtecin

Script Engine (I think)

This topic is 6693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let''s see, I''m making this game and I hoping to make a script engine (I think that is what I''m talking about) which reads scripts from the user and then uses them. I''ll elaborate. . .I want the user to be able to say that if a certain event takes place, then go ahead and do an action. Now, carrying out the action is very simple. As for the if part, I could use a bunch of switch case statements but that would be inefficient. I actually found a way to narrow down the code uses classes and arrays, but I still think it is a little too inefficient and I can''t do everything I want. For instance, I want the user to be able to say if this event took place AND that event took place AND this event results in this, then carry out the action. I guess what I''m looking for is a simple solution (I doubt there is one, but sometimes the hardest questions have a simple solution) or some kind of resource which goes over this. Hmmmm, that might have been a little confusing, so tell me if I didn''t make any sense.

Share this post


Link to post
Share on other sites
Advertisement
Without knowing much more than what you say, I can suggest the following:

Firstly dont do the script checks all the time - perform them as little as possible (say once a second) as this will give more CPU time to the game and takes out unneeded parsing of scripts.

Secondly, you could half-compile the users scripts into bytes which you process.



regards,

GeniX

Share this post


Link to post
Share on other sites
Hi!

If you are going to implement your first scritping engine, then take a look at www.flipcode.com. They had a scripting engine tutorial series, covering everything from scanning, parsing, code generation and virtual machines. A nice intro, if you are new to this kind of stuff.

MK42

Share this post


Link to post
Share on other sites
Before you go off half-cocked and write a scripting engine, I HIGHLY recommend checking out Lua. Lua is an excellent scripting language which is ideally suited for games (it''s fast, it''s lightweight, it compiles to bytecode, it''s portable as hell ;-)

The Lua homepage is Here.

I''m using it for a backend scripting language in my game, and it was the scripting language used for Baldur''s Gate.



-- Pryankster
(Check out my game, a work in progress: DigiBot)

Share this post


Link to post
Share on other sites
You should also check out the Small language.

It''s designed mainly for speed and doesn''t have lots of features, but it''s fine with me. It also comes with an assembly bytecode interpreter and a just-in-time assembly compiler.

Pretty nice, although I couldn''t get the assembly stuff to work with VC++. Still, the code works very well and is easy to use.

Share this post


Link to post
Share on other sites
Thanx for your advice on the different tutorials on writing a scripting language, I will check those places out. I don''t really want to use someone else''s scripting language since the whole point of this project is for me to LEARN how to write my OWN scripting engine (I apologize for not mentioning that in my first post). Thanks again for all your replies.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!