Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

109 Neutral

About thewavelength

  • Rank
  1. thewavelength

    More advanced parsing & script section order

    Hello, thanks! I want this to allow people use #include <path>. TC_VALUE seems only to allow " and ', so I thought of modifying it. The tokenizer does not seem to pass back TC_VALUE when there are no quotes. Of course I can work-around this, but I wanted to know firstly that there is no other possibility. Thanks and good work btw ;) By the way, I've got a question to the coding style. Is there a reason for using a non objective programming style in some cases? Example: engine->DiscardModule(const char*). I intuitionally tried to use module->Discard() and then engine->DiscardModule(module). Is the reason the more easy binding to other programming languages, like C? Or are there other reasons? Thanks!
  2. Hello, I've took a look into the scriptbuilder-addon and saw, that you store includes first and then include right after the full file has been parsed. This has some negative consequences which breaks sequential pre-processor commands. Is this realized this way because of a better design or is the order in which script sections are added to a module important? Maybe I'm on a complete wrong way.. Does AngelScript even take care of script appearance? Does the order matters? Secondly, I'm trying to get the exact token return which asCTokenizer::GetToken returns. Is there a way to get the eTokenType-value without hacking? Thanks in advance!
  3. thewavelength

    Using AngelScript namespace causes linker error (VC11)

    Wow. So obvious and I was blind, but now I see. Thanks!
  4. Hello, I'm using Visual Studio 2012 and MSVC11 and get linker errors when using RegisterStdString function from the string addon when I enable namespaces. I don't know if this is also the case for older compiler versions. Fails with two linker errors (RegisterStdString and RegisterStdStringUtils): [source lang="cpp"]#define AS_USE_NAMESPACE #include <angelscript.h> #include <add_on/scriptstdstring/scriptstdstring.h> using namespace AngelScript; void test() { asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); RegisterStdString(engine); RegisterStdStringUtils(engine); }[/source] Compiles like a charm: [source lang="cpp"]#include <angelscript.h> #include <add_on/scriptstdstring/scriptstdstring.h> void test() { asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); RegisterStdString(engine); RegisterStdStringUtils(engine); }[/source] Is this a bug or am I doing something wrong? Thanks in advance! Edit: The forum removes include paths for some reason. These are the files included: <angelscript.h> <add_on/scriptstdstring/scriptstdstring.h> Edit 2: Of course I'm compiling both scriptstdstring.cpp and scriptstdstring_utils.cpp.
  5. thewavelength

    Threading of multiple engines

    Hey, ok. Thank you Btw, I found a possible optimization. Because I don't know where to put this, I may write it here. In scriptstdstring.cpp, lines 91 and 92 (speaking of 2.25.0) could be replaced with: [source lang="cpp"]it = pool->insert(map<const char *, string>::value_type(s, string(s, length))).first;[/source] Bye.
  6. thewavelength

    Threading of multiple engines

    Hi, Ok, thanks for your fast reply. Since I'm currently rebuilding the whole module before I run it, I shouldn't have problems with race conditions. Will these problems still exist if I use different engines? I don't think so. About my plans: I try to make AngelScript usable as a web scripting language. It works via fastcgi or scgi in a single application. The application implements a process spawner to allow real-per-user script execution. This improves security and performance. Then every spawned process runs under a real user, holding some threads. Currently there are as many threads as cores provided by the CPU. It also contains a load balancer. If a certain amount of requests is longer than 0.2s in the processing queue, a new thread will be started. The thread pool decides by itself when to reduce the number of threads. Currently, a context is created once per thread startup and is reused for every request in the specific thread. To allow much better experience with AS as a scripting language, I'm about to rewrite the whole preprocessor. It contains a bit more flexibility and is more dynamic. I don't know if you know PHP. If you know, you may know its mistakes and problems. I think that a lot of mistakes could be solved using AS, including caching and security improvements.
  7. thewavelength

    Threading of multiple engines

    Oh, okay. So the contexts will not block each other when they are running in different threads though they are using the same engine? Be sure that this is my last question Thanks!
  8. thewavelength

    Threading of multiple engines

    Hello, thanks! My situation is, that in one process there are four or more threads (the size is fixed). Now I invoke a call to one (randomly selected) thread that it shall execute a script. This script is only used once per time. Means: when the script has finished, the context shall be deleted. Everything should be cleared as if there were no running scripts before. I don't need modules. I don't need sharing between different scripts. I only need the #include-preprocessor command (which works well). The question for me is now whether it's more clever to use one engine per thread or to use only one engine... I think one engine per thread is a bit faster because I don't need to wait on mutex releases when I create a context... Since I'm not very experienced with AngelScript and threading in general I can't give a final answer to this question. Thanks in advance :-) Edit: I've found another issue.. What if I decide to start a fifth thread because I've got a lot of requests? How do I handle with asPrepareMultithread then? Edit 2: There's a mistake on the documentation page http://www.angelcode.com/angelscript/sdk/docs/manual/doc_datatypes_strings.html -> string str1 = "This is a string with \"escape sequences".";
  9. thewavelength

    Threading of multiple engines

    Hello, I'm about to create a threaded environment of totally seperated engines. I found this page in the documentation: http://www.angelcode...ultithread.html It says something about threading, but I don't think this matches my situation. I want to have about four totally seperated scripting engines which DO NEVER come in interaction with another engine. Another question is: DO I need four engines? Couldn't this be solved using four contexts? Also, the scripts are allowed to access only thread local variables and functions. So I am doing right with not implementing thread-safety mechanism? Are there other points I have to look at? Thanks!
  10. thewavelength

    Modules / Imports?

    Wow, thanks. Now I've understood. But it isn't possible to pass e. g. integer variables between modules, is it? Btw: I'd suggest to post exactly the text you've posted to the documentation. It's a bit more clear in my opinion.
  11. thewavelength

    Modules / Imports?

    Hello everybody, I'm fairly new to AS and I've read to the whole documentation twice to get a feeling for the design and the patterns. But there are two very important questions that were not answered: 1.) Is there module functionality? E. g. like in scripting languages as Python? I think I've read somewhere in the documentation that it is there, but I can't find any examples. I've also read somewhere that it is not possible to share variables through modules even when they are in the same context / execution environment. But this is a feature I need. What do you do for example, if you have such a large script, that it is impossible to structure it in one file? This is some times the case for my needs. 2.) What exactly is an "import"? I've read somewhere that you can "import" functions. Is this the same as using modules? I'm thankful for answers!
  12. thewavelength

    Implementing a map; arrays in arrays?

    Hi, thanks for the answers! @ _om_: Thanks! @ WitchLord: Wow, I didn't find the CScriptDictionary addon in the manual. Did I oversee it, or isn't there a link? So, you write array<array<array<int>>> x is the same as int[][][] y. In C, this means that y is of a static size. But in AngelScript, it does mean the same as x? So the size can grow dynamicly? To the modules: So I understood it correctly, that I can expose some modules in my host application, for example "players", "entities" and so on and so on. Now, when the user wants a script to be loaded, I create a new context in which the script is running, loading my modules and so the loaded script can use these? That would be great! Greeting ;)
  13. thewavelength

    Implementing a map; arrays in arrays?

    Hello, completly new to AngelCode I've read in and found it very interesting. It is very well documentated, I like that! At this point, a big THANK YOU to WitchLord I hope you understand that I ask these questions before I start to implement AngelCode, otherwise it would be much work without a sense. 1) Is it possible to create a map (like std::map)? I do hope so, but my hope is gone since I've searched in the forums and read that multiple template types are not possible. Even if not, would there be a possiblity to implement a stringmap or something equivalent? Hope is also not great since the opIndex-operator only takes int as argument, so myvar["x"] seems to be unavailable. 2) Is there a way to store arrays in arrays, to create a matrix? Firstly, I've got it right that array in AngelCode is nearly the same as std::vector in C++, right? Example: array<array<array<int>>> 3) Is there any documentation about modules? I think I don't fully understand what they are. Are they equivalent to modules in Python? Thanks!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!