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

Post

Week of July 20, 2014

#1
Sunday, July 20, 2014

Huge day, but admittedly a bit too focused on LTSL :oops: I'm pushing hard to get my current content creation code factored into LTSL now that it's ready to roll. In the process of doing so, I'll also be working on exposing the engine through the script API. That just involves cleaning up the interfaces and providing appropriate descriptions.

Today I've got about half of the system creation code written in LTSL. The work is a bit slow because I've had to expose script interfaces for various object creation routines like planets, stars, and zones. I've had to expose random generators since they're essential parts of almost all of the procedural algorithms. Along the way, I've bolstered LTSL in a few areas, including implementing aliases for arbitrary functions, as well as implementing function overload selection that takes conversions into account (such that the compiler can correctly pick the right overload of the '+' alias, which could be Vec3_Add, Int_Add, Float_Add, etc.).

Most of what remains to be exposed and written in LTSL in terms of the system generator is related to items. I have not yet had a chance to expose item creation and manipulation through the script API.

I'm really getting more and more excited every day at the possibilities of content creation in LTSL :D I can't wait to have my content creation factored out so that I can iterate on it quickly (even iterating on it without restarting the engine!) This is going to be awesome news for the ship algorithm in particular, which is going to take massive amounts of iterating & re-iterating to get right.

---

This LTSL work is productive and fun, but with a little over a week left in the month, I think we really need to shift back to playability for a while. I also really want to finish off that warp tunnel work!! Bah..always so much to do :shock:

PS ~ Those weekly updates!! Where are they :cry: :oops: Err....
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Sunday, July 20, 2014

#2
Monday, July 21, 2014

Didn't get as much work time as I would have liked today, unfortunately. It was my last day in town so I spent some final time with family and friends before I head back to my cave to lock down the remainder of July.

In my work today I simply continued my progress in factoring out my system generator to LTSL. As usual, there was plenty of stuff to implement along the way, but I believe I'll be able to have the first real scripted system generating algorithm up with one more solid day of work :) Since this is my first real script in LTSL, it's giving me a good idea of how it feels to write code in this language. Thus far, I'm really pleased with that feel :geek: As with anything, there's room for improvement, but as a whole, I really do prefer the simplicity and readability of the LTSL system generator as compared to the equivalent c++ code. At the end of the day, they do the same thing, so it's not really something to get too hung up on. Still, I've been working with c/c++ for so long that I've come to have strong opinions about their syntaxes, and it's nice that I finally have a chance to do something about it.

Tomorrow I'll be driving back to the coding cave, where I hope to begin the final week's sprint. As with every month, there's plenty left to do...but the last week never fails to be more fun than all the others :) I'm intentionally leaving later in the day this time so that most of my drive will be at night, so I'll hopefully have very few distractions to take my mind away from LT :geek:

See you back at the cave!! :wave:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Sunday, July 20, 2014

#3
Tuesday, July 22, 2014

Woohoo! Back to the coding cave! :D It's nice to be home :geek:

So I didn't get any work done today thanks to the drive home, but I did get lots of great thinking time (and used it pretty thoroughly). Had plenty of thoughts related to gameplay (especially colonies), but honestly, most of my conceptual excitement revolved around thinking about LTSL and programming languages in general. It was a bit indulgent I suppose, because most of what I thought of probably won't make it into LTSL, but it's nice to think about.

Those who've been keeping with the dev logs for a long time may remember that I've had several 'hard times' wherein I suffered frustration at the C++ language (and languages in general) for failing to provide adequate metaprogramming capabilities. I let my mind wander a bit today in that direction, thinking about what exactly makes a language capable of serious metaprogramming.

It all started when I considered how we might allow users to define arbitrary types in LTSL. But that was just the tip of the rabbit hole :oops: I thought, how would that work? I looked at a piece of LTSL code and realized that types are basically nowhere to be found (with the exception of the 'Param' command). The language is statically-typed, but types are inferred from the types of expressions (speaking of which, why didn't C++ do that? Am I missing something? Isn't it obvious?? int i = 0; ...why? 0 is an int...the compiler already knows that :wtf: ). So where would a custom type even appear? Well, at some point, you have to allocate memory if you need a new object of a certain type. Most of that will be done in-engine (for example, when you call Object_Zone to create a new zone, that function is going to internally allocate the memory for you and you'll never actually need to worry about that). But if you need to use new memory in LTSL? Presumably there will be a 'new' call. This is where it gets interesting. What would 'new' look like? First thought (the obvious one) 'new <typename>'. OK. But what is a typename? It's a string that the compiler will use to look up into a table of typenames, where it has internal data that tells it about each type (size, fields, member functions, etc.) So, in reality, isn't it 'new <expression returning a type descriptor>'? Yeah :cool: Now we're cooking.

Let's take a look at what happens when you embrace a broader view of types. Consider something simple:

Code: Select all

Var ShipType TypeDescriptor_New
AddField ShipType "health" Int 0
AddField ShipType "name" String "Unnamed Ship"
For i 0 (< i 5) (++ i)
  AddField ShipType (Concat "myVar_" i) Float 0.0

Var myShip (New ShipType)
Set myShip.myVar_3 42.0
Is anyone still following? :) If that piece of code doesn't light a fire within you, then you're not a fan of programming languages :lol: What's going on there? Well, I've taken types and made them into data just like anything else. Instead of having loads of crazy syntax and special rules for defining types (which, by the way, ends up severely restricting your metaprogramming capabilities), why not just think of a type descriptor as data just like anything else, and manipulate it with functions just like anything else? Already you can see that I can do something with this code that C++ can't do without serious gerrymandering (an X macro or ugly template metaprogramming): I can add an arbitrary number of fields to my Ship class using real code. Is that elegant or...is that elegant? :ugeek:

Now, it's true, I've swept a few things under the rug here with respect to distinguishing compile-time evaluated expressions versus run-time evaluated expressions. But in principle this general paradigm can certainly work. It gets even more exciting when you start thinking about the same pattern applied to code rather than data (e.g., thinking of a script as a function that generates a piece of code rather than just a piece of code). Similar to LISP's mighty 'eval.'

---

Anyway. Enough rambling for the day. That stuff gets me too excited :lol: But tomorrow it's back to the steady grind - the grind of content, playability, and polish! :)
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Sunday, July 20, 2014

#4
Wednesday, July 23, 2014

Want to do a rather quick log today as I've got a fair bit of momentum going on at the moment...I'm rolling into this final week feeling more motivated and energetic than usual (yay!) :D

Content: Main Menu

Not much that I want to mention here, but I gave about an hour to the main menu today. I want to get that in shape soon, and, in particular, I'd like to start the universe creation interface. Since that's going to be a powerhouse of an interface (and also the first real LT interface that many people will see when they play for the first time), it'll be a great opportunity to flex the old nodal muscles :geek:

Polish: Smooth(er) Detached Camera

As of today LT's flight controls are the smoothest they've ever been! Not only are we now sporting the detached camera (as in LTP 1.1), but we've also got some nice, smooth interpolation for changing the detached camera angle. The interpolation is synched with game time (not render time), so it aligns in a silky smooth way with the update tick.

Getting closer and closer to the perfect piloting feel :)

More Script API Work...

Scalar fields are now fully-exposed to LTSL. Just puts me one step closer :D For things that are really more 'content' than 'code', like scalar field creation, LTSL really shines. Creating a particular shape of field looks quite a bit nicer in LTSL than in LT C++. That's great news, because it means we're accomplishing one of the most fundamental points of LTSL: to make content creation fast and easy.

---

Tomorrow I need to go ahead and make my final-week todo list...without some kind of attack plan for the remaining work this month, I'm going to be lost in a sea of hard choices! Ship algorithm? Finish imposters? Production? Colonies? HUD? Trade interface? Yep, there's always too much to do, but I wouldn't have it any other way :)
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Sunday, July 20, 2014

#5
Thursday, July 24, 2014

Wow, I'm so excited by today's work!!! :D Inspired by this poll and the obvious need for some serious ship generator work, I decided to devote my entire day to the ship generating algorithm and, in particular, getting everything hooked up in LTSL so that we can write full ship algorithms in scripts.

Content: Ship Generation in LTSL

I'm very pleased to announce that: it was a success! :) Well, don't get too excited yet. I have only just pulled off the integration, which means I saw the first script-generated ship appear in game about an hour ago. I haven't improved the algorithm at all yet, but the point is that I've got it running in script and can now start doing some real content exploration. Since I'm writing the algorithm in a script I no longer feel guilty or like I'm wasting my time on something that will ultimately need to be pulled out to script. We're here now and I'm ready to rock with some content!

What I want to do now is implement hot-swapping so that I can continuously regenerate my ship while the game is running. That's one of the lovely benefits of runtime scripts - I can iterate really, really quickly. Tweak a number in the LTSL, hit a key in the game and in less than a millisecond (yep, the LTSL compiler & execution environment are pretty darn fast!) I'll see the result. That's a whole lot nicer than changing the C++ and having to re-link the LT library. More importantly, since the engine takes several moments to start up, not having to restart the engine is going to be an awesome boon to productivity.

As excited as I am to explore ship generating algorithms and write my first real content, I'm even more excited about what I know the future will bring. I'm good at what I do, but I'm only one man and I'm spread quite thin. When LT is released, with an entire community of sharp people and a powerful scripting language that completely exposes the important LT code, I can't even begin to imagine what we'll ultimately see in terms of ships populating the universe. I have no doubt that, maybe a year or two after release, the procedural ships in LT are going to be ten fold as good as they'll be at release. Can't wait for you all to help me prove that proceduralism is the right answer to everything :D :geek:

In terms of actual implementation work, I'll just list the things that I covered today, since there was a lot:
  • Exposed PlateMesh API to LTSL (ships are built out of platemeshes)
  • Implemented the equivalent of if / elseif / else in LTSL (although IMO in a cleaner way than the usual)
  • Implemented some more Vec3 operations to make manipulating plate positions & scale easier than it was
  • Implemented script caching & reloading so that the ship generator will run as fast as possible, but can still be hot-swapped when necessary
  • Implemented boolean constants in LTSL (true / false)
  • A bit of work on constant analysis for LTSL compiler optimizations (this is going to be a huge step forward for the language, but I'm not going to get carried away with it, hence only 'a bit')
  • Ported the current ship algorithm to LTSL (and it looks so clean!! :geek: )
---

Picking up speed here in the last week, and getting so incredibly excited to see the LTSL work finally paying off with concrete results. Ship algorithms are just the beginning!! :D
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Sunday, July 20, 2014

#6
Friday, July 25, 2014

No! I need more time. Wait for me. I'm in the middle of something big right now with LTSL, ship generation, colony simulation, and even the interface. But I need more time. It's just not there yet :( So many hours but not enough yet.

Give me a day without wasted time on a devlog and I will give you presents!! :geek:

Christmas comes tomorrow.

See you... :wave:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Sunday, July 20, 2014

#7
Saturday, July 26, 2014

RAWR :mad: Absurd day, but still not good enough :(

Honestly guys, I gave it all I had - I put in way too many hours today, and I still didn't finish everything I wanted to finish. This is the first time I'm writing the real deal ship algorithm in LTSL. I wanted to finish it today - to have something worthy of recognition for your Christmas present. I'm darn close, but just didn't make it all the way. Along the way I ended up having to work too many new things into LTSL. It pushed us way ahead in the scripting department (seriously, LTSL scripts are going to be close if not equal to Python or LUA), but I just didn't finish that algorithm. I tried so hard :shock:

Here's what I did do, in list format, because I want you all to behold the glory that was July 26 :D :
  • Implemented hot-swapping so that models can be instantly reloaded from script at the touch of a key (already loving the instantaneous speed of iterating on content scripts!)
  • Implemented bezel parameter for platemeshes so that the shape of individual plates can be controlled
  • Implemented heterogeneous lists for easily manipulating lists of different types within LTSL (an alternative to using templatized vector types, and these will be compatible with user-defined types)
  • Implemented string constants and exposed string functions to LTSL
  • (HUGE!!) Implemented custom local function definitions - LTSL now supports as many custom functions as you like within the scope of an existing function. This is an absolute necessity for complex algorithms like the ship generator. It's rather a beast in terms of getting the compiler to do it, but it's done. Unlike C++, LTSL allows you to define functions as part of a scope (just like variables). This is extremely convenient, because it means that functions can be logically tied to the scope in which they are used. Very, very, very excited about this!
  • Implemented heterogeneous dictionary types for easily manipulating mapped values in LTSL (for now, this is a simple replacement for custom types. In the future it will be useful for a number of things, but until custom types are implemented, it's an absolute powerhouse of functionality)
  • Implemented automatic conversion to and from dynamic types - LTSL now supports natural dynamic typing by supporting the 'Any' type, which can implicitly cast to and from any type. Static + dynamic typing = win!
  • Implemented expression calling in LTSL (to work with local function definition)
Well, it may not have been the Christmas that we wanted, but it sure as heck was Christmas for me :) Having the ability to tweak the LTSL and regenerate a ship instantly is nothing short of awesome. It's everything I thought it would be and more.

Behold the glory of some random LTSL and all that it supports!! :geek: (Note: I have defined @ to be an alias for the print function! Easy debugging! :) )

Code: Select all

function (Test2 (Int count))
  function (MyFn (Int n))
    function (MySubFn (Int n)) (* n n)
    function (MySubFn2 (Int n)) (+ (* n 2) 3)
    MySubFn2 (MySubFn n)

  function (List_Dupe (List l))
    var sz (Size l)
    for i 0 (< i sz) (++ i)
      Append l (List_Get l i)
    l

  var list (List (Int 0))
  var rng (RNG_MTG count)
  Append list 1337

  for i 0 (< i count) (++ i)
    switch
      case (> i 6)
        Append list (Int (+ 1.0 1.999999))
      case (> i 3)
        Append list 0
      case true
        Append list (RNG_Int rng 0 10000)

  for i 0 (< i (Size list)) (++ i)
    @ (+ "Element " i " = " (Int (Get list i)))

  list
Perhaps another Christmas tomorrow?? ;) ;)

PS ~ I refuse to apologize for the dev log time today! Every minute of that lateness was a result of me putting in overtime!! :lol: :ghost:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Week of July 20, 2014

#8
Summary of the Week of July 20, 2014
  • Exposed loads of engine functions to LTSL
  • Type metaprogramming theory (admittedly a bit indulgent... :geek: )
  • First working ship generator in LTSL!
  • Implemented heterogenous lists and dictionaries in the engine and exposed them for use in LTSL
  • Implemented script function definition and calling in LTSL
“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 2 guests

cron