I’m thinking about making a visual novel game and I would like to have some advice on which way to go. I plan to write all of my dialogs using my own version of Inkle’s ink language and I would like to write my own ink files parser. I know that some people are already working on this and that there are other ways to write dialogs using other languages but I’d really like to make it from sractch so that I can learn how to parse files the correct way
My first question is: are there any good ressources on parsing files using C++ and UE4 that could help me kickstart my development? I’ve searched on the internet and I am currently working on some of the tutorials found on youtube.
My second question (the important one imo) is that I’m searching for a way to parse files offline and put them directly into some sort of data class instead of parsing them at runtime and filing some arrays with all of the dialogs that I need to show.
1)Try checking existing pasers in the engine like JSON:
or CSV (probably most simple one):
In general you should use FArchive as it lets read data from different sources (not only files) directly instead of copying everything in to memory as FString and parse it
2)Just turn them in to assets. Assets in UE4 are just saved UObjects objects, so all you need to do is just place any data in to UPROPERTY() varbales of asset class and save the asset. You can also creating custom serialization of your asset by overriding Serialize function in UObject. Not to mention with UFactory class (which manages creation of asset and you will need to make it anyway) you can implement import of ink files directly in to UE4 to your asset
But in order to do that you need to make asset type by creating UFactory and registering asset actions first. iI think this is best tutorial that i know and it also shows how to support file import (ofcorse it will just give you file to process, you will still need to parse the file and place data in to asset object yourself):
That’s awesome! I didn’t know that the engine already had a json parser implemented in it. Thanks a lot that will help me a lot