Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Scripting Idea

Started by Mulligan Jun 29, 2004 at 2:32 PM 35 replies 3k views
Original Post
Mulligan
Mulligan
This is generally how it will work: Scripts are stored in dll files. The dll will contain several standardized methods that all scripts will contain. For instance, all scripts will be based off a simple framework class. Something like


public class Script
{
	public void Init()
	{
	}
	public void Update()
	{
	}
}

I will create a simple IDE allowing someone to write code in C# or C++.NET, and the free command line compiler on microsoft's web site will compile the code into the script dll. The engine will scan a directory for the dll's and load them as needed. Thats the overview, sound ok?
Mulligan
Mulligan
Oh yea, i guess it is. Hum, ive made a plugin system before but that didnt even occur to me.
Nemesis2k2
Nemesis2k2
Rather than a whole bunch of functions in a container class, I went with a single function that uses a message system. It means you can ignore functions you don't want to use in a perticular script, and it cuts down the number of functions floating around. Generally, I think it makes the thing neater, and more extendable. Rather than creating another function, you create another message.

Quote:
That's a PLUG IN system, not scripting.

Meh. I'll be using a similar system for my game, and I consider it a scripting system. What's the real difference anyhow? You can use it in the same way in all the ways that matter, and it solves the exact same problems as actual scripts, it just happens to be pre-compiled to machine code.
Raduprv
Raduprv
There is a huge difference between a plugin system and a scripting system:
The scripting runs in a sandboxed VM, so people can't include malicious code. Also, using a scripting language can make things easier, because the scripting languages are usually more 'powerful' than C/C++
Nemesis2k2
Nemesis2k2
I'm commenting about the same thing in another topic right now, so I'll drop this.
Toxic Hippo
Toxic Hippo
I was using a system just like this for my last engine before it was destroyed in a freak electrical-fire "accident." Worked fine for me. [smile]

Go with it or pay the price. [wink]
Max_Payne
Max_Payne
Quote:
Also, using a scripting language can make things easier, because the scripting languages are usually more 'powerful' than C/C++


Its the exact opposite actually. Scripting languages are usually more limited than C/C++. They don't give you as much freedom, because they are simpler. The fact that they are simple seems to make it easier to some as in simple scripting languages, there are not 3000 ways of doing the same thing.

Looking for a serious game project?
www.xgameproject.com
Raduprv
Raduprv
Quote:
Original post by Max_Payne
Its the exact opposite actually. Scripting languages are usually more limited than C/C++. They don't give you as much freedom, because they are simpler. The fact that they are simple seems to make it easier to some as in simple scripting languages, there are not 3000 ways of doing the same thing.


When I said 'powerful' I didn't mean it as "assembly powerful" but rather as in "english powerful".
pTymN
pTymN
For a small time developer, plugins would be MUCH better. No binding all the important libs to the scripting language, and no writing a parser. Just write an interface and plug it in. :)
 
VizOne
VizOne
If security is an issue, don't mind. It is relatively easy to put the .NET script into a restricted sandbox-AppDomain to prevent e.g. File I/O etc.

I'd suggest JScript.NET or VB.NET as the scripting language as C# is more complicated (for potential scripters) compared to those two.

Regards,
Andre
PinguinDude
PinguinDude
Ok, now this is a bit off topic but does vs.net 2003 have a script control like in vb6 :O?
And something else, I think the plugin idea with a small IDE and using the free compilers is a good idea :)
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
Etnu
Etnu
Scripts in .dlls are a bad, bad idea. Malicious code can easily be inserted and no antivirus software will be able to spot it. All your end users will know is that running YOUR GAME broke THEIR COMPUTER.

Try a real scripting system. One based in C# seems like a likely candidate for implementation, especially as the DX docs for the summer '04 release should have details on how to implement it.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
King of Men
King of Men
Quote:
Original post by Raduprv
There is a huge difference between a plugin system and a scripting system:
The scripting runs in a sandboxed VM, so people can't include malicious code.


Well, in principle they can, if you make your script parser good enough. There's no reason a scripting language shouldn't include the ability to mess with the operating system, after all. ;)
To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
bytecoder
bytecoder
Quote:

Its the exact opposite actually. Scripting languages are usually more limited than C/C++. They don't give you as much freedom, because they are simpler. The fact that they are simple seems to make it easier to some as in simple scripting languages, there are not 3000 ways of doing the same thing.

*cough* python *cough*.
Quote:

There is a huge difference between a plugin system and a scripting system:
The scripting runs in a sandboxed VM, so people can't include malicious code. Also, using a scripting language can make things easier, because the scripting languages are usually more 'powerful' than C/C++

Don't forget one of the main reasons for using scripting languages: no compile times. Using a dll system takes away that feature, which is one of the best reasons to using a scripting system, IMHO.
Raduprv
Raduprv
Quote:
Original post by King of Men
Well, in principle they can, if you make your script parser good enough. There's no reason a scripting language shouldn't include the ability to mess with the operating system, after all. ;)


There is a very good reason, called security.
King of Men
King of Men
Quote:
Original post by RaduprvThere is a very good reason, called security.


See the wink smilie? Indicates irony. Possibly I should have said "no technical reason" to please the literal-minded. But then it wouldn't have been funny.
To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
Raduprv
Raduprv
Your irony was too subtle.
In a normal scripting language, it's a good idea to allow the user to access OS functions, such as files I/O. On UNIX, there are more scripts than binaries.
However, in a scripting embedded in a game engine, it's different.
Kibble
Kibble
Lots of programs use DLL plugins and I haven't heard of any major problems stemming from this. Halflife worked this way I'm pretty sure. That said, there are lots of other reasons to use a scripting language.
Raduprv
Raduprv
Quote:
Original post by Kibble
Lots of programs use DLL plugins and I haven't heard of any major problems stemming from this. Halflife worked this way I'm pretty sure. That said, there are lots of other reasons to use a scripting language.


Sure, but that doesn't mean it can't happen.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.