Jump to content
  • Advertisement
Sign in to follow this  
Avenyr

Game scripting?

This topic is 4850 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

I have been doing some design lately on a 2D game editor and I have stumbled one important part of the editor where I have no knowledge whasoever about and that's scripting. Now The way things are is that I am trying to hard code only the necessary parts that will not change during the game such as the 2D renderer and the Music player and stuff like that. I wanted to make up a "script editor" in which I could soft code the some of the game logics that could change during gameplay such as the the enemies behaviour/AI, Level events triggered by certain situtions such as a ship touching a bonus capsule giving it the bonus, changing the scrolling speed on the spot using events and stuff like that. I want these to be changeable through scripting in a way that I don't have to hard code recompile every time I make a single change to the game. I know about some scripting languages used by many of you such as Lua and Ruby and maybe Python but I think it's more than a scripting language. Now what I want to know about this is what kind of questions should I ask myself about what would be more "appropriate" for me. I do think any of them will serve my purpose right but my biggest concern is how it will work with the hard-coded program. How am I suposed to set it up so that my engine interprets the scripting languages to get it to affect the elements in the game I want to modify. The way I see things right now is that I will have to find a way to get the scripting language interpreter to run as a part of the engine. It will have to be able to load the script files made with the editor and run them at runtime without a need of recompilation if I was to change a simple value in one of the scripts. I don't know if my information is correct, partially correct or completely off track but I'm am looking for a little starting info so that I can start reading and working on the subject as fast as possible. This seems really exciting and powerful. By any means, if you can guide me on the actual process of such an idea and what book/tutorial/website I should look up on this subject, I would really appreciate it. Thank you very much for your time and replies [grin] [Edited by - Avenyr on August 6, 2005 1:03:53 AM]

Share this post


Link to post
Share on other sites
Advertisement
Generally, scripting interfaces allow you to tell the interpreter about 'real' functions (meaning ones you coded in C/C++) and it will then allow scripts to call these functions. In this way, you interface the scripting language with your engine. While it sounds rather easy to use, it can become quite complicated because often you want to limit the scope of what scripts can do (to prevent cheating, viruses, etc) so you'll have to make a middle layer of functions that get called by scripts, verify everything is ok, and then passes the call onto the engine.

There is quite a bit of information on interfacing with Lua on the internet, and there is the boost::python library that helps you interface with python.

Share this post


Link to post
Share on other sites
So with that said do you recommend using scripting the way I see I would use it or would you recommend another method to achieve the same result ?

I have been told to hard-code everything tonight using a entity system like Half-Life does but I would need more information on that.

Up to now I am doing some research on this entity system but there doesn't seem to be much of a "things start here" tutorial about that. I'll keep looking for this tomorrow since it's getting late.

Thanks for your reply !

Share this post


Link to post
Share on other sites
In my system I am using an entity system (w/ lua):

I got a few entities that executes level-specified lua code when it recieves events. such an entity can be a PositionEntity(executes the code when the player comes near it) or a ButtonEntity(if you use it it executes the script).
Enemies has a OnKill script that can be executed(when it dies).
I have registred lua functions that can enable enemies, destroy objects, set them(objects) moving in a predefined manner, create an explosion,launch movies or chage levels.
At the beginning of the level a lua-file is executed(if it exist).

Hope that this info helped ;)

Share this post


Link to post
Share on other sites
In my game I'm creating my own inside-game script editor, because I think that there would be limitations if I would use some script-language. This way my scripts can do anything in the code; there is list of possible events (move creature, spawn creature, destroy object, change level, end level, loose life, delay script, play sound ...) and you can create a list of these actions which will form the scripts.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!