Week 5

Week 5

I’m missing an important feature to add to my game: the ability to easily add objects and create the code for their interactions.

Week 5 Image 1

The idea was as follows: I want to dynamically add Events to my interactive GameObjects using reflection. I simply build a string with the object’s name followed by the type of action.

I create an InGameEvent partial class, so I can make a copy for each interaction. Essentially, a large part of the gameplay will be contained in this class. And, thanks to ChatGPT, I learned that the [Preserve] attribute tells the compiler to keep methods in the generated MSIL (Intermediate Language) even if no code directly references them—which is my case, since I retrieve a method by its name as a string and call it via Invoke().

Week 5 Image 2
InGameEvent
[Preserve]
Invoke()

I’ll then spend a few days adding events for various objects, as well as writing a bit of code for:

  • a highlight system for dialogues
  • a class to manage graphics options through the volume settings
  • implementation of multi-language support
  • modification of the dialogue event callback so it can run either at the beginning or the end of a dialogue line
Week 5 Image 3

Finally, I’ll revisit the grass rendering, and after some research, I find a solution that is both prettier and more efficient.

And I’ll add the logo, to have a slightly more presentable build.

Week 5 Image 4

← Back to DevLog