Wednesday, 1 June 2022

OFF GRID devblog "Keep it Clean"!

Hello and welcome to the latest devblog.

As we are now firmly into tech and feature lock and finalising all systems to help speed up developing content, this last couple of sprints we decided to get to grips with the AI and get it cleaner and easier to write and use for gameplay. It made sense to do a pass to tie up loose ends and close the door on some of the AI designs or features that had been left open ended (thanks to the modular system they can always be further added to later!). But in digging around and doing code review, we came across a few other things that deserved some attention too...

OnMissionStart()

 
While doing AI clean-up, we ran (once again) into the complicated mess our mission start-up process had grown into over the years, and decided it's time to give that a thorough look as well. Since this all was something that had just been built gradually as we've added new features and changed design requirements, it wasn't all making awfully lot of sense any more, with confusingly named functions both on C# and in the Lua API, half the game system starting up in an event called "OnMissionStart" which was actually executed way before the mission starts, halfway through then mission setup, before we've spawned in any characters or even started loading any save data and so on...

A good months worth of digging around, and documenting the relationships between everything into a graph, and searching through the codebase for all kinds of legacy systems and checking what it's all doing, we now have pretty good documentation of all the things that happen between loading a level and letting the player in, and were able to re-organize and rename our way through it to create something that makes a bit more sense. And had a good chance to update some truly ancient systems here and there to work with same logic everything else does, and remove some that had no purpose any more.

Apart form some renamed Lua API functions, this is of course all completely hidden from the player's point-of-view. But it certainly makes it easier for us to work with and keep track of what's supposed to happen, and when, and also smooth out the level start experience and even improve our fail-safe systems in case something goes wrong when trying to load a save or start a level from a mod. So while it took ages to get done, and certainly wasn't as interesting work to do as creating new game systems is, it was definitely maintenance work worth doing!

AI cleanup

In the last couple of sprints the majority of the work related with the AI all revolved around doing a big cleanup and review of all the corresponding systems. It was significantly more broad and complicated work than we initially thought, but thanks to that in the future it is now going to be easier and quicker to tweak or add new features or systems, and more importantly much cleaner for modders to expand the AI too!

Some unfinished and unused systems were removed, several AI actions were improved with cleaner code, there were systems we tidied up that in the past were needed but have been deprecated because improvements in the overall game and AI design, or thanks to a more flexible agent creation system.

We also had a spell bringing the documentation up to date and inline with these changes, and so OFF GRID’s wiki, especially in the agent definition page now gives a much more accurate and detailed portrayal of these systems.

Change List:

Core Systems

  • Refactored mission startup 
AI
  • Much AI code tweked and cleaned
  • Global AI Systems (GOAP system and ModularAgent for when spawning NPCs)
  • Agents Personality
  • Chairs (for agents to sit)
  • Every AI action (generic, use point and specials)
  • Drone specific code
  • Flashlight related code
  • NPCs Animation Control
  • Code related with AI using devices on amok
  • Unfinished and unused AI systems and actions removed because they were outdated
  • Added information in our wiki about some actions already added and overall information in the Agent Definitions page

Bugs fixed

  • AI bug fixes and tests


If you haven’t already - be sure to wishlist Off Grid on Steam - each wishlist makes a big difference to us, and we really appreciate your support!

2 comments:

Unknown said...

Cool,
I really appreciate the time spent fine-tuning this game.
Is there going to be an open beta, like Wube did with Factorio?
That would be awesome.

Keep it real,
Hanson

Rich said...

Thanks so much Hanson!

The answer is, yes, very much so! One of the reasons we have spent a lot of time fine tuning this game is that the modding tools we have developed are quite extensive and we want to give the community and folks like yourself who have supported us early the chance to help us improve them (and the game as a whole) and contribute user generated content or ideas ahead of release.

I'm not particularly familiar with how Factorio went about their open beta, was there anything specific to Wube's approach that you really liked or you think we should consider trying to replicate?

Cheers!

Rich.