Sequential file question
Currently in the final three weeks of this semester and stressed to a level that is unheard of right now. The final piece is to make a game all in C++, I have an idea and I am trying to figure out how to do it.
I want to make a map whether randomly or actually coming up with the layout and have it save to a txt file. For example I want to make a 5x5 map have it print out on the screen, and be saved in the txt file. Then be able to recall that map whenever I want. Such as a town map. My question is, how do you create a map in the txt file(in notepad) from scratch, then with the program call that map up, save any progress made on it. Then when you load the game later start from that point and everything there be saved? I understand the writing, and reading parts of fstream but I am not sure how to write something in notepad and have it created.
Also I am trying to figure this out for character stats. I have looked around but have not found any tutorials in how to do this as a guideline in how to do it.
One way would be to save on a basis of 2D (or 3D) points. Certain sets of points could refer to a line, or polyline, or an arc or curve, or meshes of filled triangles. This is how DXF files are saved if you have ever worked with any CAD type packages.
Or, you could have a point and vector combination.
A point can easily be saved as (x,y) or (x,y,z) in text format. Vectors can be represented via [x,y,z] format.
I'm only doing 2 dimensional arrays for the maps. I'm not touching upon 3d stuff yet.
Overall idea for this is just a 'game' that is like an old monster rancher game. Except that you can move around on the maps. The theory is that it is very simple. The problem I have is the txt file.
Like I want to have for example stats such as:
That type format for the monsters, and it all be stored in the txt file. Would I be able to have it say something like Monster 1 and using a for loop I can build the monster list by calling up the stats and it would then print the stats I listed above with the name, race and stats Like this:
Name: White Dragon
Just call up Monster 1 or the name of the monster from the txt file and print it up using the cout
I'm just trying to figure out If you write all the information you want in the txt file exactly how you want for the stats if it would print out those stats. (this probably is the easiest part is stats)
The map however to me poses the bigger problem, How do you "write" the map in the txt file and then pull it up on screen, or generate it in the program save it in the txt file and go on from there.
The way you ask that question "How do you "write" the map in the txt file" suggests you believe there is an answer. You write the map in the txt file however you want to do it. How are you storing the map, and what is it going to be easy for you to write out and what will you need in order to be able to easily reconstruct the map as it gets read in? Whatever that is, that's what you put in the file.