Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 02:11 Edited at: 7th Jun 2003 05:21
Hey Guys,

Sorry I'll being asking a bunch o' questions and I might become a pain soon but I just got onto the forums and hav TONS o' questions

Anyways, I am making an FPS, and am wondering if you could have a way for the player to save their game?

I have pondered this and have came up with no solution

Anyone have ideas???

Does it have to do with this Read/Write Float Command I keep hearin' 'bout?
Mattman

Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
---Andy Rooney
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 7th Jun 2003 05:29
Well in a matter of fact, saving is quite easy First of all, you have all your variables such as.....

CurrentHealth#
CurrentAmmo#

And all that good stuff. Now, to save, alls you have to do is first check if it the filename exists, If it exists, DELETE IT, then make the file, open to write, and then write all your variables to that file. Remember, if you try to write to a file that already exists, you will get an error!

To load you simply open to read that file, and then you can use all the variables in the file in your game.

Cheers,

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 05:36
Thanks a TON RPGamer!!! Hey if you see this could you answer my question on Floats in Newcomer's section while you are at it?
Thanks!
Mattman

Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
---Andy Rooney
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 16:24 Edited at: 7th Jun 2003 16:29
Hey,
I got what you were sayin', but I came across a new question
were do I save them? Should I make a folder within my game folder? If so, how would I open/write in it? Would I go:

plz help

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 7th Jun 2003 17:39
maybe saving would also be possible by saving everything in the memory and then loading it again
when you have many variables it could be too complicated, and this could be a method thats possible for every game
(in fact I was wondering today how the built-in save function of an emulator worked (there you can load multiple games and the save function is just a part of the emulator), so I think in such emulators they just save and load the memory contents)

[href]www.bernardfrancois.com[/href]
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 7th Jun 2003 19:07
when i do saves i put all the variables into an array and then use the save array command, it works fine for me

ARE YOU A 3D MODELER??? IF SO WE NEED YOU!!!
EMAIL [email protected] to work on the new Star Strike project!!!
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 21:21
What is an emulater?

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 22:06
How would you save your arrays? Is there a way 2 delete your array, then save? I still have the same 2 questions:
1 Where should I save to?
2 What is an emulater?
plz help!!!

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 7th Jun 2003 22:20
an emulator is just a program in which you can load old games ripped from those cartridges
in some emulators you have a save function... but they don't know the variables used in the games so I think they just save and load the memory

that about emulators was just to explain why I think that it has to be possible to use such a technique, but how ... I dont know

how to save an array?
SAVE ARRAY filename
how to load?
LOAD ARRAY filename

(note that you first have to put your variables in that array when saving, and when you load you have to restore your variables after loading the array)

[href]www.bernardfrancois.com[/href]
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 22:44 Edited at: 7th Jun 2003 22:45
k, but same question WHERE 2 SAVE!!!

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 7th Jun 2003 23:29
when you press the save button?

[href]www.bernardfrancois.com[/href]
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 23:41
Yeah
I want to have it so all they have to do is press a button to save, and then somthin' will pop-up sayin' "name file" and that will name the file the array will be filed in.

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 8th Jun 2003 19:04
ok, good luck

[href]www.bernardfrancois.com[/href]
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 8th Jun 2003 20:16 Edited at: 23rd Oct 2003 00:48
Big help u r, Freak!

Got a knack for finding secrets??? Jingot Racing --- A new brand of Racing --- Only from Nightwatch Studios
"hey, it's tomorrow" --- Hamish
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 8th Jun 2003 20:18 Edited at: 8th Jun 2003 20:19
I think I have the saving part down:



Somthin' like that. But SAME QUESTION! (u all know it by now )

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
MiRRoRMaN
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: Netherlands
Posted: 8th Jun 2003 20:22
Saving yes, loan no. Okay just kidding. damn that joke sucked.... hehehehe

www.mirrorman.cjb.net, the classic Commodore 64 and Amiga site.
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 8th Jun 2003 20:24 Edited at: 8th Jun 2003 20:25
Quote: "Saving yes, loan no. Okay just kidding. damn that joke sucked.... hehehehe
"

Huh???

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 9th Jun 2003 00:59
The file makes itself in the directory with the code. Works good enough I guess

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!
xmen
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 9th Jun 2003 01:15
look do it like this

score=100
live=5
posx#=100.0
posy#=0.0
posz#=300.0

add aynmore verables you have in your game
filename$="c:\file name.dat"

........save file...........
open to write 1,filename$

write byte 1,score
write byte 1,live
write float 1,posx#
write float 1,posy#
write float 1,posz#

close file 1


........load file...........

open to read 1,filename$

read byte 1,score
read byte 1,live
read float 1,posx#
read float 1,posy#
read float 1,posz#

close file 1


hope it help
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 9th Jun 2003 02:43
lol sorry I was just joking
has nothing to do with communism

I just tried to get you try to find it yourself, it's just all in the help, you knew you could use the load/save array commands

anyway its no problem helping someone! i'm sorry...

[href]www.bernardfrancois.com[/href]
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 9th Jun 2003 05:49 Edited at: 9th Jun 2003 05:50
just kidin' Freak, you've been a great help
thx all!

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 9th Jun 2003 06:02
How can I have 'em name the file???

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 9th Jun 2003 12:31
there are multiple ways to do this

an easy way: you could use the imput command, which saves the user input in a variable

then you can add the file extension to that variable like this:
variable$=variable$+".sav" or something like that

and then you can use save array array,variable$

just check the help about the imput and the save/load array commands

you can also try to make your own imput function, coz the imput command coming with DB is quite limitated
to do this you'll need a variable, and each time the user types a character, this has to be added to your variable
something like this: input$+inkey()
but you have to make that this only happens once, until the key is released and another one is pressed (otherwise you'll have many repeated characters)

[href]www.bernardfrancois.com[/href]
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 9th Jun 2003 12:34
(BTW, it's "input." Normally I wouldn't have mentioned this, but I don't want him to misspell the DB command and then get an error. )

freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 9th Jun 2003 12:36
oh I see
it's no problem you mentioned it

[href]www.bernardfrancois.com[/href]
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 9th Jun 2003 20:16
I know imput commands, I made some programs using just input with the demo and was very proud of myself (Now I know they are pieces of junk !!!) I want to do it xmen's way, so should i do:



That's just an idea.
thx all, you've been great!!!

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
LREM 8888
22
Years of Service
User Offline
Joined: 15th Mar 2003
Location: United Kingdom
Posted: 9th Jun 2003 23:03
What folder you going to save it in? It would seem obvious to use c:\Program Foils\, but some people don't have Windows (and so Program Foils -- I mean files of course ) on the C drive, and anyway, Microsoft have already moved My Documents from c:\my documents to C:\documents and settings\blahdeblah -- How long 'til they move Program foils??? (I dunno about you but I use my own folder, for example, c:\end of the world_alpha0001\save\)

An orange can't be a tomato but a tomato can be orange...
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 10th Jun 2003 00:48
Best to use relative paths instead of absolutes.

freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 10th Jun 2003 03:16
most games have a 'saves' directory direct under the main game directory... like that it's easy when people want to keep their save games when they uninstall your game

[href]www.bernardfrancois.com[/href]

Login to post a reply

Server time is: 2025-05-18 22:09:09
Your offset time is: 2025-05-18 22:09:09