0

The purpose, game programming, as you may have guessed, why else right? How is it actually possible to read in values from a text file, so that those values can be then on wards used in the game? I have searched for hours on this topic.

example: each text file line token, will be read and passed as the different arguments into the constructor of each object during its instantiation via for loop. A common practice. Its Too expensive to store that much data at any given time in an array I would suspect.

In java this is dead simple using the Scanner object.

Any suggestions are appreciated thanks. I guess all I am asking is, is it even possible?

S_BISHOP
  • 31
  • 6
  • This could be useful: http://stackoverflow.com/questions/371875/local-file-access-with-javascript – rubentd Apr 25 '16 at 15:13
  • If you cant store that much data at any given time in an array i doubt the instantiated objects will take less memory. – Roland Starke Apr 25 '16 at 15:24

1 Answers1

0

As Roland Starke said, the array will probably take up less memory than the objects you construct from it... So it is perfectly fine to have all the information in a JSON file for instance, which you load from your server.

If you want to avoid transfering all the data every time, you would need to use the right caching headers so that the data can be cached by the browser.

Community
  • 1
  • 1
CherryDT
  • 25,571
  • 5
  • 49
  • 74