Scripting Language development

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

bbguimaraes wrote:
tappatekie wrote:
bbguimaraes wrote:On the code organization topic: reading source code should be the last resource when trying to understand how some part of the application works. You (the developer) should supply documentation to guide users (developers using your code, not the end user).
I haven't decided yet whether I open source it, however there is advantages, the programming language internal systems cannot be touched by other people since its a little security issue (unless I make it a seperate library..)
I meant developers working with you on the project, I should've been more explicit. Even if you're working on your own, I think it's better to have it documented. It makes your life easier, you can get back to your project a few months (sometimes event weeks) and still know what your code does and, should any developer join your team later, you have no extra work to do.

But I guess it's all personal style.
For me it's personal style and in my opinion, documenting it is just cluttering the code file and since I have no experience working with other developers or documenting code, I won't be sure that the documentation would mean anything. Plus, it becomes a pain in the ass when your making loads of public/private methods and document each one, however I do comment on every part of the code...
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Development video on youtube

Post by bbguimaraes »

I agree on the code comments, you should just comment what really needs comments. I refer to documentation outside the code. I think one example will clarify things:

http://www.boost.org/doc/libs/1_49_0/do ... hrono.html

Of course it doesn't need to be that long and detailed. Sometimes a single diagram (UML or not).
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

bbguimaraes wrote:I agree on the code comments, you should just comment what really needs comments. I refer to documentation outside the code. I think one example will clarify things:

http://www.boost.org/doc/libs/1_49_0/do ... hrono.html

Of course it doesn't need to be that long and detailed. Sometimes a single diagram (UML or not).
Oh... in that case, If I were to make a documentation, itl be something like this (basic...)
Plywood {
Run(Stream stream); (Executes plywood source code given from the stream)
}
etc...
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

Okay enough teasers about the actual source code for plywood, now lets see some plywood code being executed!
And yes, that is notepad++... Some of the text has been blocked out since, its a secret :D.
This specific code expresses the "Dynamic Object Type Association (DOTA)" in action. the "printl" (print line) is a console function which.... prints a line..
teaser3.png
teaser3.png (36.57 KiB) Viewed 3655 times
Here is some syntax stuff

[def] = [6]
def = defines value i of value 6

= [&] " World"
& = (basically, adds 2 strings together)
User avatar
VolsporTV
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 40
Joined: Wed Apr 11, 2012 12:18 pm
Current Project: The Void
Favorite Gaming Platforms: PC, NES, Dreamcast
Programming Language of Choice: C/++ and ByondScript
Location: Enid, OK

Re: Development video on youtube

Post by VolsporTV »

tappatekie wrote:Okay enough teasers about the actual source code for plywood, now lets see some plywood code being executed!
And yes, that is notepad++... Some of the text has been blocked out since, its a secret :D.
This specific code expresses the "Dynamic Object Type Association (DOTA)" in action. the "printl" (print line) is a console function which.... prints a line..
teaser3.png
Here is some syntax stuff

[def] = [6]
def = defines value i of value 6

= [&] " World"
& = (basically, adds 2 strings together)


That's looking pretty good! :)
You have a lot of talent mate.
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

VolsporTV wrote: That's looking pretty good! :)
You have a lot of talent mate.
Cheers :P Looking forward to making the video :P
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Development video on youtube

Post by bbguimaraes »

Okay, after writing a long explanation, I realized how I've been filling your post with something almost unrelated to it. So, I will leave my relevant-to-the-post comment and add a spoiler box on the bottom with my text:

The project seems really nice so far. I once implemented a parser for a language in a Compilers class (some kind of pseudocode language we used on the Algorithms class). It didn't generate code for it, just couted a pseudo-assembly code, but it was a lot of fun.

Click here to see the hidden message (It might contain spoilers)
I will try to show you an example of what I mean, using something you might have in your code:

Class: SymbolTable
Holds the list of variables found during parsing. Each scope stores an object of this class, which contains all variables that are limited to that scope. Class Parser stores Variable objects during the parse, using the method SymbolTable::addVariable. Currently, Variable's are store in a double-linked list, but that might change in the future (vectors, perhaps?).

etc, etc, etc. You see, that's a document for someone that is starting to use/extend your code (and that might be you) to get a high level view of the code, whithout having to look at the class declaration and definition to figure out how it works.

The only reason I'm being so persistent is because I think it is so important for developers to realize how it makes collaboration easier. Just look at the AIGD guys. Each feature they add to the project gets discussed and documented, so that everybody knows how things work, even though they might not know how they are implemented. Imagine if Falco had to look at Marcel's source code to find out how he should use some function, or even had to rely on verbal communication. Sorry if I'm straying from the original post, but, as I said, this topic is really relevant.
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

Hmm, atm the code is nothing like that :L Its just a single definition (private class) array, definition holds the name, value, numeric (boolean flag), and array list. Although I plan to make it more "friendlier" so it's easier to add variables directly to the interpreter from a third party application. I also intend to do the same with methods.
However, RunState provides the current status of the interpretation, e.g stream position, current line etc... which enables functions like goLine(line) to exist.

But actually, your method of the SymbolTable class would be pretty useful instead of that (although it'l need a few re-writes of code...). Or I just have SymbolTable as a wrapper class to hook up with the internals of the interpreter.

The one thing that is completely "hackable?" in the interpreter is the function "allow/deny" function to basically stop the invoke of a function when it is about to be invoked.
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Development video on youtube

Post by THe Floating Brain »

I have an game engine, in it I am planning to make it so any scripting language you want can be implemented, may I ask
A:
Will you be able to set instances of C# classes as script globals and use them (call methods set public variables, use refs?) in the script?
B:
If so, may I see a sample as to how you would do that from a C# perspective?
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

THe Floating Brain wrote:I have an game engine, in it I am planning to make it so any scripting language you want can be implemented, may I ask
A:
Will you be able to set instances of C# classes as script globals and use them (call methods set public variables, use refs?) in the script?
B:
If so, may I see a sample as to how you would do that from a C# perspective?
The interpreter would need some fine tuning towards managing .net objects but the code would be (c#)

Code: Select all

Plywood ply = new Plywood();
//Add your object
ply.AddDefinition("myCsObject", yourCsObject, ObjectType.InstanceClrManage);

//Add your assembly (this would give the clr_ methods access to methods and classes in that assembly)
ply.ClrManager.AddAssembly("myDll.dll")

//Run the code
ply.Run(yourSourceStream, false, yourRunState);
//                        ^^ it's false because we don't want to clear the definition we just defined....
You also need to take this into account, every method you would wish to be called from Plywood would have to have these parameter types (long/double/string/object) (I may be making a more wider variety...)

The one thing I need to tell you now before you read below, the language was not originally designed for using .net objects, and by invoking there methods, would be using reflection.

ObjectType.InstanceClrManage tells the method that we want the definition setup and handled as an "object" and not a plywood definition.

Now I am planning on having a method like "clr_invoke", "clr_create" etc... to manage .net stuff so in the script, you can create and control .net instances etc... and even maybe run c# code from plywood script itself.... (but thats a big IF)

The plywood source would be (remember myCsObject)

Code: Select all

//Invoke the local method in myCsObject Print and pass arguments "Hello World" to it
clr_invoke(myCsObject, "Print", "Hello World")

//Here is to invoke a static class method
clr_invoke("Console", "WriteLine", "Hello World")
However, im not entirely sure on how I would have c# refs in there :L (like Array.Resize(ref myArray, 0) etc...) but by passing the clr object to invoke, you automatically have a reference anyway since the method will control that object only.


Also, the one thing I will point out is, your code would probably get more messy in plywood in terms of properies, e.g (passing a object property to a method)

Code: Select all

//Prints the return value of "Console.Out"'s ToString method to the console.
clr_invoke("Console", "WriteLine", clr_invoke(clr_getProperty("Console", "Out"), "ToString"))
User avatar
THe Floating Brain
Chaos Rift Junior
Chaos Rift Junior
Posts: 284
Joined: Tue Dec 28, 2010 7:22 pm
Current Project: RTS possible Third Person shooter engine.
Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
Programming Language of Choice: C/C++, Python 3, C#
Location: U.S

Re: Development video on youtube

Post by THe Floating Brain »

Thank you! :mrgreen:

Iv been trying to figure out how to design a method to send objects to scripts that is abstract
enough to cover the majority of languages, this really helped!
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself

ImageImage
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

No problem mate
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

"Programming Language Development Episode 1" starts being filmed this Sunday! (22/04/12) so expect a video next week!!

Also, does anyone recommend any software for me to use to film&edit it? I have got a microphone and Im thinking of using QuickCam.

Even if that software is pricey... (I want to buy it tomorrow if possible...)
User avatar
VolsporTV
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 40
Joined: Wed Apr 11, 2012 12:18 pm
Current Project: The Void
Favorite Gaming Platforms: PC, NES, Dreamcast
Programming Language of Choice: C/++ and ByondScript
Location: Enid, OK

Re: Development video on youtube

Post by VolsporTV »

tappatekie wrote:mmend any software for me to use to film&edit it? I have got a microphone and Im thinking of using QuickCam.

Even if that software is pricey... (I want to buy it tomorrow if possible...)
I use this to edit my films.
http://www.newegg.com/Product/Product.a ... 6832106270

As for filming are you doing it on the computer or a film of yourself like the ES team does?
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Development video on youtube

Post by tappatekie »

VolsporTV wrote: As for filming are you doing it on the computer or a film of yourself like the ES team does?
Just a screen video with me narrating, I was thinking of me "webcamming?" myself introducing the video....

As for the software you said, it looks pretty good, il get it :D
Post Reply