Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » AngelScript - AngelCode Scripting Library
AngelScript - AngelCode Scripting Library [message #34353] Fri, 18 November 2011 10:37 Go to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Homepage:
http://www.angelcode.com/angelscript/

License:
zlib

Version:
2.30.0 (February 22nd, 2015)

Description:
The AngelCode Scripting Library, or AngelScript as it is also known, is an extremely flexible cross-platform scripting library designed to allow applications to extend their functionality through external scripts. It has been designed from the beginning to be an easy to use component, both for the application programmer and the script writer.

Efforts have been made to let it call standard C functions and C++ methods with little to no need for proxy functions. The application simply registers the functions, objects, and methods that the scripts should be able to work with and nothing more has to be done with your code. The same functions used by the application internally can also be used by the scripting engine, which eliminates the need to duplicate functionality.

For the script writer the scripting language follows the widely known syntax of C/C++, but without the need to worry about pointers and memory leaks. Contrary to most scripting languages, AngelScript uses the common C/C++ datatypes for more efficient communication with the host application.

Documentation:
http://www.angelcode.com/angelscript/documentation.html

In the attachments you could find AngelScript source code, add-ons, samples, converted to U++ packages and documentation.

To note:
There were minor changes for include files for original sources to adapt for U++ package structure.

Edit: Updated to 2.30.0 version.

[Updated on: Wed, 29 April 2015 23:00]

Report message to a moderator

Re: AngelScript - AngelCode Scripting Library [message #34355 is a reply to message #34353] Fri, 18 November 2011 12:12 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Sender

It seems really interesting.

It seems worthwhile to include it in Bazaar:
- Package
- A sample project
- Original code in plugin/Bazaar

It would also be very useful to have a benchmark to compare it with this example from Mirek. I would like to add to it the TCC (Tiny C Compiler) part.


Best regards
Iñaki
Re: AngelScript - AngelCode Scripting Library [message #34364 is a reply to message #34355] Fri, 18 November 2011 15:38 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello, Koldo.

koldo wrote on Fri, 18 November 2011 12:12


It seems worthwhile to include it in Bazaar


For now, I just uploaded it here. Feel free to test it.
koldo wrote on Fri, 18 November 2011 12:12


It would also be very useful to have a benchmark to compare it with this example from Mirek. I would like to add to it the TCC (Tiny C Compiler) part.


Based on AngelScript samples, I added the same calculation functions for Mirek source code, with following results (for MSC9 compiler in optimal mode):
1 / (1 - x * y + x - y) = -0.01851851852
fn->Execute() = -0.01851851852
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
TIMING AngelScript (fully interpreted): 110.00 ms - 110.00 ms (110.00 ms / 1 ), min: 110.00 ms, max: 110.00 ms, nesting: 1 - 1
TIMING AngelScript (interpreted): 332.00 ms - 332.00 ms (332.00 ms / 1 ), min: 332.00 ms, max: 332.00 ms, nesting: 1 - 1
TIMING Direct         : 14.00 ms - 14.00 ms (14.00 ms / 1 ), min: 14.00 ms, max: 14.00 ms, nesting: 1 - 1
TIMING Compiled       : 58.00 ms - 58.00 ms (58.00 ms / 1 ), min: 58.00 ms, max: 58.00 ms, nesting: 1 - 1
TIMING Interpreted    : 807.00 ms - 807.00 ms (807.00 ms / 1 ), min: 807.00 ms, max: 807.00 ms, nesting: 1 - 1

But need to note, that it is also possible to bind compiled functions to script functions, cache compiled functions, etc. Therefore, the real optimized results might be different.

The changed package could be found in the attachments.

[Updated on: Fri, 18 November 2011 15:43]

Report message to a moderator

Re: AngelScript - AngelCode Scripting Library [message #34366 is a reply to message #34364] Fri, 18 November 2011 17:37 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Also, I tested AngelScript with bindings for two cases:
1:
Toggle Spoiler

With following results:
1 / (1 - x * y + x - y) = -0.01851851852
fn->Execute() = -0.01851851852
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
TIMING AngelScript (interpreted with binding): 16.00 ms - 16.00 ms (16.00 ms / 1 ), min: 16.00 ms, max: 16.00 ms, nesting: 1 - 1
TIMING Direct         : 13.00 ms - 13.00 ms (13.00 ms / 1 ), min: 13.00 ms, max: 13.00 ms, nesting: 1 - 1
TIMING Compiled       : 53.00 ms - 53.00 ms (53.00 ms / 1 ), min: 53.00 ms, max: 53.00 ms, nesting: 1 - 1
TIMING Interpreted    : 800.00 ms - 800.00 ms (800.00 ms / 1 ), min: 800.00 ms, max: 800.00 ms, nesting: 1 - 1

2:
Toggle Spoiler

With following results:
1 / (1 - x * y + x - y) = -0.01851851852
fn->Execute() = -0.01851851852
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
TIMING AngelScript (fully interpreted with binding): 170.00 ms - 170.00 ms (170.00 ms / 1 ), min: 170.00 ms, max: 170.00 ms, nesting: 1 - 1
TIMING Direct         : 14.00 ms - 14.00 ms (14.00 ms / 1 ), min: 14.00 ms, max: 14.00 ms, nesting: 1 - 1
TIMING Compiled       : 54.00 ms - 54.00 ms (54.00 ms / 1 ), min: 54.00 ms, max: 54.00 ms, nesting: 1 - 1
TIMING Interpreted    : 793.00 ms - 793.00 ms (793.00 ms / 1 ), min: 793.00 ms, max: 793.00 ms, nesting: 1 - 1
Re: AngelScript - AngelCode Scripting Library [message #34372 is a reply to message #34366] Sat, 19 November 2011 01:35 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Sender and Mirek

I have added Tcc code and the results are:

TIMING Tcc (fully interpreted, included compiling): 23.00 ms - 23.00 ms (23.00 ms / 1 ), min: 23.00 ms, max: 23.00 ms, nesting: 1 - 1
TIMING Tcc (interpreted): 20.00 ms - 20.00 ms (20.00 ms / 1 ), min: 20.00 ms, max: 20.00 ms, nesting: 1 - 1
TIMING AngelScript (fully interpreted): 169.00 ms - 169.00 ms (169.00 ms / 1 ), min: 169.00 ms, max: 169.00 ms, nesting: 1 - 1
TIMING AngelScript (interpreted): 485.00 ms - 485.00 ms (485.00 ms / 1 ), min: 485.00 ms, max: 485.00 ms, nesting: 1 - 1
TIMING Direct : 20.00 ms - 20.00 ms (20.00 ms / 1 ), min: 20.00 ms, max: 20.00 ms, nesting: 1 - 1
TIMING Compiled : 89.00 ms - 89.00 ms (89.00 ms / 1 ), min: 89.00 ms, max: 89.00 ms, nesting: 1 - 1
TIMING Interpreted : 2.20 s - 2.20 s ( 2.20 s / 1 ), min: 2.20 s , max: 2.20 s , nesting: 1 - 1

The code is:
	try {
		Tcc tcc;
		tcc.Init();
		//tcc.AddIncludePath(includePath);
		//tcc.AddLibraryPath(libsPath);
		tcc.Compile(script);
		tcc.Link();
		double (*calculate)(double, double) = (double (*)(double, double))tcc.GetSymbol("calculate"); 

		RTIMING("Tcc (interpreted)");
		double sum = 0;
		for(x = 0; x < 1; x += 0.001)
			for(y = 0; y < 1; y += 0.001) 
				sum += calculate(x, y);
		RDUMP(sum);
	} catch(Exc err){
		Cout() << err;			
	}
	try {
		RTIMING("Tcc (fully interpreted, included compiling)");
		Tcc tcc;
		tcc.Init();
		//tcc.AddIncludePath(includePath);
		//tcc.AddLibraryPath(libsPath);
		tcc.Compile(script2);
		tcc.Link();
		double (*calculate)() = (double (*)())tcc.GetSymbol("calculate"); 

		double sum = calculate();
		RDUMP(sum);
	} catch(Exc err){
		Cout() << err;			
	}


Best regards
Iñaki

[Updated on: Sat, 19 November 2011 01:37]

Report message to a moderator

Re: AngelScript - AngelCode Scripting Library [message #34374 is a reply to message #34372] Sat, 19 November 2011 06:19 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Thanks Koldo, for testing.
The TCC results looks quite faster.

I didn't want to intersect various possibilities/disadvantages of TCC and AngelScript engines, but in result they are different: support for various processors, platforms (32/64 bits), possibility to do C++ object oriented programming (and bind them vise versa), etc.

The purpose of Mirek's "little experiment", as I understood, is to develop something new for U++, with comparable quality and speed.
There are many other script engines and even whole compilers with jit capabilities, like LLVM/Clang.

Edit: Updated link.

[Updated on: Wed, 11 June 2014 06:14]

Report message to a moderator

Re: AngelScript - AngelCode Scripting Library [message #34380 is a reply to message #34374] Sat, 19 November 2011 15:24 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Sender

Yes, TCC applicability is limited and in fact the project seems to be slightly stopped. In addition it is only C.

In fact I use Mirek parsing technology to analyze a "special" language I use, and with that TCC C code is generated and run.

It is less smart but it is rather fast, so I get the best of both.


Best regards
Iñaki
Re: AngelScript - AngelCode Scripting Library [message #34381 is a reply to message #34380] Sat, 19 November 2011 16:33 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
What about squirrel ? www.squirrel-lang.org.
I looked at it some time ago and seems quite interesting.

Max
Re: AngelScript - AngelCode Scripting Library [message #34475 is a reply to message #34381] Fri, 25 November 2011 00:37 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
mdelfede wrote on Sat, 19 November 2011 16:33
What about squirrel ? www.squirrel-lang.org.
I looked at it some time ago and seems quite interesting.

After private conversation with Massimo, I decided to post Squirrel package(s) here.
Feel free to test it (or change it to fit your needs).

Edit: Updated link.

[Updated on: Wed, 11 June 2014 06:15]

Report message to a moderator

Re: AngelScript - AngelCode Scripting Library [message #35831 is a reply to message #34475] Tue, 27 March 2012 11:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Sender

Thank you for your package. I think it should be in Bazaar Smile.

I have begun to work with it in a project where a scripting language with operator overload is needed..


Best regards
Iñaki
Re: AngelScript - AngelCode Scripting Library [message #36757 is a reply to message #34353] Tue, 03 July 2012 04:30 Go to previous message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
The AngelScript archive updated to 2.24.0a version.

Also I updated UppCompiler archive (in attachment) with changes of 2.24.0a version and ScopeRelease helper class template for releasing resources on scope completion (e.g. for asIScriptEngine, asIScriptContext objects, which have Release virtual methods):
Toggle source code

With following results for 2.24.0a version:
1 / (1 - x * y + x - y) = -0.01851851852
fn->Execute() = -0.01851851852
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
sum = 5190404.858
TIMING AngelScript (fully interpreted): 78.00 ms - 78.00 ms (78.00 ms / 1 ), min: 78.00 ms, max: 78.00 ms, nesting: 1 - 1
TIMING AngelScript (interpreted): 321.00 ms - 321.00 ms (321.00 ms / 1 ), min: 321.00 ms, max: 321.00 ms, nesting: 1 - 1
TIMING Direct         : 13.00 ms - 13.00 ms (13.00 ms / 1 ), min: 13.00 ms, max: 13.00 ms, nesting: 1 - 1
TIMING Compiled       : 53.00 ms - 53.00 ms (53.00 ms / 1 ), min: 53.00 ms, max: 53.00 ms, nesting: 1 - 1
TIMING Interpreted    : 837.00 ms - 837.00 ms (837.00 ms / 1 ), min: 837.00 ms, max: 837.00 ms, nesting: 1 - 1

[Updated on: Wed, 20 November 2013 15:42]

Report message to a moderator

Previous Topic: PopEasy
Next Topic: Updated Protect package
Goto Forum:
  


Current Time: Thu Mar 28 09:38:21 CET 2024

Total time taken to generate the page: 0.01477 seconds