The Dink Network

Reply to DinkC++: An Intro. Article 1

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
November 15th 2004, 08:50 PM
wizardb.gif
Merlin
Peasant He/Him
 
NOTE: SINCE THIS BOARD SUCKS AND DOESN'T ALLOW AS-TYPED SPACING I HAVE MOVED APPROPRIATE CODE OVER USING PERIODS. <----Like that one.

DinkC++: An Intro
Article 1
==============

Many people ask me "When will Windemere be done", or "Is Windemere dead?", or "What are you doing on Saturday?" (Okay, truthfully, nobody has ever asked me that last one. But you might've already guessed that). Well, I am here not to answer those questions, but rather to answer them like a politician. And no, answering them like a politician rarely constitutes answering the question in my book.

Don't leave yet; more interesting things are to come. I promise.

Windemere has been through many stages, most of which have left me in isolation. I remember my first post at the Dink Network stated that I would rewrite the engine to form a “Dink 2”. I was alone then; like I am now – but that's a story for another day. I was alone then. Several programmers came my way after Seth's sudden decision to release the source code to his engine. That is where I made my first mistake: thinking I could use his code. Wrong. His code was a taint. And I don't mean a taint like a stain on the rug. I mean taint as in the anatomical area beween the anus and the testicles. And it was a taint that hadn't been washed in years.

Later on, after this first group of developers deserted another one joined. His idea was to make a DinkC++ language out of a parser and a lexer – a true language. He was able to recruit another developer who became our graphics programmer. After weeks of development, he disappeared and was never seen again. I think he died. Maybe he got hit by a car? Anyway, shortly after, the first developer disappeared. I am unsure of his current situation but I understand he lives in Australia. You all know what can happen there. He might've eaten Vegimite.

I am not writing this to tell of people who deserted me. If I was I could write a book. And I could keep writing for the rest of my life. And writing...and writing...people will hate me for that is their nature. But like I said, I am not writing this to tell of people who deserted me. I'm not even sure WHY I'm writing this. Anymore, anyway.

Windemere, in its current state, is...something. I don't even know. At the current rate of development (which will most likely decrease logarithmically) progress will be completed very early next year. Or maybe at the end of this year if I'm lucky. That said, take it with a grain of salt. Previously I had a chart on the website that stated various stages of development that were complete and those which needed to be completed along with estimated completion dates. I will not be doing that this time. I disappointed people after I was unable to make several release dates.

Maybe that's why people hate me?

So, I after I started rewriting the engine it became clear that I would need to quickly remove the previous stumbling block – the scripting engine. DUN DUN DUN. I tried using flex and bison to make a customized version but one thing became clear fast: I would never be able to make a decent language in the time alloted (i.e. Before I got bored and gave up). On my travels across the Interweb one day on my routine Google search for “[expletive deleted]” I came across the scripting language called “Lua”, Portuguese for “moon”. It had most of the things I wanted and it was better than I could have done. Which makes sense considering it was made over a period of years. YEARS.

I used this language as the basis for a new language that I dubbed DinkC++. It basically is Lua, but it has a few syntactical differences.

Let's take a look at the language.

Example 1:

function main()
....local v = 2;

....if(v == 2)
........v = 3;
....end

....return v;
end

As you can see it is very similar to Seth's tainted DinkC, with a few notable differences.

First, the most obvious one, there are no braces. But why? It looks less like C and is less intimidating to the new user.

Second, variables are defined typeless. This means that v could, in theory, be given several different types without consequence:

local v = 2;
v = “I am a string”;

That is perfectly valid. This is where you need to be careful, however. Global variables in the engine are integer-based, meaning that if your script assigns a string value to one of them your script will come to a grinding halt. The engine will still run, but weird things may happen depending on what you were scripting for.

Nextly, the language can do complex math like 2 + 4 + 42. And variables no longer have to be prefixed with the annoying-as-hell ampersand (&) character. Also, you can assign variable names 'variable1' and 'variable2' without them cross referencing each other. Wow.

The most obvious thing here is probably the return value. Yes, you can write your own functions now!

function GetAvg(x, y)
....return (x + y) / 2;
end

function main()
....local q = 1;
....local z = GetAvg(q, 3); // Z will equal 2.
end

Now wasn't that cool?

Just a couple spiffy other things: There is no limit to the amount of global variables one can have. One can also define a global right in the middle of his or her function by using MakeGlobal(variable_name) function. So:

function main()
....local x = 4;

....if(x < 5)
........MakeGlobal(“glb”);
........glb = 0;
....end
end

It is recommended to put your global definitions in the main.dpp file so you always know what they are, however. But it IS possible.

One final reminder: semicolons are optional. I'm just used to programming in C++ so I like them. But you might not.

I do hate preps though.

I will continue to write these article things as long as somebody reads them. My apologies if you could follow my logic.

So tell me, did I answer your question? Huh? HUH?