Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Implementing scripts


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 DashRush   Members   -  Reputation: 102

Like
0Likes
Like

Posted 02 July 2011 - 06:46 PM

I have come to a point in development, where I would to have things be simpler, instead of lengthy code segments, I would like to make a system of scripts that can be loaded in at any point, as needed.

Does anyone her, know of a tutorial, or any sort of thing that could help me create this sort of system?

Sponsor:

#2 Endar   Members   -  Reputation: 668

Like
1Likes
Like

Posted 02 July 2011 - 08:32 PM

You basically want to be looking at tying scripting languages like lua and python into C/C++ (assuming that's what you're using). I can't think of any tutorials off the top of my head, but once you've chosen your scripting language, you should be able to find it easily using google.

Basically you'll want a game object of some sort that will wrap a script and update it with the rest of the game in the game update loop. There will also be a way, no matter what scripting language you use, to bind (convert) a script call into a C/C++ call, so you'll be implementing those functions as well.

Basically, take a look on the forums about what scripting language to choose because, there have been many many people that have asked in the past, and it partially relies on what you'll be using it for and how you want to use it. When you've made a decision on language, then you can look at how to integrate it into your game.
Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper

#3 Dawoodoz   Members   -  Reputation: 331

Like
0Likes
Like

Posted 04 July 2011 - 02:39 AM

If you have the time and think that it is fun, you can make your own programming language and your own virtual machine running it. It will not perform as good as LUA or Java but you will learn a lot and have a better integration with your game. Just have an array for the memory with the call stack, virtual machine code and dynamic allocations, an integer as the program pointer, another integer as the stack pointer and a compiler that translates into the virtual machine code.

My open source DirectX 10/11 graphics engine. https://sites.google.com/site/dawoodoz

"My design pattern is the simplest to understand. Everyone else is just too stupid to understand it."


#4 Exorph   Members   -  Reputation: 105

Like
0Likes
Like

Posted 04 July 2011 - 03:01 AM

The chapter on scripting in Game Coding Complete (3rd ed.) helped me out a lot. So if you can get a hold of it, I'd recommend it. It's a great book overall.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS