Building a small game for fun?
-
Using Java btw What is the best way to store data about the items in the game and what is the best way to retrieve it. For example creating a level using objects like land tiles. Currently my ineffective method is saving the url for the picture of the object and properties in a text file. Would it be better to use a database? If so a good example would be appreciated.
-
Answer:
It depends somewhat on the language you are using, and the libraries/frameworks you can utilize. For instance, in Java, I might suggest using serialization, with the caveat that you might need to take care of changes in your objects between versions. Even though XML is often over-prescribed, using an XML file might not be a bad idea either. A "database" might be a little heavyweight for this, however there are some lightweight embedded databases that might be useful (SQL light and sleepycat/BDB come to mind). A plain text-file has the disadvantage that it is easier to "hack", although no save file is hack-proof, as devoted hackers can reverse engineer your game. Also, if you're on Windows, and the amount of data is small, it might be worth storing it in the registry.
Tim at Yahoo! Answers Visit the source
Other answers
A text file containing what each tile is. Use a 2D ArrayList of a Tile class or something to hold the data. This is just for fun, so...
Related Q & A:
- If we end up building a base on moon, what do you think will be a, if any, beneficial side effect for mankind?Best solution by Yahoo! Answers
- What is a good way to advertise enexpensively for a small business? It is handyman work?Best solution by Yahoo! Answers
- Where can I find a small end 4 pin fire wire and a 5 pin mini usb 2.0 cable that connects a external harddrive?Best solution by Yahoo! Answers
- Building a custom sub enclosure?Best solution by wikihow.com
- Are they still going to be building a Bass Pro Shop in Bakersfield, CA?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.