AticAtac Posted September 2, 2017 Share Posted September 2, 2017 This question might sound a bit naive (i am new to web programming), but how do you guys load game specific files using typescript? E.g. i would like to load a textfile line by line and process it. Where does my file need to be located? In a game, there might be many many custom files which need to be loaded. Any examples are welcome Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted September 3, 2017 Share Posted September 3, 2017 Google how to parse a textfile with typescript Quote Link to comment Share on other sites More sharing options...
AticAtac Posted September 3, 2017 Author Share Posted September 3, 2017 Thanks. Just for clarification, are the game files (text files, data, etc.) treated to be local or serverside? Let's say i got some AI-data in a text file and want to read and process it in my game using babylon.js, How would i do this in my game code (especially in typescript)? Most tutorials i found on web (google "parse with typescript ...") seems to require to pick the file with a selector. The other ones deal with javascript and loading files with ajax. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 3, 2017 Share Posted September 3, 2017 You could just use the framework. BABYLON.Tools.LoadFile could be used when all you have is a Url (file:// for explicit local files, or just relative path for local or web). I use it in the utility page to build a custom framework. I am actually using a select in lines 34-36 to pick the url. I am reading a javascript file, but hey thats a text file. Use string split() to process it line in line chunks once it in memory. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.