Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline joegallagher95  
#1 Posted : Friday, February 10, 2012 12:14:54 AM(UTC)
joegallagher95

Joined: 2/10/2012(UTC)
Posts: 1

Would i be able to script for the engine using other .net languages such as IronPython?

Wanna join the discussion?! Login to your forum accountregister a new account. Or Connect via Facebook Twitter Google

Offline Benjamin  
#2 Posted : Friday, February 10, 2012 12:59:42 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Depends on the platform. WP7 (and Xbox 360) does currently only allow C# .NET code and while you can get away compiling some things in other languages (lets say a VB library), it stops at dynamic languages like IronPython, which is not supported at all. There is a similar situation at iOS, where C# is pretty much the only language supported by Xamarin, dynamic languages are also forbidden by Apple. And the same goes for Android, C# is the only supported language, but in Theory much more works here, it is just not fully supported yet.

For all other platforms you can use dynamic languages, any other .NET languages or native code as much as you want, there are no limitations except that you cannot use the Build System for that code. If you just provide extra assemblies or files (like native dlls) it works fine on all PC platforms (Windows, Mac, Linux), but none of this works on any mobile platform automatically (you can however provide your own Objective-C or C or Java libraries and P-Invoke them).
Offline maxthekokusaiwarrior  
#3 Posted : Wednesday, April 16, 2014 2:51:34 PM(UTC)
maxthekokusaiwarrior

Joined: 11/4/2013(UTC)
Posts: 18

Hi Benjamin,

I have some questions about the chance to use a scripting language with Delta Engine. Some time ago, in order to find a portable solution, I designed a simple scripting language. Scripts are written as text files, then loaded, parsed and finally executed. There is no external library, just pure C# code. This language is able to execute custom commands defined in external dlls, but these are not loaded at runtime by the game, there are simply linked as references to the project. I think this is enought to ensure the portability of the code. Am I right? Moreover, I'm reading about TypeScript. I would like to understand if it can be used to create scripts for a game developed by Delta. Can you help me? Thank you ThumpUp

Max
Offline Benjamin  
#4 Posted : Wednesday, April 16, 2014 8:26:21 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Hi, we thought long and hard about using scripting (via Roslyn, .NET 4.5, etc.) for the new content and entity system and decided against it. Instead we just save everything as xml data and can reconstruct any content or entity object via properties. This way code can change dramatically and the data still works. Plus we get tons of dynamic features and live content updating pretty much for free.

That does not mean we cannot do scripting, we just did not invest any time into it. With v1.1 you can even use the AssemblyStarter, which allows to load any C# code or assembly (e.g. a script or even something more complex like a whole app) and execute it in an extra AppDomain. This might help you already. If you build your code with the AppBuilder for other platforms it will not work out of the box, but as long as you just have some c# code that needs to be added to the project and executed together with it, there is probably an easy way to support it (we did the same many times before in the past, including lua scripting on all consoles, but that is a different story and was actually a ton of work to get it right).

So I guess try it out and if you have trouble, ask and we will help Cool
Offline maxthekokusaiwarrior  
#5 Posted : Thursday, April 17, 2014 2:53:57 PM(UTC)
maxthekokusaiwarrior

Joined: 11/4/2013(UTC)
Posts: 18

Thank you very much Benjamin ThumpUp
Offline maxthekokusaiwarrior  
#6 Posted : Saturday, April 19, 2014 3:30:04 PM(UTC)
maxthekokusaiwarrior

Joined: 11/4/2013(UTC)
Posts: 18

Sorry Benjamin,

I forgot to ask you. How can I read a text file line by line with Delta? Thank you ThumpUp

Max
Offline Benjamin  
#7 Posted : Sunday, April 20, 2014 6:38:51 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
I guess File.ReadAllLines is your best option, we use it often too.
http://msdn.microsoft.co...us/library/s2tte0y1.aspx
Offline maxthekokusaiwarrior  
#8 Posted : Tuesday, April 29, 2014 2:24:01 PM(UTC)
maxthekokusaiwarrior

Joined: 11/4/2013(UTC)
Posts: 18

Hi Benjamin,

I have got also another question about scripting. When I was using XNA, I included all my scripts (as text files) inside the Content Pipeline. Using a custom importer (and processor, writer and reader Smile), my scripts were compiled and turned in XML format. Using this way, I was able to load faster my scripts, because they were already compiled in build time. Now, is there a way in Delta Engine to compile my scripts in build time using something similar to the old XNA Content Pipeline? Can the ContentManager in Delta Engine be used to compile contents in build time? Thank you for the help ThumpUp

Max
Offline Benjamin  
#9 Posted : Tuesday, April 29, 2014 3:26:17 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Not sure why you want to compile text files or xml, there is nothing to compile. Just because XNA put things into .xnb files, which were just binary files of your data serialized (in case of a text file or xml it is just a string inside the .xnb file), there is no reason to do so outside of XNA. All important files like images, multimedia or 3D geometry are processed by the Editor and returned as compressed or simplified content files. If you want to build your own content format, that is simple too, but for a xml file I don't see the point. I guess you are coming from a different format and are converting it into Xml, if that is the case there is no problem doing it beforehand or just integrating it into the editor or diskcontentloader (it is all open source, you can do whatever you want when you drop in files there).
Offline maxthekokusaiwarrior  
#10 Posted : Tuesday, April 29, 2014 4:18:47 PM(UTC)
maxthekokusaiwarrior

Joined: 11/4/2013(UTC)
Posts: 18

Hi Benjamin,

thank you for your reply ThumpUp. I mean that these scripts are loaded and parsed line by line, then a script's instance is builded (and this is what I mean with "compile") and then executed. When a script is "compiled", it forms a hierarchical structure of blocks and statements. This is the reason why, to skip the "compilation" process, I serialized these scripts in XML (or better in XNB containing my XML, as you right say) in build time using Content Pipeline. Then, when my application runs, I don't need to rebuild ("recompile") my scripts again, because I load them already in their "compiled" form. What I need is simple to convert from my scripts into XML, in their "compiled" form, before my application runs. Is this possible to do it with the ContentManager when I build my project? Or I have to convert my scripts into XML outside my game (perhaps with an editor or an external application) and then put the converted scripts inside my game's project? Thank you for your help ThumpUp

Max

Edited by user Tuesday, April 29, 2014 4:24:37 PM(UTC)  | Reason: Not specified

Offline Benjamin  
#11 Posted : Tuesday, April 29, 2014 6:25:04 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Currently we have 2 steps that happen when dragging in content:
- File is dropped into the editor, some preliminary checking happens, some meta data is extracted, etc. then the file is send to the content service
- Content Service runs through the Content Importer plugins to bring the file into a compatible format, then it is stored into the user project database

Then using the content (in editor or game, on windows or any mobile device):
- Content Service runs through the Content Exporter plugins to provide the best file format for the platform. Is cached for all download requests and often just returns the imported file.
- Client (DeveloperOnlineContentLoader) receives the file and puts into the available resources for consumption

At any of those 4 steps code can be executed to process. We obviously work 99% of the time on the content importer and exporter plugins, but have not spend much time thinking about supporting user plugins (which is difficult because of many dependencies). In v0.9.5 user plugins were possible, but it really made things hard and every version would be incompatible anyway, so this feature is for later.

I recommend just putting your processor at the very first step, when a file is dropped into the Editor, before sending it to the content service. You could also use DiskContentLoader to test this and you would not need to be online. The file would only be processed once and on subsequent changes, but you always will have a processed fast version when consuming it (that is how all content works).

The new content system coming in v1.2 (June 2014) is a bit more flexible and much more xml driven, thus more customization is possible, but currently there is no plan on additional processors (instead of increasing it we just reduced it to the most basic 7 file formats and removed all the rest to make things simple). This is the ContentFileTypes enum for v1.2 (Data is mostly just byte data, but can be anything you like, usually 90% are images, 10% xml, sound, etc.):
Code:

	public enum ContentFileType
	{
		Data,
		Image,
		Xml,
		Sound,
		Music,
		Video,
		Json
	}

All other data is stored a xml, including all content templates (materials, 3D models, meshes, particle effects, etc.) and all game entities are stored as xml as well (this is completely customize-able and might make you need for scripting obsolete).
Offline maxthekokusaiwarrior  
#12 Posted : Wednesday, April 30, 2014 9:24:31 AM(UTC)
maxthekokusaiwarrior

Joined: 11/4/2013(UTC)
Posts: 18

Thank you very much Benjamin ThumpUp
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
Similar Topics
Scripting language, ideas, suggestions (Tools)
by saviilsy 11/24/2011 9:18:06 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.123 seconds.