Thursday, April 13, 2017

Logging the Creation of a Beast -- the Good, the Bad, and the Template Metaprogramming.

Thursday, April 13, 2017

Postby JoshParnell » Thu Apr 13, 2017 7:42 pm

Thursday, April 13, 2017

Rawr. I had almost finished this log when I accidentally closed it before having saved. Why hadn't I been aggressively saving after every few keystrokes like I usually do when I'm in vim? We will never know the answer :ghost: Please forgive me if I'm more terse this second time around...

Last week I gave myself "full permission to do nothing but ECS work." And boy did I take that permission and run with it. Frustratingly, I'm not yet able to come back with a happy 'I GOT IT YAYYY!' like I wanted to.

---

Entity Component System: What can I say? I am finding that building this thing requires taking into account a massive number of factors at all times, making it slow and mentally-taxing. I showed last week how I've been writing gameplay pseudocode to help guide me as I architect this thing. In a continued spirit of practicality, I did more of that this week, but additionally went so far as to write down a detailed list of every entity that I anticipate being in LT 1.0, along with every 'component' / piece of data and functionality that I anticipate said entities to need. At least this moves some of the factors I must consider onto the screen and out of my brain.

Doing so was quite revealling: it reinforced in my mind that very few components require 'special treatment' for performance. Virtually everything that does require special treatment can be grouped under a broad interpretation of 'related to physics.' Thrusters are the odd-man-out, as they require special treatment for rendering purposes. Whether I can gerrymander said special treatment into the realm of Lua via some magic or another (I do have ideas) is still unknown. Basically, I'd like to be able to fence off all such special treatment and shrink it to the minimal viable subset. I'd then like to draw a big line in the sand between C and Lua that makes said special treatment 'not the concern' of the gameplay programmer (aka me + mod writers). This is a Really Hard™ problem that I've tried attacking from a million different angles and will continue to attack from a million more until one angle finally prevails.

The TL;DR of the technical details is: they haven't been solidified. The technique to which I alluded in my last log (as well as the long post I made in that thread, in which some details of that ECS architecture were revealed as the 'first level' of the mod API) has been put aside after further consideration as being over-engineered. If it comes down to it, I'll come back to that one. But my review of the actual needs of LT gameplay showed me that it's probably overkill to use Lua to give metacode-style definitions of ECS-related data to the engine, which then JIT compiles them to native code. I now believe a less 'heavy-handed' approach is feasible by drawing the aforementioned line in the sand carefully enough. I'm currently working on such an approach.

Mod Loader / Hooks / Environment: Believe it or not, one of the easiest ways for me to audition ECS ideas is to treat them like mods. All it really does is force me to write highly-compartmentalized logic and to think in terms of events and event hooks (which I need to be doing). The end result is that I can swap out different ECS ideas (at least on the Lua front) without breaking other things.

To get this all working, I of course had to write a basic mod loader (which is very, very easy in Lua), define some initial engine-level event hooks, and hammer down a format for mods. It was all quite rewarding. Mods, at least those that operate only on code (rather than adding or replacing new non-code assets) already work, because I'm implementing my ECS ideas that way, which makes prototyping very quick!

I developed several neat facilities for the mod system. Sandboxing was a big one (mods can't access arbitrary stuff from the outside world), and Lua again makes this very easy. It's easy to make sure that mods don't, for example, plug into the filesystem and start deleting your C drive. The way it works currently is that mods have to explicitly request access to the APIs that they need. Without an API request, mods have virtually no power (they can't even use basic (unsafe) Lua statements like require!) So if I want to use the function 'Draw.Rect' anywhere in my mod's code, I need to add 'Draw' to the list of APIs that is requests usage of (which is done by adding to a list in an 'info' table that every mod defines which contains name, description, version, dependencies, apis, and more). If I don't, the engine won't inject the API into my mod's environment, so my mod will simply cause a crash when it tries to use a function from the Draw API. This is very cool, because it allows the game tight control over what mods do, and can provide modders and users alike with detailed information. No hidden network access attempts :) It also makes it easy for me to reason about my own code dependencies while I develop. And for one more bonus, it makes debugging easier, because I can see exactly what 'mod' (remember that I'm using them right now to prototype things) caused a crash or even issued a print statement.

Physically-Based Rendering Stuff: Ok, so I admit that, after more than a week of waging ECS war, I needed a break yesterday evening. I gave the evening to graphics Josh :monkey: I implemented the 'blind-you-with-all-the-things' style of HDR boom that seems so characteristic of high-end engines these days. It does look impressive. I'll turn it down a lot though...with it fully-enabled, the lighting in LT is literally blindingly-gorgeous :P

I also ported some of the PBR stuff from LTC++. I don't have the stamina since this is my second go at writing the log to talk details, so I'll just spew words this time. GGX environment map generation, better math this time (so arctangent, very sqrt, much spherical coordinates...wooww), faster as well; lighting just looks better with PBR yayy; combine it with above bloom tech and wowww beautiful reflections, eyes bleeding in all the right places. There you have it.

---

Guess what I'm (still) giving myself full permission to do in the coming week? Yes. ECS. Send your mental clarity vibes, I need them.

:think:




Hello again everyone! Talvieno here with a non-technical summary of this week's devlog.

Since our last update, Josh has been trying to figure out the ECS (Entity Component System) - the thing that makes ships, stations, asteroids, and more. It's a tough problem to work out. He wants modders to be able to access the bits they need (in Lua), while still keeping the slower portions in the faster C code (the LT core). Figuring out which bits go where (and how to make them all work together) is kind of tricky, but he's working on it.

Part of working on it is actually making "mods" to test it out. Josh can now load "mods" into the game, which is helping him figure out how to structure the ECS. As an added bonus, he's fixed the modloading process so that you can't make mods that do things they're not supposed to - like deleting everything on your hard drive or connecting to the Internet and downloading things. This is pretty much a necessity anyway, but he's come up with a clever way of doing it that he's proud of.

Finally - he made the game shinier. The graphics monkey has escaped, ladies and gentlemen - can we ever put it back into its cage now that it's released? :think: (It was only an evening's worth of graphic monkey, though, so we should be fine. ;) ) He implemented HDR bloom - a shiny glow you typically see from particularly bright light sources like sunlight. He's also ported some of his PBR code from the old LT version, so LT looks very pretty. (PBR is a lighting model that attempts to make materials model the flow of light the same way as you would see in the real world. This means more realistic-looking textures.)

tl;dr: Josh is working on the whole ship/station/asteroid problem and it's more difficult than he expected. He also added in some pretty graphics additions yesterday.
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
User avatar
JoshParnell
Developer
 
Posts: 4232
Joined: Sun Oct 07, 2012 3:06 pm
Location: Baton Rouge, LA

Re: Thursday, April 13, 2017

Postby IronDuke » Thu Apr 13, 2017 8:09 pm

Image
Moving toward the future at 60 minutes per hour.
I-War 2 thread
Epic Limit Theory Limerick
User avatar
IronDuke
Rear Admiral
 
Posts: 1370
Joined: Mon Aug 31, 2015 10:47 pm
Location: The other end of the weapons barrage that's killing you. :3

Re: Thursday, April 13, 2017

Postby Employee 2-4601 » Thu Apr 13, 2017 8:31 pm

Edit: Wait, I think I mis-read it and in fact you were writing in vim. In that case I can't help you, other than to suggest that you look into better autosave behaviour for vim?



JoshParnell wrote:Rawr. I had almost finished this log when I accidentally closed it before having saved. Why hadn't I been aggressively saving after every few keystrokes like I usually do when I'm in vim?
Gosh, why are you not writing it in vim in the first place?! I don't like to write any non-trivial text outside of my text editor.

I recommend a couple of browser extensions:

* https://addons.mozilla.org/en-US/firefo ... -all-text/
* https://addons.mozilla.org/en-US/firefo ... -recovery/

The first will let you invoke your text editor directly from a textarea form element in the browser.

The second will prevent you from ever losing text again if you do end up writing a lot of text directly in a web form, and something goes pear-shaped.
Employee 2-4601
Lieutenant Commander
 
Posts: 127
Joined: Sat Dec 13, 2014 7:19 am

Re: Thursday, April 13, 2017

Postby Talvieno » Thu Apr 13, 2017 8:37 pm

Employee 2-4601 wrote:Gosh, why are you not writing it in vim in the first place?! I don't like to write any non-trivial text outside of my text editor.

I'm the same way. :D
User avatar
Talvieno
Community Manager
 
Posts: 7974
Joined: Fri Apr 11, 2014 6:50 pm
Location: North GA, USA

Re: Thursday, April 13, 2017

Postby FormalMoss » Thu Apr 13, 2017 8:51 pm

\\o - Give me an E
o// - Give me a C
\\o - Give me an S
\o/ - ECS!!!

ImageImage
YAY PYTHON \o/

In Josh We Trust
-=326.3827=-


User avatar
FormalMoss
Captain
 
Posts: 953
Joined: Fri Jun 06, 2014 8:06 am

Re: Thursday, April 13, 2017

Postby Mistycica » Fri Apr 14, 2017 2:56 am

Picking up early access games makes me realize how much I'm going to appreciate Josh squeezing every ounce of performance out of this game right off the bat. I'd hate not to be able to experience the game properly because it thinks a 770 is below minimum :ghost:
panic
User avatar
Mistycica
Captain
 
Posts: 921
Joined: Thu May 29, 2014 1:02 pm
Location: Hungary

Re: Thursday, April 13, 2017

Postby JanB1 » Fri Apr 14, 2017 7:10 am

JoshParnell wrote:Rawr. I had almost finished this log when I accidentally closed it before having saved. Why hadn't I been aggressively saving after every few keystrokes like I usually do when I'm in vim?


Employee 2-4601 wrote:Gosh, why are you not writing it in vim in the first place?! I don't like to write any non-trivial text outside of my text editor.


Why using VIM in the first place? Why not use Sublime Text? :D
Automation engineer, lateral thinker, soldier, addicted to music, books and gaming.
Nothing to see here

Flatfingers wrote:23.01.2017: "Show me the smoldering corpse of Perfectionist Josh"
User avatar
JanB1
Captain
 
Posts: 754
Joined: Mon Mar 30, 2015 1:14 am
Location: Europe

Re: Thursday, April 13, 2017

Postby RedDwarfMining » Fri Apr 14, 2017 7:35 am

HDR bloom?! Nice! Have to wear sunglasses. :geek: Would be nice to have some motion blur. Anything to make it feel like I'm actually in space using my own 2 eyes and not just sitting at home remote controlling a spaceship.
User avatar
RedDwarfMining
Lieutenant
 
Posts: 83
Joined: Tue Nov 18, 2014 1:26 pm

Re: Thursday, April 13, 2017

Postby Employee 2-4601 » Fri Apr 14, 2017 7:46 am

JanB1 wrote:Why using VIM in the first place? Why not use Sublime Text? :D
Let's not start any pointless editor wars here?
Employee 2-4601
Lieutenant Commander
 
Posts: 127
Joined: Sat Dec 13, 2014 7:19 am

Re: Thursday, April 13, 2017

Postby N810 » Fri Apr 14, 2017 8:18 am

Why not wordpad ? :monkey:
"A sufficiently advanced technology is indistinguishable from magic."
- Arthur C. Clarke
User avatar
N810
Captain
 
Posts: 670
Joined: Mon Nov 26, 2012 3:20 pm

Re: Thursday, April 13, 2017

Postby Talvieno » Fri Apr 14, 2017 8:21 am

True oldschool is MS-DOS Edit. ;)
User avatar
Talvieno
Community Manager
 
Posts: 7974
Joined: Fri Apr 11, 2014 6:50 pm
Location: North GA, USA

Re: Thursday, April 13, 2017

Postby N810 » Fri Apr 14, 2017 8:40 am

Oh god not EDLIN !
"A sufficiently advanced technology is indistinguishable from magic."
- Arthur C. Clarke
User avatar
N810
Captain
 
Posts: 670
Joined: Mon Nov 26, 2012 3:20 pm

Re: Thursday, April 13, 2017

Postby 0111narwhalz » Fri Apr 14, 2017 9:00 am

Graphics Josh appeared this week, yet no eyecandy was shared? :think:
:ghost:
User avatar
0111narwhalz
Commander
 
Posts: 396
Joined: Mon Feb 01, 2016 11:40 pm

Re: Thursday, April 13, 2017

Postby Dinosawer » Fri Apr 14, 2017 9:42 am

He should use CRISPR, it's the future
Image

:ghost:
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Image
User avatar
Dinosawer
Admiral
 
Posts: 5614
Joined: Fri May 09, 2014 1:08 pm
Location: Belgium

Re: Thursday, April 13, 2017

Postby Graf » Fri Apr 14, 2017 9:49 am

Awesome work Josh! I once tried making an ECS system for a roguelike. It was a disaster. I'm glad yours is not a disaster. :thumbup:

Edit: I saw that Xkcd comic, Dino. I feel obligated to point out that many would claim that VIM did not win the editor war. :ghost:
Libertas per Technica
Graf
Commander
 
Posts: 243
Joined: Sun Mar 09, 2014 8:14 pm
Location: Virginia, USA

Next

Return to Dev Logs



Who is online

Users browsing this forum: Bing [Bot], pieman103021 and 6 guests