473,657 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save Game

134 New Member
I am trying to make a little Text-Based RPG (in the Win95 window and everything like that)
and it is oobviosly in C++.
Is there a way i could save progress in the game (such as record and load data like goldleft, questcomplete)

thanks
May 5 '07 #1
3 2485
Savage
1,764 Recognized Expert Top Contributor
I am trying to make a little Text-Based RPG (in the Win95 window and everything like that)
and it is oobviosly in C++.
Is there a way i could save progress in the game (such as record and load data like goldleft, questcomplete)

thanks
Yes.Use files
For e.g:

Now if I assume that experiance gold an all those staffs are variables in ur programm u could print that in file whne user decides to save:

quest1 start;
quest1 finished;

<Do u wanna save the current progress(Y\N)>

<Y>

quest1 start;
quest1 finished,saved, gold=,experianc e=...

And then when loading search the line that contains saved and read it in.
Later use a tokenizer to pull out values

Savage
May 5 '07 #2
lumpybanana247
134 New Member
Yes.Use files
For e.g:

Now if I assume that experiance gold an all those staffs are variables in ur programm u could print that in file whne user decides to save:

quest1 start;
quest1 finished;

<Do u wanna save the current progress(Y\N)>

<Y>

quest1 start;
quest1 finished,saved, gold=,experianc e=...

And then when loading search the line that contains saved and read it in.
Later use a tokenizer to pull out values

Savage

experiece and gold are like
Expand|Select|Wrap|Line Numbers
  1. int experieice;
  2. in gold;
  3.  
then quest 1 finished is like
Expand|Select|Wrap|Line Numbers
  1. bool quest1finished=true;
  2.  
so is it the same thing?
how do i search the line when i load?
whats a tokeniazer?

thanks
May 5 '07 #3
Savage
1,764 Recognized Expert Top Contributor
experiece and gold are like
Expand|Select|Wrap|Line Numbers
  1. int experieice;
  2. in gold;
  3.  
then quest 1 finished is like
Expand|Select|Wrap|Line Numbers
  1. bool quest1finished=true;
  2.  
so is it the same thing?
how do i search the line when i load?
whats a tokeniazer?

thanks
U will need to output first all of that data into a file.For the load take this example:

quest1:start,
quest1:finshed,
quest2:start,
quest2:finished .saved,gold=,ex p=,

Now onto how to load a file:

As u can see every line has it's format:

quest<quest no.>operator ':' <quest status> operator '.' or operator ','

Now to the tokenizer.Token izer searchs the string for the first ocurance of symbols setted as it's parametar and returns a pointer to the first character in given string adn writes '\0' character just after the token.After first call it has for parametar, instead of line,a NULL pointer.For example:

In c/c++ tokenizer is strtok();

So if have string like:

quest1:finished .saved,gold=<va lue>,exp=<value >

The string should become:

quest1
finished
saved
gold
<value>
exp
<value>


For reference on using strtok() check this out.

Savage
May 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

40
2379
by: Mark G. Meyers | last post by:
http://www.savetheinternet.com There is more info and A PETITION at moveon... Easy to sign and give your two cents (and to your own reps in the process). http://civic.moveon.org/alerts/savetheinternet.html There's a nice quick video of what this bill means to you... http://www.youtube.com/watch?v=l9jHOn0EW8U&feature=Views&page=1&t=t&f=b Didn't think it was real? We've witnessed the deregulation of mainstream
1
2879
by: fowle040 | last post by:
I underlined and bold print my files. I need to know how to make this code into a working game. The object of the game is to have two players 1- belle and 2-beast. I want them to lose and gain strength and health, when 0 die. I need to know how to make them interact. I need to know what to do with teraform (creek, pasture, brick road) how to add. I need the public interface to look like the forest. classes need to function the program...
1
2589
tpgames
by: tpgames | last post by:
I don't understand how to write a JavaScript to save the users progress in a game, so they can go back to the game at a later time. There is two games that really need this functionality, a php jigsaw puzzle, and a role playing puzzler game combining image maps and several games (written by others) that are held together by a common story line and goal, and probably won't be in frames. (No link available yet, as I'm still working on it.) The...
6
3909
by: lumpybanana247 | last post by:
im making a text-based rpg in c++. is there a way i can make it so you can save your game and pick up where you left off?
3
1536
by: I Hate My Computer | last post by:
Hi, I was wanting to make a game with the ability to save the level and the score. I would also like it to be able to load that saved game. Lastly I would like it to be able to save a high score list and display it later. If you can help I need this before 5/28/07. Thanks Quick help is greatly appreciated!
1
1238
by: Rhm3769 | last post by:
new to this, been looking around and haven't found anything for it yet.... I'm trying to write a script to help out tournament organizers for this online Risk site.... what I'm trying to do is make a script that saves the webpages for specific games and then scans the game log for information they want.... the scanning of the game log will be easy, the only thing I'm confused about it saving the page or the source if having a script save a...
4
3652
by: powerovergames | last post by:
I wrote a simple gambling game using java, and I wish to let the user to save their record(i.e # of rounds played, points gained per round) so after quitting they game, they could keep on playing intead of starting all over again. Then this game could be more addictive. Can any one tell me how to do that? Also can you tell me how to run a .class file without running Jcreator?
5
7355
by: pankajs | last post by:
Hello frnds! I hve written a game in java & it is completed except saving & loading, ca anybody tell me how can i save a game status in a file ?????
1
1930
by: Pankhuri | last post by:
Hello I am making a game in python, using PyGTK and not glade or PyGame. I wanted to know how can i save a currently opened game and also open an already saved game. Thank you for the help.
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8837
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.