Return to “[Archived] Daily Dev Logs, 2012 - 2015”

Post

Week of June 8, 2014

#1
Sunday, June 8, 2014

IT LIVES. :shock: :shock: :shock:

Yes folks, it lives. Today, for the first time, I have used UDF to write a functional structure, and successfully used the StringTree + function reflection pipeline to convert it to a callable expression, and successfully called that expression to obtain values. It's freaking exciting. Suddenly LT has scripting capabilities, but without the work of having built a scripting language. It's just data. But it's function. Bah...you know :crazy:

The great thing about this is that...it's all done generically, through the existing tech in the LT engine. That means that, in theory, it supports...everything. I should be able to manipulate objects, call any functions, and basically do anything that I choose. Awesome :cool:

Now what I need to do is start exposing my functions through the reflection engine, which I haven't done yet for the most part (I tested today using some placeholder functions).

So...give me another day of working on setting up those functions and...we should have content capabilities in no time :)

Man I'm pumped!!! :D
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#2
Monday, June 9, 2014

Massive day. No other way to say it :)

Parametric Types in UDF

I knew that this would be one of the greatest challenges in trying to support full-featured functions in UDF: supporting parametric types (such as vectors, lists, pointers, references, etc.) Parametric types are naturally harder to deal with than non-parametric types, because they encompass a potentially-infinite list of concrete types.

I'm pleased to say that, as of today, the UDF expression compiler now fully supports parametric types. It does so using 100% native code, meaning it runs as fast as it's possible for a dynamic expression to run in c++. The technical heavy-lifting behind this feat is..pretty tremendous. It was another one of those neuron-burning days, that's for sure :shock: Really tested my coding muscles. But I'm pleased to say it turned out wonderfully :)

What this means is that I can now write something like Vector_Create(10, Asteroid_Create(blah blah blah)), which will create a vector of 10 objects and populate it using the given expression (which will be evaluated 10 times to fill the vector). The expression compiler automatically deduces the parametric type based on the type of the inner expression, which means no need to write Vector_Create<Object> or anything weird like that. The expression compiler also automatically links itself up to the appropriate member functions of the parametric type so that it can natively call, for example, the push_back function for a Vector<Object>. No weird wrappers, thunks, or other dynamic hackery required. Just fast, native code. That's just pretty darn sweet...!

It's also worth mentioning that, when I say fully supports, I mean it. UDF could now understand something as complex as Map<String, Vector<Object> >, for example, which is a pretty darn complex type. Granted, I don't think we will need that kind of thing much in practice, but the support comes for free :geek:

What I'm working towards here is...getting a basic system generation algorithm written in UDF! I will frame it as a function that returns a vector of objects. The engine will then place those objects into the system. It's actually a pretty complex example for my first trial of writing content algorithms externally...but I'm excited to have a whack at it!

Automatic Modding API Documentation

One very awesome thing I've realized about function reflection in the LT engine is that it opens the door for automatic generation of documentation for the modding API! Using the function reflection engine, I can simply iterate through all the exposed engine functions and output their information (return type, parameter types and names, and a description string) in a neat, organized fashion.

So...that's pretty cool...as long as I write good description strings for all exposed functions, I get a self-documenting API! Without using any external tools like Doxygen! I love free stuff :lol:

Variables and Execution Environments in UDF

One hairy beast that I've yet to tackle, which I will really need for doing serious work in UDF, is variables. I need to be able to bind values to a label for later recall. Doing so will require setting up and maintaining an execution environment so that expressions can look up variable names within that environment.

The first iteration shouldn't be too hard. I will do the traditional lazy thing and just map strings to script objects. After I have that working, I'll want to look into a faster, register-based system in which variable labels are bound to environment indices at expression compile-time. That will allow constant-time access of variables, which is, of course, the only acceptable thing :) Ah, but I'm getting ahead of myself!

---

I've said it before, but with everything happening lately, I think it's time to say it again: tech is not to be underestimated. I'm sure there have been times when it's seemed like I've gone off the deep end with engine tech. But finally we are seeing tremendous payouts in all areas. Modding for almost no extra devtime cost? Yeah. I think that's a good enough payout right there...but there are so many more payouts that just keep coming.

It's nice to know my work was not in vain :)

Lovin' June so far...how about you? ;)

PS ~ Yep, I'll get those weekly summaries...eventually...:shock: :ghost:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#3
Tuesday, June 10, 2014

Not as massive of a day, unfortunately, as I hit some serious technical blockage while trying to expose member functions through the modding API. Every time I do intense work like this I become more and more convinced of how critically-flawed c++ is as a language. Yet, it's still my favorite :)

Thankfully, just a few minutes ago I finally overcame the hurdles and now have it all working nicely :thumbup:

In the next few hours I will be working to expose the object creation functions so that I can start building and manipulating real game content from UDF! Really hope to have a basic asteroid field or something generated from scripts before I go to bed. That would be a fantastic present :)

This work is going really well and whatnot, but I need to not get stuck in one place this month. I should look to switch to more AI content in the next few days... :geek:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#4
Wednesday, June 11, 2014

Gah, wasn't able to hit my goal of scripted system generation by the end of the night :cry: Maybe it was a bit too ambitious :| I realized that, in order to really write a useful piece of system generation code, I need to have close to the full feature set of the UDF language, rather than the small snippet that I thought I could get away with.

UDF Variable Implementation

Today I've had my first successful test of variable assignment and usage within UDF! As mentioned yesterday, my first implementation is simple (and lacks static type checking), but it works :)

I'm definitely going to need this to get anywhere with system generation. I'm also going to need looping constructs, which I hope will come in the next few hours...

UDF Block Statements Implementation

I've also implemented block statements today, which just allow one to write a whole set of statements that execute within the same scope. The return value of the block statement is equal to the return value of the last statement in the block (this is basically the same as the c++ comma operator, except that in functional languages it's actually useful :roll: )

---

Still excited, still anticipating that first working piece of scripted content generation, and still wishing that I could move on...but this is definitely going to be a great thing when we get it :D

PS ~ Some of you may have noticed that the forums seem slow lately, and some of you have probably experienced SQL error messages. I have contacted the host and they are having server issues at the moment, but are working to fix it. Hopefully we will be back to normal soon. I apologize for the inconvenience! :)
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#5
Thursday, June 12, 2014

SUCCESS. :cool:

Sorry for the rather late log, but I couldn't bear to post until I had overcome the mountain! Literally 5 minutes ago, I have finally mustered my first working, real game script. In this script, I create a simple distribution of asteroids scattered around the system, using basic randomness and math. Albeit simple, the script demonstrates usage of looping, variables, member functions, parametric types, and of course, manipulating game objects. Nearly everything we need for functional game scripts. Awesome :D

It took a while to get here, but finally we can start doing real things and writing real content algorithms. As I always say when it comes to developing tech, "it will be worth it in the long run" ;) Has it not been true thus far? :geek:

Looping, Assignment

More expressions have been implemented today, as I needed to use both loops as well as variable assignment to get my little system generation example working.

Scoped Variables and Static Type-Checking

Just worth mentioning, since it took me a while to do, but I now have properly-scoped variables (meaning, for example, 'x' can mean one thing in an outer scope and something different in an inner scope) and static type checking (meaning expressions involving variables are checked at script compile-time) in UDF. Two more steps forward :)

---

Ok! Let's get rolling! Time to start building some stuff, don't you think :)

PS ~ Hoorah! Forums seem to be back to normal!
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#6
Friday, June 13, 2014

In the zone today ;) Who says Friday the 13th can't be a great day :ghost:

Formalized Planet Types

With a month of content on the way, I want to be able to easily play around with and roll out new planet types. Until now I haven't properly formalized the code for planet types as I have for other objects (ship types, station types, etc.) Doing so is a bit of work because planets are rather complex beasts compared to most other objects.

I still haven't managed to finish this bit, but I won't go to sleep until it's done! Then I can start playing with new planet types ASAP :D I'm hoping to see something other than a terrestrial planet in this month's update.

Soft Lens Flare Occlusion

Finally! You've all been complaining about it for a while, and I've been equally annoyed by it: lens flares (especially that big one from the central star) being totally occluded by tiny little objects and blinking into and out of existence. Well, in keeping with this month's promise of polish, I have finally tackled this one.

We now have soft lens flare occlusion: flares fade in and out of existence over a short period of time when they are occluded, rather than blinking in and out. This means that flares remain stable when a small object briefly passes over them. It's still not 'full' testing (e.g., actually computing how much of the flare is occluded), because that would be too expensive. But it works quite well :)

Soft occlusion is nontrivial because it requires reading back depth data from the GPU, which can always get expensive. But I implement it today in a very fast way: by generating visibility directly to a texture, using an input texture that contains the flare data. This means that visibility is computed for all flares in the scene in a single, fast draw call. Yay :geek:

Function Overloading & Overload Resolution in UDF

My focus wasn't on UDF today, but I still had some time to implement function overloading and resolving calls to overloaded functions, just as you would expect from a real language.

I have yet to implement automatic implicit typecasts, but I already have the architecture for it ready. Just need to write a bit of code. That's going to be a big jump forward :)

---

There's just too much to choose from! UI, AI, new graphics content, scripting...it's overwhelming! So much fun to be had this month. Just keep the hours coming :geek:

PS ~ Boom. Finally caught up with the weekly summaries. I think you can tell, just looking at them, that May wasn't my most impressive month. I hope to be able to say otherwise for June ;)
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#7
Saturday, June 14, 2014

Last night I did what I promised: I finished planet types before I went to bed, meaning that the engine now has a discrete concept of planet types that is separate from instances of planets. In doing so, I cleaned a lot of code and just generally made the planetary architecture better :) The road is now paved for having fun with new types of planets!

But, other than that, a bit of a different day than usual, thanks to the...

Code Intervention

Occasionally, there comes a rare day in my life that I like to call "code intervention." It is a day where I finally recognize that the number of things that I've been not doing in favor of coding has simply gotten out of hand, and my life cannot continue to function smoothly if I do not simply ban myself from coding for the day. Indeed. Strange situation :monkey:

The thing is, left to my own devices, I will do little other than code. Respond to email? No, I can't, I need to code. Do the dishes? No, I can't, I need to code. Shave? :shock: ...well, you get the idea. The problem is, in a time when the game is supposed to be coming out 'very soon,' there is simply never a time when I can say "OK! I've coded enough for the day, I will do other things." I can't remember the last time that thought went through my head. Probably somewhere between a year ago and never :lol:

So, what did I do today? Well, on the work-related side, I got back in touch with the people with whom I need to be in touch. I should do a better job of that, but codemonkey Josh is very bad at communicating :roll: And on the other side, I...cleaned the house, did dishes, took out the trash, shaved, did laundry, fixed the broken panel on the AC unit, bought a new microwave since the old one was broken, and generally just got my life back in order :thumbup:

---

I'm happy to have my non-code life back in order. I feel better, and less guilty about shamelessly coding for all hours of the day and night. That's always a good feeling :)

Now then! I hereby unban myself from the code.

Have at it :geek: :squirrel: :squirrel:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of June 8, 2014

#8
Summary of the Week of June 8, 2014
  • First working test of using UDF to create functionality!
  • Implemented parametric types in UDF (particularly for Vectors and Maps)
  • Implemented UDF variables, blocks, loops, overloaded functions...whew :shock:
  • First working external LT script (creating and placing some asteroids)!
  • Finally softened lens flare occlusion for less abrupt flare cuts
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford

Online Now

Users browsing this forum: No registered users and 1 guest

cron