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.

Newcomers DBPro Corner / I have a Question about saving games....

Author
Message
Skyone
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location: United States
Posted: 17th Jan 2003 04:45
I am making a game that needs to save. I don't know what file format to use, or even how to. Please someone help!
Code of the Week: Moving an object back.
If Downkey()=1 then Move object x,-10
x=Object Number
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Jan 2003 05:55
how many variables do u want to save.

what form are they currently in.

once u can identify what u want to save write them down on this post.

eg psuedo variables

player name
player x
player y
player z
player hps
player experience
player quests completed


then once u have identified the players required variables u have to look at your gameworld

game start time
up time

lets say u have 10 cubes in your map that are affected by the player

so these cubes will have two states either not affected and affected.

lets use affected as a variable name and a 1 indicates that the player has touched them

lets say also the player touced the first 3

u will have to record this into your saved game file.


dim affected(10) : rem its actually 11 spaces but we make it easy

for i = 1 to 10
if i <4 then i = 1
if i >3 then i = 0
next i

something to this effect shows u how to set it back up
as after u have saved your file u have to consider either
re loading all the objects and repostioning them via the data read back in.




examples:

if they are arrays u can use the save array command
if its lots of numbers in variables u could save them in a textfile thats readable or not via notepad.

You will make your own file formats and ways of doing things to suit your game and prevent changes from users if u want or not.



look at these commands help files and look around for a few snippets

if file exist()
open to write
open to read
read string
read long
write string
write long
save array
close file

theres a few more but u will get it


indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Jan 2003 05:56
eheh oops


dim affected(10) : rem its actually 11 spaces but we make it easy

for i = 1 to 10
if i <4 then r = 1
if i >3 then r = 0
affected(i)= r
next i

Login to post a reply

Server time is: 2024-05-17 09:08:51
Your offset time is: 2024-05-17 09:08:51