GSoC 2018 - Frameworks and content

asie

New Member
#1
Hello! In this thread, I will be keeping you up to date on progress with the frameworks/content project for Terasology.

Project summary

Summary: The initial plan of realizing the plan to add new frameworks and content to Terasology was to provide them as a way to power a sandbox-themed, survival-esque gameplay template for others to extend on. Due to engine limitations at this time, the plans have shifted somewhat, as not all parts of my initial vision could be realized in the engine as-is, and the time necessary to implement missing functionality would far outgrow the duration of GSoC. Frameworks and content will remain the focus of the project, however - the primary "target" is to develop a complete "virtual machine computer" system in Terasology while evaluating existing frameworks and/or adding new ones, with some secondary "targets" to come.
Mentors: Cervator, michaelpollind, SkySom, josharias
Student: Adrian "asie" Siekierka

Where to find me

IRC : asiekierka, #terasology @ Freenode
Slack : asie, #gsoc-frameworks
GitHub : asiekierka (repository TBD)

Project updates

GitHub Project Board : Here!
Blog : For the time being, in this thread, as I don't really have a separate blog that is sufficiently well-maintained at this time. I will be providing major updates at a rate of no less than one per week (as part of the report) - that is, if something important/interesting shows up, a post will be added outside of the usual report.
Stream : If circumstances allow, I hope to occassionally stream my development live on my Twitch account. I will also try to be available to answer questions there, though development can be focus-intensive!
Playtests : As the computer system is being developed in a way which makes it embeddable for other JVM games in addition to Terasology, it is likely it will miss the June playtest. However, I hope to have something playable for the July and August playtests!
 

asie

New Member
#3
Weekly Report, Week 1

What have you achieved in the last week?

This! To be specific, a minimum viable implementation of an OpenComputers-compatible sandbox in Java. There's still a long way to go in terms of cleanup and abstraction for the "fantasy computer simulation library" I have in mind, but being able to work based on a concrete, functional example is very helpful.

What are you currently working on?

Improving the OpenComputers emulation layer (as I said, minimum viable) and planning out a more abstract way to formulate the various components and interfaces that make up a "fantasy computer" in order to create a library which can hopefully flexibly accomodate a lot of them.

What problems are you currently facing?

Designing abstractions and systems isn't easy, especially if you want to have them be at least somewhat future-proof.

Is anything blocking you from making progress?

Not at this moment.

List of PRs and opened/closed Issues

Not strictly PRs or issues, but, as JNLua (the native Lua<->Java interop library) hasn't been officially maintained since 2013 nor had a general-purpose unofficial fork, I have begun work on one for Terasology: https://github.com/MovingBlocks/JNLua - right now, it mostly combines a few bugfixes from the OpenComputers project's version of JNLua with an improved Lua 5.3 port, as well as support for Eris - a Lua 5.2+ port of Pluto, which is a patch allowing serialization and deserialization of virtual machine state - something very useful for a "fantasy computer" module.

The library for "fantasy computers" itself will, unfortunately, be confined to my internal workspace for a few more days - shouldn't be long though!
 

asie

New Member
#4
Weekly Report, Week 2

What have you achieved in the last week?

I made the fantasy computer library (Kallisti) capable of using a JSON-controlled simulator for testing the machine logic outside of a game engine. I also made OpenOS work far better than it used to, and pushed the whole thing on GitHub: https://github.com/MovingBlocks/Kallisti

What are you currently working on?

Sandboxing, persistence, synchronization. In an unknown order.

What problems are you currently facing?

Nothing in particular.

Is anything blocking you from making progress?

Not at this moment.

List of PRs and opened/closed Issues

https://github.com/MovingBlocks/Kallisti is a new repository! With code!
 

asie

New Member
#5
Weekly Report, Week 3

What have you achieved in the last week?

Most importantly, refactoring the graphics rendering logic for server->client synchronization in the future. Also, minor improvements across the board to JNLua and Kallisti, including buildsystem improvements to JNLua, integration of the memory limit patch, etc.

What are you currently working on?

I've yet to port over (no real way to do it through reimplementation, due to how specific it is) the persistence logic from OpenComputers to Kallisti. After that, it's time to work on documentation and also take up some minor backlog projects (related to Terasology content, such as finishing the barrels!) as I'm a bit ahead of schedule.

What problems are you currently facing?

My schedule has become a mess. But that will end in two weeks or so. Until then, scheduling work is a tad complicated.

Is anything blocking you from making progress?

The schedule isn't strictly blocking me, but it is a hindrance.

List of PRs and opened/closed Issues

I've opened one on JNLua, but that's more "a note to remember for post-GSoC maintenance ideas/stretch goals". Mostly commits to the two projects.
 

asie

New Member
#6
Weekly Report, Week 4

What have you achieved in the last week?

Cleanup and communication. Creating diagrams documenting the planned and implemented architecture of Kallisti, bugfixes in Kallisti's OpenComputers logic, preparation for implementing within the scope of the Terasology sandbox, communicating with mentors, as well as rearranging the schedule to match new developments. In addition, taking care of the "backlog" (evaluating the state of other Terasology contributions I worked on during the bonding period and beginning of GSoC and wrapping up the pull requests).

What are you currently working on?

After evaluating my schedule and work to date, I've decided to start implementing Kallisti inside Terasology a bit early. However, there's nothing to show yet - most of the work has been in examining how to best translate Kallisti library concepts to Terasology engine logic, some code has been written but not a whole lot yet.

What problems are you currently facing?

I accidentally got rid of my barrel code! I'll have to rewrite it once the computers work.

Is anything blocking you from making progress?

Schedule hindrance, but this should end next week. Other than that, integrating JNLua and Kallisti into the build system isn't strictly blocking me yet, but might start to soon.

List of PRs and opened/closed Issues
 

asie

New Member
#7
Weekly Report, Week 5

What have you achieved in the last week?

Not failed university.

No, don't worry, just kidding - I decided to do other minor touch-ups, though not many as I'd have liked to due to an unlucky combination of four exams occuring in the span of this week. On the JNLua front, I migrated it over to use 64-bit integers where applicable (for better Lua 5.3 support!) and cleaned up some of the JNI hooks; on the Kallisti front, I fixed a bug in OpenComputers emulation and added some more Javadocs.

What are you currently working on?

I want to finally get Kallisti working in Terasology, of course! The deadline is roughly July 5th, as to make it into the month's playtest.

What problems are you currently facing?

None.

Is anything blocking you from making progress?

Scheduling! Scheduling wasn't very good. But I'll make up for it with the upcoming few weeks.

List of PRs and opened/closed Issues

Some commits on JNLua and Kallisti, as well as the usual updates on the GitHub project board, but not much beyond that.
 

asie

New Member
#8
Weekly Report, Week 6

What have you achieved in the last week?

Not failed university and got back to work! Catching up with KComputers (the new computer module), implementing all the necessary logic to get a computer in-game by July 5th.

What are you currently working on?

As above.

What problems are you currently facing?

Terasology's engine acts in ways entirely foreign to mine, as well as some setup problems - they'll have to be taken care of fairly quickly, though.

Is anything blocking you from making progress?

A few hours before the weekly meeting I ran into some library classpath setup issues. But - I'll tackle them at the meeting.

List of PRs and opened/closed Issues

New repository (not yet functional): http://github.com/Terasology/KComputers

Special Edition: Halftime Notes

So - halftime. Halfway through GSoC. For those of you who are reading this, some valuable advice I've noticed so far:

- Don't pitch projects which you think make sense given the current state of the game. Make sure you know that the codebase can take them. The initial plan for tackling this project has just about collapsed, thankfully I managed to recover by going for a pre-GSoC-discussed "plan B" which still leads towards the goals proposed in the initial agenda - you might not be so lucky!
- Communicate, communicate, communicate. I don't just mean Javadocs - always make sure that you are aware of what the mentors are looking towards, and that the mentors share your vision. It might get hard to explain things weeks into the project when you're five layers of abstraction ahead. This is what the weekly meetings are for, thankfully. For example, when describing Kallisti's internal architecture, we eventually arrived at drawing a set of diagrams which explain how the various parts of it are interconnected - and that helped a lot.
- If you are considering doing a project as part of GSoC but aren't exactly sure if you're cut out to do it, don't stress so much! You'll be fine :) Just make sure to create a realistic schedule and pitch, suited for your abilities (or perhaps just a tiny bit ahead of them, so that you can, with the mentors' help, reach up and learn something new).
 

asie

New Member
#11
Weekly Report, Week 7

What have you achieved in the last week?

Got Kallisti's OpenComputers framework to run inside of Terasology, in multiplayer, and it is also (almost) sandbox-friendly too!

What are you currently working on?

Cleaning up the remaining bugs and sandbox support for the weekend playtest, as well as integrating JNLua into Terasology's engine.

What problems are you currently facing?

There's a weird race condition with regards to initialization of the "test block".

Is anything blocking you from making progress?

Roundtrips regarding Terasology sandbox/engine adaptations take a bit of time. Other than that, no.

List of PRs and opened/closed Issues

https://github.com/MovingBlocks/Terasology/pull/3411 and there should be another one coming today or tomorrow. Maybe even two!
On top of that, some issues were raised privately via Slack.
 

asie

New Member
#12
Weekly Report, Week 8

What have you achieved in the last week?

Made progress with regards to getting KComputers running in an unmodified Terasology environment. However, last week has felt somewhat disappointing to me overall.

What are you currently working on?

Too many things! This is the mistake I had made - I started too many projects at the same time. Most recently, I've started work (on the sidelines) of porting Terasology to Gestalt v6 (from v5), inspired by one of the fixes necessary for KComputers being pushed to v6.

What problems are you currently facing?

Kallisti as-is relies on method reflection, which Terasology's sandbox rightfully does not allow.

Is anything blocking you from making progress?

Not really.
 

asie

New Member
#13
Weekly Report, Week 9

What have you achieved in the last week?

Collapse and disappointment, mostly! A lot of time was spent debating the way to go forward regarding Kallisti's non-cleanly-solvable dependence on method reflection, and I think we found a way - as such, development has gone back to trying to fulfill the original scope of the project.

It turned out that some refactors in Kallisti had to be done which I had not planned for - after those, development has been moving forward.

What are you currently working on?

Multi-block monitors, an inventory for the Computer block and de-hackification, so to say.

What problems are you currently facing?

Adaptation of the sandbox is still a bit of a wildcard.

Is anything blocking you from making progress?

Not really, not anymore.
 

asie

New Member
#14
Weekly Report, Week 10

What have you achieved in the last week?

Resolved problems which prevented the project from going further at the speed it could. Some refactors and code cleanup. Decent progress on the computers' functionality, though some of it remains invisible. Forked off Eris (the Lua fork we use) and updated Lua 5.3 for additional bugfixes.

Overall, less than I would have preferred, but at least the project is definitely back on track now. Apologies for disappointing.

What are you currently working on?

Lots of things!

What problems are you currently facing?

Nothing!

Is anything blocking you from making progress?

Nope.
 

asie

New Member
#15
Weekly Report, Week 11

(Despite being posted on August 3rd, it covers work up until July 31st)

What have you achieved in the last week?

Going at a much faster pace now, most of the work in this week was devoted to making computers play nicer in-game - in particular, computers are now fully configurable using in-game items, refactors have been done internally to improve customization possibilities by other modules, and work has almost been completed on functioning saving to and loading from file the states of the machines!

What are you currently working on?

Wrapping up, really - there's not many things left to do, but less time than I would have wanted. At least I'm no longer multi-card drifting.

What problems are you currently facing?

None at all.

Is anything blocking you from making progress?

Not currently.
 
#16
Weekly Report, Week 12

(Despite being posted on August 10th, it covers work up until August 7th)

Well. We're almost there.

What have you achieved in the last week?

With major help from Cervator, we discussed and then integrated JNLua into the Terasology engine and made Kallisti available as a module - thanks to those changes, everyone can now use KComputers without any special tricks (aside from a permissions-related patch - this will, unfortunately, only be finished post-GSoC).

Kallisti received finished support for persisting a virtual machine's state to a file, and reading it back, as well as some bugfixes pertaining to OpenComputers environment emulation.

KComputers received major refactoring of machine registration to make it more extensible and open to add-ons, an implementation of an inventory-manipulating Transposer, an (unfortunately unfinished) implementation of a Signalling-interacing block, dynamic component detection and removal for in-world computers, and a few bugfixes for multiplayer use (still not perfect, though).

What are you currently working on?

Wrapping up! Remember when I said I would be wrapping up last week? This is not wrapping up. This week, however, will be, as I have to do that as well eventually.

What problems are you currently facing?

None.

Is anything blocking you from making progress?

No.
 
#17
Final Report

During GSoC 2018, my goal was to "add new frameworks and content to Terasology". Despite the initial project plan not working out as well as I had hoped, I believe I not only made a valuable contribution to Terasology in terms of content, I also believe I have made important notes and observations for the future of the project as an effective near-total outsider.

What has been achieved?
  • "Kallisti" - a framework for virtualizing "fantasy computers" geared towards usage across arbitrary JVM-based engines.
    • An API for communication between "Kallisti-side" and "engine-side" objects and concepts.
    • A fully-functioning implementation of computers following the API outline of the "OpenComputers" mod as the first supported "fantasy computer".
    • A simple simulator with JSON-based definitions for using said fantasy computers standalone, as well as testing the library's behaviour.
  • "KComputers" - an implementation of Kallisti for the Terasology engine.
    • In-game displays capable of both viewing in-game on the block, as well as in an UI.
    • Item-configurable "Computer" block.
    • Example peripheral implementation: Transposer, for manipulating neighboring inventories.
  • A forked version of the no-longer-maintained JNLua project, integrating various patches, as well as cleaning up code and adding new bugfixes/improvements developed specifically for MovingBlocks.
  • A forked version of the similarly no-longer-maintained Eris project, which is a fork of Lua 5.2 and 5.3 allowing for persisting virtual machine states. During GSoC, I have updated it to use Lua 5.3.5.
  • Important observations about missing frameworks for the future, preserved on the Terasology Slack instance and being compiled into useful notes for the development team.
  • An implementation of Barrels, developed during the bonding period as a way to learn the codebase's specifics further - unfortunately, the source code has been lost (see below), but screenshots remain: Screenshot 1, Screenshot 2
  • Assorted pull requests to Terasology: #3387, #3411, #3430, and as a way to try working with the codebase pre-GSoC #3327
Where can the code made specifically for GSoC be found?
What has not been achieved?

In general, as I feel my output at GSoC 2018 overall has been slightly sub-par - even if the initially agreed-upon goals have largely been met - I am pledging to finish all of the stated goals for GSoC 2018 within the next month or so, as to be satisfied with my contribution to the project under the GSoC program. I also plan to help maintain all three "big" repositories further, with a particular focus on JNLua due to its general-purpose usefulness. (Note that, as to not interfere with the evaluation projects, said work will only begin after August 22nd - during the evaluation period, the repositories will be effectively "frozen".)

From the project plan:
  • An API in Terasology for allowing per-world storage. It will be added shortly after the evaluation period is over, as it is an important omission forbidding usage of key Kallisti features, such as persistence, in the game environment of Terasology.
  • An automated testing framework for Kallisti - I never arrived at a good vision of how it should work. If I arrive at one in the near future, it will probably be added as well.
  • Multiblock monitors. They are not crucial, and work on them has been started during GSoC.
  • Adjusting the Terasology sandbox to support KComputers without "lifting" the sandbox. The approach for doing this is done and decided upon, however the change has many ramifications which need to be discussed and tested before releasing - as such, it had no hope of being done during GSoC with many other large changes being simultaneously developed. It will also be worked on in the near future.
  • Implementing an I/O peripheral for KComputers to communicate with the Signalling module - the latter has noticeable limitations of use preventing such an I/O peripheral from being adequately implemented. The source code of the attempt is preserved here.
Unfinished Terasology-related projects done during GSoC:
  • Migration of the Gestalt engine from v5 to v6. This has actually been started on, but other priorities were more important during the project's realization. This will also be finished after the evaluation period.
  • Contribution of Barrels, "GUI-less" inventory container blocks. I have written the source code for them before GSoC (during the bonding period), but unfortunately lost it. Parts of it have been rewritten from memory (MeshRenderComponent) to faciliate the development of the KComputers module. I hope to also bring it to Terasology in the future.
Bugs found during development:
  • A few synchronization issues in dedicated multiplayer instances. Cause unknown, noting that Terasology is fairly GPU-intensive (speaking as an user of an Intel integrated graphics card) which does not help debugging two instances of it simultaneously.
Near-future plans unrelated to the GSoC project plan:
  • Lua 5.4 is coming; JNLua and Kallisti will both definitely receive support.
  • There are a few TODOs in the source code for areas which meet the project plan's requirements but could be improved further, or have some limitations. Those could also be tackled.
What should be done in the (far) future?

Regarding changes in Terasology's engine mentioned above, this will be part of a separate forum post due tomorrow morning (before the evaluation date is up, of course).

Regarding changes in Kallisti, I think an important thing to work on is adding new architectures to Kallisti, in particular a low-level "opcode-emulated" architecture to try and adjust the API to better cover new use cases.

As for KComputers, it could definitely use some addons (I hear a minecart add-on is already being developed, as is an update of FluidComputerIntegration to utilize Kallisti's computer APIs) and polishing!

What challenges were faced and what have I learned?
  • Working with an entirely foreign, highly abstract/"academic" Java codebase. While I have spent a long time developing in Java, I haven't had a chance to work extensively on a project which tries its best to utilize good practices of object-oriented design, as well as game engine design. The takeaway from this is being better and more experienced at gathering information from them and working with them, which will definitely aid me in future projects.
  • Time management! As I have never held a "job" before this, combined with effectively working "from home", I found it particularly hard to manage time to efficiently devote to the project, which led to a few issues along the way - while almost all goals were met regardless, I could have definitely done this better.
  • Communication and teamwork. A few times along the way, it turned out that I was insufficiently clear to my mentors with regards to what I was working on. As such, I had to use tools I haven't previously incorporated widely in my development practice, such as diagrams, in order to try and find ways to more clearly state my design concepts and intentions.
  • Changes! As I have decided to work on Terasology as a near-outsider to its source code, I had to change designs and concepts rather often to match engine best practices.
I'd like to thank my mentors for the help and support they've provided, even if the road was somewhat bumpy, and apologize for my shortcomings at my very first "job-like" development project. I hope that, when we meet next time, I will be able to provide even more valuable contributions to the project.

Finally, I'd like to thank all of you who have been following the project's progress for the past three months. I hope you'll find the contributions useful.
 
Last edited: