User Tag List

Results 1 to 10 of 115

Thread: AngelScript: The Revenge

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date
    May 2015
    Posts
    141
    Mentioned
    34 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    667
    Level
    9
    vBActivity - Bars
    Lv. Percent
    14.48%
    Quote Originally Posted by Gleeok View Post
    Let's talk about the AS syntax really quick.

    Code:
    //note: code is gibberish, it doesn't do anything.
    
    //HANDLES
    void Foo(Ref@ ref) //option A:
    {
      @ref = @Ref.Create(); //points to a new thingy.
      ref = otherRef; // now it value copies other thingy. whoops.
    }
    
    // confused yet? ...well then:
    
    void Foo(Ref ref) //option B:
    {
      ref = Ref.Create(); //points to a new thingy.
      ref = otherRef; // now it POINTS to other thingy instead.
    }
    
    int e = Enum::Value;
    int i = A::B::Value; 
    int v = this.Value;
    int x = Object.Value;
    Link::X = x;
    
    ..confused again?
    
    int e = Enum.Value;
    int i = A.B.Value; 
    int v = this.Value;
    int x = Object.Value;
    Link.X = x;
    
    // Current annoyance... but unlikely as part of the ZC script API. ...idk
    void Foo(const int &in a, int &out b, Object &c)
    {
    }
    
    //unless we allow unsafe references only "out&" or "&inout" is really useful.
    Script language reference: http://www.angelcode.com/angelscript...oc_script.html
    Other issues?
    Looking at that syntax makes me feel like I'm looking through the source code, just to do a little scripting. I'm not entirely sure how this will help people learn the language?

  2. #2
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,961
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.44%
    Quote Originally Posted by Dimentio View Post
    Looking at that syntax makes me feel like I'm looking through the source code, just to do a little scripting. I'm not entirely sure how this will help people learn the language?
    It's not. We have to set up how we want scripts to behave, and set up compiler options accordingly; perhaps even have some form of code standard. Have you ever been to an eye doctor and they asked you "A or B?" Well that's what we have to figure out. That code is purposely ugly for this purpose.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  3. #3
    Banned
    Join Date
    May 2015
    Posts
    141
    Mentioned
    34 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    667
    Level
    9
    vBActivity - Bars
    Lv. Percent
    14.48%
    Quote Originally Posted by Gleeok View Post
    It's not. We have to set up how we want scripts to behave, and set up compiler options accordingly; perhaps even have some form of code standard. Have you ever been to an eye doctor and they asked you "A or B?" Well that's what we have to figure out. That code is purposely ugly for this purpose.
    Ah. I vote on making it as close to ZScript as possible, without it's limitations.

  4. #4
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,765
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.74%
    Quote Originally Posted by Dimentio View Post
    Ah. I vote on making it as close to ZScript as possible, without it's limitations.

    Actually, that syntax is like ZScript. The reason you haven;t seen some of that, is because the parser doesn't handle all of the available C syntax that it could. There has been some improvement in that area. There's very little proper C syntax that it could not handle--or really, handle without a lot of work. It could theoretically do anything that a full C parser could do. Cpp syntax is something else, as it continually morphs with each new revision. There are things that cpp allows that I didn't know about until recently, and not all compilers may support them (read, CPP11), and yet others that it does not support, but compilers may (e.g. variable array declaration, supported by gcc).

    How the hell would array pointers translate? That's a fundamental question, and concern.

  5. #5
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,961
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.44%
    Quote Originally Posted by Dimentio View Post
    Ah. I vote on making it as close to ZScript as possible, without it's limitations.
    Probably the best possible answer. I will do that.


    Sure. Right now I've got the parser and compiler working and can create and call scripts. The first test scripts should be forthcoming this week.

    I'm going to experiment with the compiler options to see if I can get rid of handles or not. The docs are not clear on this. ("handles" are the Class@ c; @c = @something; Foo(@c); stuff)
    [EDIT] This unfortunately produces weird compiler errors. "Normal" scripts and all engine declared things will not force scripts to use them, however if you write classes and want to communicate custom classes with each other then in those cases you will have to use them as parameters. It's likely most normal scripts won't ever need them... I think...

    There's no ZC bindings for the time being until everything is tested fully, but I can put in a math library for collisions and vector math stuff. It is important to implement these c++ side to get all the performance benefits of c++ compiled code and have scripts use that directly with no intermediate layer. What I'm going for is at least a 20x performance increase over ZScript for common tasks. We'll see what happens.
    Last edited by Gleeok; 01-25-2017 at 09:04 AM.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  6. #6
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,565
    Level
    30
    vBActivity - Bars
    Lv. Percent
    52.33%
    Quote Originally Posted by Gleeok View Post
    Probably the best possible answer. I will do that.


    Sure. Right now I've got the parser and compiler working and can create and call scripts. The first test scripts should be forthcoming this week.

    I'm going to experiment with the compiler options to see if I can get rid of handles or not. The docs are not clear on this. ("handles" are the Class@ c; @c = @something; Foo(@c); stuff)
    [EDIT] This unfortunately produces weird compiler errors. "Normal" scripts and all engine declared things will not force scripts to use them, however if you write classes and want to communicate custom classes with each other then in those cases you will have to use them as parameters. It's likely most normal scripts won't ever need them... I think...

    There's no ZC bindings for the time being until everything is tested fully, but I can put in a math library for collisions and vector math stuff. It is important to implement these c++ side to get all the performance benefits of c++ compiled code and have scripts use that directly with no intermediate layer. What I'm going for is at least a 20x performance increase over ZScript for common tasks. We'll see what happens.
    Why would you get rid of handles?

  7. #7
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    Gleeok, please tell me you're joking for once. I really want my callback functions this time around.

  8. #8
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,961
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.44%
    Joking you say?! I never joke.

    Quote Originally Posted by SUCCESSOR View Post
    Why would you get rid of handles?
    They're not needed since the compiler should be able to know all the types at compile. I remember years ago (2011?) Andreas said that for AS ver. 3.0 he wanted to revamp the language to allow this. There's a few options for this but it's not complete. There's no real reason other than simplifying the syntax for scripters to be closer to something more familiar like ZScript or CS.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social