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

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
Offline saviilsy  
#25 Posted : Thursday, November 17, 2011 8:40:08 AM(UTC)
saviilsy

Joined: 8/24/2011(UTC)
Posts: 95

Thanks: 6 times
Was thanked: 2 time(s) in 2 post(s)
There is two problems with the C# approach :

1. Content creators might not know how to code it. Granted it is an EASY language with lots of powerful options, but the language syntax is not for non-programmers. I for one WOULD use C# for everything...

2. The possible leakage of memory when it comes to large number of classes, if someone know how this works in CLR please answer me as this has puzzled me a long time.

To elaborate more on the subject 2 : think of an adventure game with LOTS of logic scripting, and by LOTS I mean like a book where almost every sentence is a script. Now I might define an interface like IScript with only one method "Run". Now when my script says something like Execute(scriptName) the assembly would search for all known types, when found initialize that interface and invoke Run. After script execute the actual IScript based object is freed, the definition of the class would still remain in the memory, CLR would not release this (am I right???). This would presumable be even worse on mobiles as the C# would be compiled to arm native and size of the executable and memory usage would be HORRIBLE.

This is one of the reasons I'd like a scripting language where the script get's freed totally. And the scripting on mobiles/xbox is not a problem since the script is run in medium sec environment, complies with the agreements (not possible to download new user defined script for example) and so on. MS and Apple have not banned scripting on mobiles, they just restrict them to work like the app's developer has intended them to run (thus moving the responsibility of security to app developer).
Offline Benjamin  
#26 Posted : Thursday, November 17, 2011 1:07:54 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)
True, but especially for scripting problems can be very different from one project to the next. That is why many projects use custom solutions (e.g. in our console game FireBurst we used Lua, UnrealScript and C++, each for stuff that could be solved the best way with it).

About your second point: I cannot fully agree. What you are saying is true, but no one forces you to do it exactly this way. For example I have rewritten parts of our content generation pipeline in the past few weeks and added scripting there as well (in C# because I was to lazy to find anything else that works, also fits better into the pure C# Delta Engine). It is very limited, I can only put some code for one method in the script (which will convert an incoming file to a processed file), but it is all we need for the content processors. Each generator code block is loaded into its own AppDomain and can be executed very quickly (the overhead is almost zero because processing takes a long time (often seconds) and switching to the other AppDomain is 1-2ms, if already loaded). Also each generator code block can be updated as many times as needed (unloading the app domain, loading the new code, etc. this actually takes around 100ms). Currently we only have about 20 code blocks (4 platforms, 5 content formats that need generation), but testing it with 100 or 1000 code blocks also worked fine in tests, so this approach could be useful for games too.

About your memory issues you are talking about. Each generator uses content processors and as much custom code as it wants, but it also has the responsibility to free all memory itself. For managed objects this is done automatically if the AppDomain unloads, everything will disappar. And native memory has to be freed anyway via the native tools used.

About Apple restricting scripts: They actually do (read the EULA for the SDKs), but they don't do anything about it (except for last year when they wanted to prevent Adobe from putting Flash ActionScripts on iOS). Most games use some form of scripting and Lua is very popular for many iOS games.

MS is less restrictive in the EULA, but way more restrictive what you can actually do on mobile or console platforms (even in the native world, many things are just not allowed).
Offline saviilsy  
#27 Posted : Friday, November 18, 2011 10:27:55 AM(UTC)
saviilsy

Joined: 8/24/2011(UTC)
Posts: 95

Thanks: 6 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: Benjamin Nitschke (DeltaEngine) Go to Quoted Post
True, but especially for scripting problems can be very different from one project to the next. That is why many projects use custom solutions (e.g. in our console game FireBurst we used Lua, UnrealScript and C++, each for stuff that could be solved the best way with it).


Yes, of course I'd use Lua for scripting with DE but that is not possible as there is no pure managed version of Lua available. All the ports have ceased development as well.

Using PInvoke or similar would work fine under DE I presume, but I don't want a situation where I want to release my game for example WP7 and I'd have to write the whole scripting part in C# again. Common scripting language for all platforms will be a must have at some point.

Benjamin Nitschke (DeltaEngine) wrote:

About your second point: I cannot fully agree. What you are saying is true, but no one forces you to do it exactly this way. For example I have rewritten parts of our content generation pipeline in the past few weeks and added scripting there as well (in C# because I was to lazy to find anything else that works, also fits better into the pure C# Delta Engine). It is very limited, I can only put some code for one method in the script (which will convert an incoming file to a processed file), but it is all we need for the content processors. Each generator code block is loaded into its own AppDomain and can be executed very quickly (the overhead is almost zero because processing takes a long time (often seconds) and switching to the other AppDomain is 1-2ms, if already loaded). Also each generator code block can be updated as many times as needed (unloading the app domain, loading the new code, etc. this actually takes around 100ms). Currently we only have about 20 code blocks (4 platforms, 5 content formats that need generation), but testing it with 100 or 1000 code blocks also worked fine in tests, so this approach could be useful for games too.

About your memory issues you are talking about. Each generator uses content processors and as much custom code as it wants, but it also has the responsibility to free all memory itself. For managed objects this is done automatically if the AppDomain unloads, everything will disappar. And native memory has to be freed anyway via the native tools used.


Using AppDomains and CodeDom sure is fine and fast but also it does not remove the memory issue. Please correct me if I'm wrong, but I'm under the impression that MonoTouch/Mono For Android/all the similar compiles all the necessary managed parts into pure native machine code for the target platform(arm in this case). Now when the app is loaded it injects the WHOLE binary into memory. That binary blob contains all the THOUSANDS of class definitions ("scripting"). Although it does not make any instances from those scripts it still eats up lots of memory when all those definitions are stored in RAM (even if all the text parts are separated into other files like tef/xml).

And I'm under impression that iPhone doesn't even make possible to load dynamic link libraries into apps(except the core iPhone SDK ones) just static libraries are permitted. Let alone those C# to arm compilers output a single executable (if I'm correct). So there would be no way to dynamically load anything into the application.

Quote:

About Apple restricting scripts: They actually do (read the EULA for the SDKs), but they don't do anything about it (except for last year when they wanted to prevent Adobe from putting Flash ActionScripts on iOS). Most games use some form of scripting and Lua is very popular for many iOS games.

MS is less restrictive in the EULA, but way more restrictive what you can actually do on mobile or console platforms (even in the native world, many things are just not allowed).


I thought Apple loosened those restrictions as many game developers cried for not being able to use scripting (mainly Lua)...

Footnote :

I'm not looking into making/using a scripting engine that is as fully functional language as Lua or python for example. I just need a simple scripting language for content creators and developers(though it should be able to use control/logic expression). Even class/function definitions are not necessary as they would be done in C# side to ensure good performance.

I started to prototype my solution yesterday - it does not even contain for/and/if/assignment functions, as they are added post to vm initialization. I'm sure at least programmers will hate the syntax as it is geared towards "common people" BigGrin
Offline Benjamin  
#28 Posted : Friday, November 18, 2011 11:34:56 AM(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)
Hey Santtu.

We will obviously try to find a a solution in pure .NET code that just runs everywhere. That is why was proposing using C# Scripts first and only later find alternatives.

About loading everything into RAM on iOS/Android/WP7: That is true, but memory is not longer the main problem on mobile devices. The have 2-4 times as much main memory as consoles nowadays. And I would say console games are much more complex than mobile games and they manage too. I don't think you will have enough scripts to reach 256 MB of compiled data. The whole engine is about 20 MB compiled on iOS or Android (half of it is the Mono runtime), less than half on WP7, but we remove unneeded parts and can compress everything to be well below 5 MB.

But without concrete game examples it is hard to say how it will work out with tons of scripts, we just have to try it out and see what the problems are on the road ahead.


You can also ask the SoulCraft developers about what we do currently in most game projects (see Showcases forum). They have written a very simple and specific trigger system and custom xml files for their game to make everything very customizable (like many RTS games do).
Offline elasto  
#29 Posted : Friday, November 18, 2011 12:40:08 PM(UTC)
elasto

Joined: 8/23/2011(UTC)
Posts: 245

Thanks: 6 times
Was thanked: 12 time(s) in 11 post(s)
Originally Posted by: Benjamin Nitschke (DeltaEngine) Go to Quoted Post
About loading everything into RAM on iOS/Android/WP7: That is true, but memory is not longer the main problem on mobile devices. The have 2-4 times as much main memory as consoles nowadays. And I would say console games are much more complex than mobile games and they manage too. I don't think you will have enough scripts to reach 256 MB of compiled data. The whole engine is about 20 MB compiled on iOS or Android (half of it is the Mono runtime), less than half on WP7, but we remove unneeded parts and can compress everything to be well below 5 MB.
On the topic of memory limits in general, are there general guidelines on what we should work to?

I read something elsewhere that said that, for a phone, once you start going much above 10-15MB, you stand an increasing chance of getting some sort of 'out of memory' error with users running your app. (And that telling users that they need to reboot their device when that happens - to free up memory being used by other apps - is not adequate as they will one-star your app anyway).

Is that 10-15MB limitation roughly correct for iPhone 3 but out of date for iPhone 4/Ipad, say? Can you lay out some rough-and-ready approximations for the different tiers of devices?
Offline Benjamin  
#30 Posted : Friday, November 18, 2011 1:01:10 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)
On iPhone3G, memory was very low (they did not increase it from iPhone2G) and when the user had some apps in memory or just updated to the newest iOS version he could in fact only have 10-15 MB free and any app needing more would immediately crash.

But this did affect to many apps so Apple just dropped support for those old devices. iPhone3GS and up are not so problematic with 256 MB Memory, iPhone4 and iPhone4S have 512 MB of main memory (see http://en.wikipedia.org/wiki/IPhone_4S), so you are much less likely to run out of memory. Again the main problem is usually single core CPU speed or render speed nowadays.

As long as your application has no memory leaks and you don't need tons of memory, you won't run into trouble. Actually our game SoulCraft has now over 200 MB of compressed high res textures, which would fit fine into iPhone4 or iPad2, but the performance bandwidth is not good enough (unlike Android Tegra 2 or 3, which can handle this), so all textures need to be reduced anyway.

We have some ruff iOS information in our wiki, we will add more information over time:
http://deltaengine.net/Wiki.IOSDevelopment.ashx
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
2 Pages<12
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-2019, Yet Another Forum.NET
This page was generated in 0.590 seconds.