The next step after lambda functions is obviously closures. Without closures, I couldn't write code like this.
Closures allow lambdas to use variables local to the function they are…
var view = new View(world, new Rectangle(0,0,800,600));
bindKey("W", [void v] { view.panCamera(0.0, 1.0, 5.0); }, true);
Closures allow lambdas to use variables local to the function they are…
I mentioned last time that I might start integrating this scripting language with that other thing, and I did. Nothing evolves a library faster than actually using it. First, I designed the interface I wanted scripts to see. The first thing I want to use scripts for is key binding. I could enumerat…
I started thinking, okay, I've written this thing. Now how can I actually use it? Wasn't I supposed to be making a mud engine? Yeah, well, I already don't want to anymore. Instead, I'm going to use DeyjaScript in this thing, https://www.gamedev.net/blog/342/entry-2250747-gnome-colony-build-demo/ . …
For arrays in this language, I had two requirements. First, they had to be dynamically sized, and second, they had to be type-safe. But, when I want about trying to actually implement them, I discovered that my current implementation of the type system could handle only one or the other. I could cr…
I try to keep the ultimate goal of this project, to be used in a mud engine, in mind when I decide what features to implement next. So I decide that modules are next. Actually compiling a self-contained module is straightforward. I changed the 'ExecutionContext' into a 'ScriptEngine'. I gave it a g…
This entry will be formatted as a series of features, and some notes on their implementation.
First, I created a proper scope stack. This allowed me to fix the problem of variables 'leaking out of' blocks. Code like this used to be possible.
It takes mo…
First, I created a proper scope stack. This allowed me to fix the problem of variables 'leaking out of' blocks. Code like this used to be possible.
if (condition) {
int x = 5;
}
x = 6; //Just fine!
It takes mo…
I fixed those design flaws I talked about in https://www.gamedev.net/blog/342/entry-2250653-deyjascript-6-member-variables-and-design-flaws/ so here is the source. There isn't actually anything to say about it, as it doesn't do anything it didn't already do. Except string literals.
Some changes
-Func…
Some changes
-Func…
Installment six, in which I implement member variables and the whole thing starts to unravel. I always find that there's a certain point in a project where the abstractions that I've chosen suddenly show their flaws, and this is that point. A series of kludges, rather than proper design, makes this…
I have to say, after getting to the fifth installment in about a week, that I like this style of 'journaling' 'tutorials'. I'm not writing what you should do to create a scripting language, instead I'm just saying what I have done. It also forces me to find a single isolated feature and implement i…
In this installment I continue to reinvent the wheel by implementing function calls. First I write the grammar, and quickly implement calling system functions, since they already exist.
parameterList.Rule = MakeStarRule(parameterList, ToTerm(","), expression);
functionCall.Rule = identifier + "(" + p…
Time now for control structures. But first, I made some changes. I implemented registers, and I stashed the frame pointer and the stack pointer in there. The registers, like the stack, is just an array of objects. It's inefficient for integral types, but it allows the VM to pretty much ignore types…
Next I'm going to add variables. First I'll add identifiers and variable declarations to the grammar. I won't be supporting any sort of initialization yet, so I don't need to add that to the grammar. I also go ahead and create a statement rule, and a statement block. Later I added assignment statem…
Lets make a mud! Why? Why not? I love muds, which is very odd because one thing I do not love is actually playing muds. They are sort of a poor-man's MMORPG, an MMO you actually can run out of your living room. It amazes me that there aren't more people making them. I've actually built a mud engine…
I've copied this from my 'real blog', at jemgine.omnisu.com, as I almost always do. Perhaps, though, I should claim this as the 'real blog', since it has far more readers. This is about my 2d game engine, Jemgine, which I talk about all the time and nobody cares about. It's written in C# with XNA, …
So I wanted a simple GUI library for XNA, but all the ones I found sucked. Let me preface this by saying that there are some very good gui libraries out there for XNA, if what you want is a set of traditional controls. I don't. Some of these libraries suck, some of them don't, but what they all hav…
I want to teach my wife how to program. So I'm going to.
Step One : Trick her into writing code by making it a game. A week or so ago, I started writing a MUD, and I made her play it. She seems to enjoy it. She's not much of a video game fan, but a MUD is nice and slow paced, and she doesn't need to…
Step One : Trick her into writing code by making it a game. A week or so ago, I started writing a MUD, and I made her play it. She seems to enjoy it. She's not much of a video game fan, but a MUD is nice and slow paced, and she doesn't need to…
I'm cross-posting this to my journal on Gamedev.net because the journals there are now apparently free. A long time ago I had gdnet+ and I had a journal there, where I talked about some sort of mud engine I was working on or something. I'm sure that mud engine totally sucked, and the one I spent th…
Advertisement
Popular Blogs
Advertisement