Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently posted a question about this, but was not really sure where to go. I've gotten some progress, and have generated some simple noise here:

That works well enough for me, but I would really like to be able to save the points into an ascii text file. currently it's formatted so that something like this:





would create a square. I need to save in this format with the points(and lines connecting them) generated in the method above.

Essentially, I need to write the array of points created in the first example to a text file formatted like the second example. EDIT: I ended up using serialization. This method makes it un-editable, but works for my purposes, I can really have good terrain generation now. here's my code: Everything is working excellently. Thanks to all those who helped

share|improve this question
Your question, if I'm interpreting it correctly, is: "how do I write a text file from Java?" Is that correct? – Trevor Powell Nov 21 '12 at 4:20
No, not exactly. I need to write an array of points into a text file in the format used in my example. Edited for clarity. – Dylan Katz Nov 21 '12 at 4:28
How do your points look like then? I mean, do you have Java classes for them? Maybe a bit code would help. – Markus Nov 21 '12 at 7:47
What do you mean? I put the code in the post. The class "Point" is built in to java. – Dylan Katz Nov 21 '12 at 20:50
Ok, I have it properly generated, thanks :) – Dylan Katz Nov 22 '12 at 19:37
up vote 3 down vote accepted

You could consider Serialization


  1. Hides your values
  2. Easier to save/load


  1. Values can not be modified in text editor.
share|improve this answer
Did that, worked excellently! Thank you so much! – Dylan Katz Nov 23 '12 at 18:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.