Public Group

This topic is 4925 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to make a player contract negotiation procedure for a football (soccer) management simulation game. This is a little difficult for me to describe, but what I'm looing to make is a program that has the capacity to memorize what's happened previously primarily so, managers can't renogotiate deals from scratch once again from the beginning, if a deal breaks down and the player wants to leave. Using Visual Basic 6, is there a way I can do this, even so if the program is turned off, when it loads again ,it still has the memory know that the deal was previously broken down. It's a little hard to explain, I hope you understand. I was thinking of having a value automatically come up to show dis-interest on the players part, automatically and then for the application to autosave straight away, but I don't know. I hope you understand what I mean, I hope you can help.

##### Share on other sites
The idea is quite common for simulations, games, and commercial apps: Data Driven Design. The idea is this, all of the information that is customizable should be loaded from a file so you can work with different settings and stuff on demand. For you and VB, what you will want to do is have a save file that you save all the data to, then you can reload it again at runtime to keep on working.

Essentially you are looking for Save/Load routines for your simulation. Of course there are going to be little problems here and there with a design such as that. For example, you just can't have a seperate Save.dat file lying around because what if someone were to save it off to the side, try something, then copy over the new save file with the old one and be able to 'cheat' like that? Then the fact of people would be able to try and decode the file and edit it is another problem.

So starting out, what you will want to do is take a look at File IO in VB to get something very simple up and running. Remember to start simple, just have it so it saves everything to the file, then is able to reload in on program start again. Then slowly you can start customizing it to your needs. So for a quick example:

Let's say you have some deal data structure that tells about the deal. Let's say you have the format as:

Deal Name:
Money:
Result:

Then you will have an array of those deals in your program. First make it so at the program close, it loops though all those deals and saves the info to a file, so for one example it would be like:

Test Deal 1
Jose Cruz
Raul Lopez
2500
Failed

That would represent one deal that happened and from the status you can see it failed. Next step is to make your program able to load that data when it starts up, so you can see that it has failed, and you can not try that deal again.

Now you will have to think of a few extra things as well. For example, you do not simply want to store ALL the data in memory! Otherwise, your program will just use too much resouces. Instead, what you can do is have it so ebfore you try a deal, you simply load the deal file and process that data first and see if you can do the deal. If so, then you go on, and if not, then you can't do the deal. After a deal, you should immediately auto-save.

Earlier I had said in the program you can view the deals that have happened. For that, what you can do is have it use the same principle, load the file, and display all the deal names and information at request, then clear it all out when you are done.

The main goal for you is to use the files as your memory so you do not overload the users memory with too much data. Does that give you a better idea?

##### Share on other sites
I understand a lot better now. It's inevitable that someone will be able to save the old files and then delete the new ones if they don't like a result, but if I don't make the individual contract status file names obvious, it'll probably put them off and they'll give up...

So a saved file for every contract negotiation seems to be what you're saying and I can't think of a better idea.

Thanks.

##### Share on other sites
I understand a lot better now. It's inevitable that someone will be able to save the old files and then delete the new ones if they don't like a result, but if I don't make the individual contract status file names obvious, it'll probably put them off and they'll give up...

So a saved file for every contract negotiation seems to be what you're saying and I can't think of a better idea.

Thanks.

##### Share on other sites
Quote:
 Original post by ClottySo a saved file for every contract negotiation seems to be what you're saying and I can't think of a better idea.

Ohh that might get a little too messy. What I mean is one file that stores everything. Of course that will require some planning on how you will read it in and write it out, but it can be done. You could take a look into using something like XML to have a distinct document structure, such as:
<Soccer>   <Teams>      <Team Name="Superstars" Players="25" Salary="400000" />      <Team Name="Titans" Players="17" Salary="25000" />   </Teams>   <Deals>      <Failed>         <Deal Name="Trade1" TradePlayers="abc" ReceivePlayers="ghj" Money="1200" />         <Deal Name="Trade2" TradePlayers="def" ReceivePlayers="qwe" Money="2500" />      </Failed>      <Success>         <Deal Name="Trade3" TradePlayers="a1bc" ReceivePlayers="g7hj" Money="12000" />         <Deal Name="Trade4" TradePlayers="de4f" ReceivePlayers="qw6e" Money="222500" />      </Success>   </Deals>   ... ETC ...</Soccer>

That way you could use something like tiny XML and read in the data and have it all there. Now the trick would be to somehow convert all that to a binary data format so the end user cannot mess with it and it is very effecient. Just some more ideas. I think you just need to get a good format to store everything in, then use that and improve upon it.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633661
• Total Posts
3013220
×