Godot Version
v4.5.1.stable.official [f62fdbde1] Linux
Question
Hi,
Can someone explain the best method to load an English dictionary from 26 letter files?
We want to port our old game “LettersFall” which was made with a bad engine to Godot v4.5.1.
Just the loading of each letter file into I guess a single 2-Dimensional array.
Let us know, thanks!
Game will be for Web and Linux(Flatpak on Flathub)
Post the file structure.
Why into 2 dimensional array?
Hi,
File structure is just a standard txt file for each of the 26 letters in alphabetical order.
Each line of the txt files contains one word.
Dictionary 2-D array would be arranged like: [0-25][Words]
Also the dictionary from the original game should be updated.
Can you recommend a free English dictionary to us?
Thanks!
NOTE: purpose of having 26 letter files is to optimize the constant dictionary checking when playing.
Open the file and use FileAccess::get_line() until you reach the end of the file. Push lines into an array as you read the from the file.
Repeat for every file and you’re done.
Hi,
Thanks, but how to detect end of the letter file?
FileAccess::eof_reached()
Look at the reference for FileAccess class to see what you can do with it and how. It supports a wide range of common file i/o functions.
OK, thank you for your help!
1 Like