Good morning everyone.
Right now there are 33 ships in my ship editor's list. And to make it readable, I had to save my designs with names like "200 Grenade Beetle", "200 Cannon Stinger", "1000 Firethrower Ann's Doom". Mewaning 1) cost 2) main weapon 3) name. It looks rediculous especially in multiplayer.
So I decided, what a simple and awesome idea it is to make the list sortable? Right now it is always sorted by name, while in MP it is usually better to have the list sorted by cost. Also it is nice to have an option to sort it by date of creation/editing to find last designs faster.
It would also be cool to have a filter like what weapons were used. Click on a small button with a small cannon image and only designs that include cannons are displayed. ta-da!
All changes will require the change of layout in design files, now they would have to include attributes at the beginning of the file. For compatibility reasons it would be nice to include the version of a game (or the editor?) in to the file wich would change the way the editor reads the file (or says the file is a way too old).
As and extra option it will be later possible to convert the files when new version of a game is out (if you include enough info). Cool, don't you think?)))
Meow?) Not worthy of an answer?
Totally worthy of an answer, I've just been, uh, really busy and then mostly crashing post-release!
Being able to sort the list by date and cost at a minimum definitely needs to go in. :) Filtering it by more complex attributes is also possible, though there will be a bit of a delay as the game loads in the ships. The same delay you can already see when it takes a moment for their prices to come up.
yes, I saw it... How does it calculate the price?
Wait, you can count all parts of a ship splited by spaces (beforehand, in the editor, while saving). It will take 100-500 more bits (so much, yea), but the delay will be minimised and all the sorting is easily implementable!
What I mean is to add some code at the beginning of the file like "1 20 0 10 4 ..." wich will mean that the ship has 1 cannon, 20 woden armour, 0 heavy cannons, 10 steel wall, 4 rifles etc. And if the games knows what is where, all the calculation should take about half of a second for all the ships! Well.. may be not in java, but I think u get me ^_^
I did smth like that in assembler, I don't suppose it is not possible in java =P
It calculates the price by loading in and parsing the ship info, which is why it's so slow, basically. :) Since the price can change on the basis of what bonuses you have enabled, this is the cleanest way of doing it.
I could introduce a header area to the files, but I don't like the lack of backwards compatibility and extra complexity. Plus, the game already caches everything, so at worst you have to wait for a few seconds once.
Unfortunately, I think he can't do that with json file format... With binary files you can access some part of the file directly as you suggested but with these modern formats, accessing a file often means you need to load it completely to store values in variables...
If I understand, when the list first appears, each file is fully read and by adding cost of each module successively for each ship, the program make the calculation for ship prices (+ positionning modules and other stuffs)...
It can become really funny for people who have 200+ capital ships ! Adding a filter and sorting the list by weapon, prize or name could become a real loading nighmare...
But, i'm agree with Musickiller, a sorting option is definitively a real good idea. Even only for costs, i'll take it ! ^^
EDIT : Whhoops Zarkonnen replied first !
EDIT 2 : List of ships can be loaded before the main menu, no ?
too complex? ok... as you say.
@rage not an option. Prices change. Or...
@Zark What is being cached? cand you store the header separately, make it just a temporary object? May be even in RAM? No.. don't touch the RAM.. I have 1GB.. Don't.
Well... If you make it a temporary object, created at the game start (may be even at the start menu, in the background, to save time), updated whenever the ship is changed... That should do the trick!
Why the trouble? Because prices change often in singleplayer. And in multiplayer it seemed to load prices every time you start the match o_O So let it calculate the price more often, but add some temporary info to make it fast.
What do you think?
P.S. Sorry if my text is hard to read/understand, I just woke up...