Jump to content
  • Advertisement
Vityou

Best way to add an interactive scripting language to a game

Recommended Posts

I am thinking of making a game like screeps, where you use actual programming to control the game, but I'm not sure about the best way to do this.  I'm probably going to use lua or javascript for the language, and I would like to represent units in the game as objects that the user can command and modify, with restraints based on the actual game, like how screeps does it.  However, I am not sure how to get started.  I think I have to use C or C++ and then embed the languages, but I'm not sure where to go from there, for example, having objects in lua actually correspond to units in the game.  Are there any resources that explain how to do this?  Also, I'm not concerned about the graphics of the game whatsoever, it might as well just be a text adventure as far as I'm concerned, I just want the user to be able to control the game through scripting.

Share this post


Link to post
Share on other sites
Advertisement
18 minutes ago, h8CplusplusGuru said:

One thing you could do besides script-binding, is you could have a language that the user programs in, they submit their program, you check it for validity and then do some magic on it, and then - - send it to g++. 

Isn't that what embedding a script is?

Share this post


Link to post
Share on other sites
1 minute ago, h8CplusplusGuru said:

No, it's executing a script ( lua ) vs running a binary ( say from c++ ).

Do you know of any resource that show how to do this?

Share this post


Link to post
Share on other sites
2 minutes ago, h8CplusplusGuru said:

which one

Either, whichever one is more popular or easier.  I just need a way for the game to be controlled in real time by the scripts.

Share this post


Link to post
Share on other sites
2 hours ago, h8CplusplusGuru said:

ok, so I understand how to add functions from C++ to a lua environment.  But what I'm looking for is how to add an object (a unit from the game) from C++ to a lua env for the user to access, and when the user does something with the object in the lua script, it is reflected in the actual game.

Share this post


Link to post
Share on other sites

You could also offer some kind of node based scripting language like an AI Robot game on Android (which name I forgott :P ) did. You wrote "programs" for your robots to solve quests against an opposing team of robots in it.

This could be something very simplified in UI like this childs toy from the 90s

image006.jpg

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!