Jump to content

  • Log In with Google      Sign In   
  • Create Account


When is best best to use a scripting language?


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
7 replies to this topic

#1 MadaraEyesOfTruth   Members   -  Reputation: 104

Like
0Likes
Like

Posted 14 December 2012 - 02:26 AM

When is best best to use a scripting language API, like lua and python?

EDIT: For a turn-based RPG like Dragon Quest and Final Fantasy.

Edited by MadaraEyesOfTruth, 14 December 2012 - 02:46 AM.


Sponsor:

#2 doeme   Members   -  Reputation: 684

Like
0Likes
Like

Posted 14 December 2012 - 02:28 AM

Now would be a good time to use it. :)
I think you need to be a bit more specific with your question.

#3 Ashaman73   Crossbones+   -  Reputation: 6734

Like
0Likes
Like

Posted 14 December 2012 - 02:29 AM

They are best used where the requirements invites to use them.

So, have you a concrete use case in mind ?

#4 Khatharr   Crossbones+   -  Reputation: 2852

Like
0Likes
Like

Posted 14 December 2012 - 02:51 AM

Scripting engines are useful if you want to be able to quickly and easily work with content generation like npc behavior or dialog events, etc.

It's a lot of work to embed a scripting engine though, so if your content is going to be static (not changed often) then you may want to weigh the cost vs benefits.

That being said, if your game engine is complete and you get the scripting engine set up correctly you can crank out or change content pretty quick from that point onward, and once it's in place adding or exposing new functionality to the scripting engine is easier than the original embedding process.

There is one danger that some people overlook, so I should mention it. When you expose functionality to a scripting engine you're creating a sort of barrier between high and low level work. If you make this too low-level then your scripting engine will slow down the game, but if you make it too high-level then you're limiting the ways in which you can use the game engine (and you'll end up crapping out tons of new script methods for every new thing you want to do). It takes a lot of thought to place that barrier in just the right place.

Edited by Khatharr, 14 December 2012 - 02:52 AM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#5 MadaraEyesOfTruth   Members   -  Reputation: 104

Like
0Likes
Like

Posted 14 December 2012 - 02:56 AM

Those I do understand, scripting languages aren't as fast as compile so I shouldn't do anything time critical like physics with it, but couldn't I do things like dialog events with sqlite3?

#6 doeme   Members   -  Reputation: 684

Like
0Likes
Like

Posted 14 December 2012 - 03:02 AM

Those I do understand, scripting languages aren't as fast as compile so I shouldn't do anything time critical like physics with it, but couldn't I do things like dialog events with sqlite3?

Using scripting for dialogs and other similar events is a good use of it. Wheter you're using a sqlite backend or something other depends on your need. However you have to be aware that the execution of your scripts might block the execution of the rest of you game, so having file or db accesses there might slow down your whole program.

#7 Khatharr   Crossbones+   -  Reputation: 2852

Like
1Likes
Like

Posted 14 December 2012 - 05:10 AM

Uh... I don't know if I'd use SQL for this kind of thing, but I guess whatever floats your boat.

Typically you'd create top-level functions in the code that produce canned effects based on parameters, such as opening a dialog window, playing a sound, showing a character portrait, etc. Then you can expose those to the scripting engine as methods and write a script that calls them with the desired parameters to create your dialog such as:

openDialogWindow(SCREEN_BOTTOM)
pic = loadCharacterPic(GREEN_MAN)
showCharacterPic(pic, BOTTOM_LEFT)
dialogWindowText("Behold, I am Green Man. I have come for your cheese. You have no chance against me. HAHAHAHAHAAAAA!")
waitForKeyPress(CONFIRM_KEY)
closeDialogWindow()
pic = nil
startBattle(BATTLE_32, BOSS_FIGHT)

etc...

Using scripts gives you advantages like simpler syntax (for writing / changing things more easily) and not having to recompile all the time. With some scripting languages you could even change the script on-the-fly if you set it up that way.

Edited by Khatharr, 14 December 2012 - 05:12 AM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#8 bluepig.man   Members   -  Reputation: 388

Like
0Likes
Like

Posted 14 December 2012 - 06:28 AM

Using scripts gives you flexibility,Keep your code clean and tidy.Posted Image
So if you feel like they will be needed.It's the time to use it.




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