   General Scripting Practice
  Hi,I would like to hear some advice on which practice is better:- to use a scripting language and write most of the game itself in it, relying on the main game code and engine as "function providers" only, or- to use a scripting language as an external helper language only, for performing menial jobs and simplification of some tasks and future upgrades?TY!   
  Whichever one suits you best. Most people write their program and use a scripting language for flexibility. A scripting language is for letting the end-user modify the game to his needs/create mods/etc. Some people find it easier to write a whole game in a scripting language, others use it for small things like dynamic setups and stuff.   ;Quote:Original post by Mr GojcaI would like to hear some advice on which practice is better:- to use a scripting language and write most of the game itself in it, relying on the main game code and engine as "function providers" only, or- to use a scripting language as an external helper language only, for performing menial jobs and simplification of some tasks and future upgrades?This is a false alternative: you can both have an architecture with modules in different programming languages and offer a number of scriptable extension points.How the program is written and support for scripted extension and customization are separate concerns; in fact you could use different languages in each case. ;  In general, if you don't know what you'd use a scripting language for, you probably don't need one.  I went over this myself at one point.  If you can do everything in a regular programming language that you can do in script, what do you need a scripting language for?  For smaller projects, there really is no answer to that question.  If you can compile your project in 30 seconds, there's really no reason why you should go ahead and complicate it with a scripting language.  Maybe you want to consider exposing data outside the program through a text file, database, spreadsheet, etc., but a scripting language may be overkill.  When a scripting language starts to become really useful is when your project has grown to the size that a single modification triggers a half-hour build.  How many times can you build your project at that rate in a 8-10 hour day?  That's where you really start to see the benefit of having your scripts compile in 5 seconds.   ;  I don't agree at all with this statement.It really depends on what you want your script for, but general tendance is to have a higher level langage than C/C++, like C#, Python, ...If this langage gives you :1) easier langages sure makes programming easier, so less bugs, no more string issues, no more memory issues, just plain game play programming ( at that's often enough for a team ).2) rapid iteration. That can't be stressed enough. Your job as a coder is to write code, test it, and when something is wrong, change the code, or if every thing is OK, make it better.So it's always writing, and testing code. If compiling and launching the game takes 5 minutes, you're limiting yourself.With experience I found that being able to iterate on the code _really_ quickly makes you being more eager to modify the code, to test new things, to try more cases...That said, there are several points to considere :* Who will be be using this language ? If it's not for some kind of coders, it may be a mistake, artists don't usually cope well with any language.* Be careful when integrating a script in your engine. A good debugger is a must have, as well as hot reloading/ recompiling of the script.I work with this stuff both professionnally in a big team, making big games (with a custom language/ and all customs tools ), and at home, on my little engine, with python, and public tools, and I really think it is THE way to go...Hope it helps,   ;  I personally don't buy into the concept of "easier language".  All that means to me is "stripped down language".  If you don't want people doing their own allocation in the game code, you can write a memory management system to take care of that; one specialized to your game.  If you don't want people allocating their own arrays, use the STL or provide your own custom container.A language like C++ is going to behave basically the same as a scripting language when you are comparing equivalent features.  C++ does allow you to do more, but you don't have to use that functionality if you don't want to.  Just because it supports multiple inheritance doesn't mean you have to use it everywhere if you code in C++.  But it does mean that you have those tools in your toolbox if you need to pull them out.  In my opinion that's better than running into situations where you just can't do what you need to do, or you can't do it in an efficient enough manner to run in realtime, just because the language you're using has a limited featureset.Scripting languages frequently don't even support all of the data types.  So you may end up using an array for something you really ought to be using a linked list for.  If you only have a few minor modules written in script that's fine, but in practice most if not all of the game code ends up in script.  How are you supposed to push performance boundaries to produce a top notch product when half of the necessarily inefficient script code you're executing is running at 1/20th the speed of native?  Somebody else can deliver a more impressive game with the same hardware just by finding a way to use less script.   ;  (previous anonymous poster in favor of scripting language here)Whaooo !!!I do think they ARE a lot of reasons to stick to C++, but the quality of the language would never be in it...C++ is a really old, made over C, language, and its old age starts to be a problem.Why do you think they are so many new languages everywhere ?Why is Microsoft pushing C# ? Sun pushing Java ? Google using python ?C++ is not by any way as easy as most of these languages. And memory allocations, string allocations, container allocations are really part of the problem. That, with the include system, the template ( a very good idea, but a really poor implementation ), no deal with multiprocessors, ...I've been programming, as a professional, for many years now, with a lot of clever people, and we always discover some new subtilities with C++. Read each of the Guru Of The Week on Herb Sutter' site.It is really awfully hard to master the language. And not mastering the language means sometime ( usually, we you don't have time to deal with any problem ) a problem will come up, and you won't understand it...Last but not least, the object model in C++ is quite old too. They are things you can't do with it. Polymorphism is linked to heritance, there is no reflexion, ...I don't want to go in a language flame war, as I really like C++ for what it's good at : making some high performance code with a decent object model, and I use it every day, and most of the time, the switch to script language _on the part I work on_ would be a mistake.Another huge advantage C++ has is the codebase there is every were, and how it is used every where. It also means it is the language most coders are good at. And this is something that will take quite some time to evolve.And one last point : script languages are not used in game engine for performance part. But they are still used very widely, because they are so many things to do in a game where we don't have to deal with performance.If performance of script language was really a problem, they wouldn't be used by so many games.Now quite every real big game uses script language.If most people in the industry has decided to go this way, there must be some reasons !Hope it helps,   ;  C++ may not be the easiest language, but it's only incrementally more complex than other languages, and in my opinion not a reason in itself for a programmer not to use it.The most common argument I've heard for not using C++ is memory management.  If it's an issue, you (or someone in your company I'm sure) can write your own garbage-collecting memory management system that's optimized for your game.  Or (what I personally think is better) you can write an ingame memory monitoring tool that keeps track of your memory usage, what you've allocated and where, etc. so you can more easily deal with any issues that come up.  The point is, even in the area of memory management, C++ is more flexible than any scripting language is ever going to be because you get to decide how you want to deal with it.  It is an old language, but the way that processors work hasn't fundamentally changed over its lifespan either.   ;  In response to the original poster:If you want to create some general-purpose engine, the first alternative might be better, because you wouldn't be limited to what the engine was designed for (not nearly as much anyway). For my project, I'll use scripts to support plugins/mods (scriptable weapon behaviours for example), and there it seems  better (imho) to write the engine (which will have to be quite optimized) in C++, and the plugins/mods in script.   