🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Help in developing a scripting language

Started by
2 comments, last by darkbard 20 years, 5 months ago
Hi guys, I''m developing a scripting language that have to be used in a MMORPG. I got same problems, not releted to the language implementation, but to its design, usage and "usefulness". I think to build a scripting engine that makes me able to run script designed in a way that makes the "scripter" able to make something happen when a particular event is raised. For instance, I''d like to make a programmer able to create a Fireball-semiintelligent-wand using the following script and linking it with a structure (maybe XML) that rappresent its "static" structure (syntax it''s Python like because of I''m Python-addicted ):

#All capitals identifiers are predefined constants

#First we have to specify (for some optimization while compiling)
#the object we want the script to be linked
use as Items.Wand

#The following code is executed once,during object initialization
#It calls the set_charges() function of the Items.Wand object
#that set the wand''s charges
set_charges(100)

#the following code is executed after the player choosed to use
#the item but before performing any kind of action
when using:
	#The intelligent object knows if the enemy can''t be
	#hitten by fire, and if so, it tells to the player
	#$tagret is a special variable that contains an object
	#rappresenting the target
	if $target.is_immune(FIRE):
		speak “The enemy can''t be hitten by fire!”
		#We avoid the "used" event, so we don''t use the
		#wand
		avoid used

#the actions performed by the item
when used:
	#if there are enaught charges, it cast a fireball ...
	if get_charges() > 0:
		dec_charges()
		cast_spell(FIREBALL, $target)

	else:
	#... else the wan tells to the player it is empty
		speak “Ho finito le cariche!”

As you can see the script is not complex, but my problem is that I think it''s too powerful to be executed quickly by the server or by the client. Do you think that OO feature and events will make the scripting engine too slow?? Which are the features that a scripting language MUST have and which one it shouldn''t? Do you think this kind of scructure could work?? Objects are defined using C++ in the game engine, and functions used inside the scripting language are pointer to C defined functions (I think it''s not important to give the user the skill to define new functions ...) what do you think about that?? I know my question is not so clear, but I don''t know how to structure it better bye
Advertisement
The features that a scripting language ''must'' have? It depends; if it''s your langauge; it must obviously cater for your needs. Some established langauges try to be everything to everyone which creates features that you don''t need in your implementation.

Speed is a tricky one, it depends if you have a script compile to a VM bytecode language - this could be slower than a list of simple statements as it has more complexity. Features vs Speed can be a tradeof at times.
quote: Original post by darkbard
Do you think that OO feature and events will make the scripting engine too slow??

OO isn''t slow. Nor are events. What is important is how you implement them.

quote: Which are the features that a scripting language MUST have and which one it shouldn''t?

Sit down and write 5-15 sample scripts in your native language illustrating what you need to be able to achieve using your scripting language. Try to make them as diverse as possible. Then look at each one and think about how you would do it with your current scripting language. If it can''t be done, think about how you would adapt the system to make it possible. Once your language can do everything you want with it, it''s finished. Anything else, you don''t need - no matter if 1001 other games absolutely needed it for their game.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
quote: Original post by Kylotan
quote: Original post by darkbard
Do you think that OO feature and events will make the scripting engine too slow??

OO isn't slow. Nor are events. What is important is how you implement them.

quote: Which are the features that a scripting language MUST have and which one it shouldn't?

Sit down and write 5-15 sample scripts in your native language illustrating what you need to be able to achieve using your scripting language. Try to make them as diverse as possible. Then look at each one and think about how you would do it with your current scripting language. If it can't be done, think about how you would adapt the system to make it possible. Once your language can do everything you want with it, it's finished. Anything else, you don't need - no matter if 1001 other games absolutely needed it for their game.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]


I literally am doing this right now. I created a scripting syntax that looks a lot like BASIC. For my tests I came up with famous movie scenes to recreate. My first is the convo between Neo and the Architect. Then it will get increasingly more complicated with conditions and object interaction.





[edited by - Jenison on January 14, 2004 6:15:24 PM]

This topic is closed to new replies.

Advertisement