VSTrade: 0.3.0.0 (3 july 2008)

A forum for the discussion and development of programs to assist working on or playing with the Vegastrike engine and data sets.
Post Reply
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Depends on how fast you need those lookups the code scans an array in memory not the file itself so there is only one load and read of the file and the need for the EOF markers.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
drinkypoo
Hunter
Hunter
Posts: 81
Joined: Thu Oct 11, 2007 6:19 pm
Location: Kelseyville, CA, USA
Contact:

Post by drinkypoo »

loki1950 wrote:Depends on how fast you need those lookups the code scans an array in memory not the file itself so there is only one load and read of the file and the need for the EOF markers.

Enjoy the Choice :)
In that case, doesn't it make more sense to just add the markers onto the end of the data in memory instead of having them in the file?

I never imagined that the data would be read from the file every time, even if the file stayed perpetually cached the overhead would be enormous.

But I am getting DUMMYSENTINELS cargo so obviously the marker-in-the-CSV-file strategy is not all that good... Or at lest not well-implemented.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

But I am getting DUMMYSENTINELS cargo so obviously the marker-in-the-CSV-file strategy is not all that good... Or at lest not well-implemented.
then that's a bug and more than likely data side in one of the python functions

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
drinkypoo
Hunter
Hunter
Posts: 81
Joined: Thu Oct 11, 2007 6:19 pm
Location: Kelseyville, CA, USA
Contact:

Post by drinkypoo »

loki1950 wrote:
But I am getting DUMMYSENTINELS cargo so obviously the marker-in-the-CSV-file strategy is not all that good... Or at lest not well-implemented.
then that's a bug and more than likely data side in one of the python functions

Enjoy the Choice :)
nice, maybe I have some hope of finding it then. Do you think it is likely as simple as that the relevant records are not filtered when they are selected? :)
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

Here is the next alpha, that fix some bugs and include merchant ships (ship were cargo can't be bought is still not included)

Download: VSTrade: 0.2.0.5 ~900KB (jar and source)

Here is the change log, since 0.2.0.4b:

New Features:
-Merchant Ships are now included (Please test and comment)
-Moved to the javacsv library (Fixing a bug and decreasing load time)
-Added translation: "Keys", shows the translation keys in the GUI
-Bug: Volume was always set to 1

Known Issues:
-Splash screen can't be translated (Won't fix)
-Danish translation is incomplete
-Vegamap: System combobox key presses activates vegamap key controls

ToDo:
-Control keys editor
-Cargo: max price, min price, best buy base, best sell base
-Mods Compatibility
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
negative0017
Star Pilot
Star Pilot
Posts: 7
Joined: Sat May 03, 2008 11:08 pm

Post by negative0017 »

Hi... I Seem to be missing something... when i choose the path to vegastrike in the settings i get it in there. then i quit the application and load it back up.. it gets to the end of the loading bar with external modules(i think) and then it just closes. the main window frame doesnt even come up... is there a fix for this or what? i have the latest Java, Windows XP and VS 0.5.0
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Any chance you could find the "Java Console" program that should have come with your java installation, and post the error logs?

Also, if it worked the first time around, you might be able to delete the home folder the program created so it can start up clean.

The source code looks for configuration files in System.getProperty("user.dir")+java.io.File.separator+"vstrade_settings.xml";
I'm not exactly what java thinks the "user.dir" is, but it's one of Java's things that isn't clearly defined.
"On some systems you can read a system property called 'user.dir' to get the path that the application was started in. This property is system dependent as to what it means or whether it exists at all."
I don't think it could have been hard for java to make that a standardized function that calls "getcwd", or at least document what it is.

Anyway, enough Java bashing--the vstrade_settings.xml should be inside of the folder you ran the application from, or inside the data folder, or inside of C:\Documents and Settings\username
Mets
Mercenary
Mercenary
Posts: 115
Joined: Tue Jun 10, 2008 12:52 am

Post by Mets »

The app looks really cool, but I can't seem to get it to load my game data.

I downloaded the latest from SVN to C:\Games\VegaStrike. In that folder I have the win32 directory and this application. In win32 I have a data directory and a bin directory. Vegastrike.exe lives in the bin directory.

I've tried every combination of the above paths, and it doesn't load a thing. What am I doing wrong?

Also, sometimes it starts to load and then just stops and closes. Not sure if that has something to do with it.
drinkypoo
Hunter
Hunter
Posts: 81
Joined: Thu Oct 11, 2007 6:19 pm
Location: Kelseyville, CA, USA
Contact:

Post by drinkypoo »

Here's the command line I used to use to start the program:

java -jar /opt/vegamap-0.1.1/vegamap.jar -f /usr/share/games/vegastrike/universe/milky_way.xml

I assume I had the data installed/symlinked to there.

I just downloaded 0.2.0.5 and ran it and was able to specify my data dir as the vstrade dir though.

Try setting the path to "C:\Games\VegaStrike\Win32\data", or whatever your data dir is called. If you can't launch the program, your Java is most likely FUBAR. Personally, I'm having problems with the jump lines being drawn on the vegamap. I'm getting this output in the console:

:: java.awt.AlphaComposite@b0800003

Everything else seems to work great in 0.2.0.5, except for cargo pictures (as if I cared.) Honestly, vegamap is SUPER SLOW in the java compared to the original version... I was testing for GoldenGnu before but as you can see I disappeared (real life reared its ugly head.) I'm playing the game again now, though.
Mets
Mercenary
Mercenary
Posts: 115
Joined: Tue Jun 10, 2008 12:52 am

Post by Mets »

Ok, the program launches fine unless you specified the wrong path in settings. In that case, it has some array index out of bound exception that gets thrown, so it fails.

When I specify the milky way file, it says the following:

Code: Select all

(Info) Starting VSTrade 0.2.0.0
(Info) Using default settings (vstrade_settings.xml - NOT FOUND)
(Info) Readme loaded (readme.txt)
(Info) Moduls loaded (GUI)
(Warning) No cargo loaded (master_part_list.csv - NOT FOUND)
(Warning) No bases loaded (units.csv - NOT FOUND)
(Warning) No galaxy loaded (milky_way.xml - NOT FOUND)
Exception in thread "Thread-3" java.lang.IllegalArgumentException: setSelectedIn
dex: 0 out of bounds
        at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
        at vstrade.moduls.map.MapView.enabled(MapView.java:233)
        at vstrade.moduls.map.MapView.setData(MapView.java:213)
        at vstrade.Program.settingsUpdated(Program.java:170)
        at vstrade.io.DataCreater.run(DataCreater.java:57)
drinkypoo
Hunter
Hunter
Posts: 81
Joined: Thu Oct 11, 2007 6:19 pm
Location: Kelseyville, CA, USA
Contact:

Post by drinkypoo »

Could you try version 0.2.0.5? It works for me. I haven't tried 0.2.0.0 with svn (and am unlikely to... I'm on a modem) :(
huginn
Merchant
Merchant
Posts: 58
Joined: Sun Jun 15, 2008 9:58 pm
Location: Germany

Post by huginn »

Had a similar problem on the linux console, here the program output:

Code: Select all

(Info) Starting VSTrade 0.2.0.5
(Warning) No mods loaded (mods.xml - NOT FOUND)
(Info) Using default settings (vstrade_settings.xml - NOT FOUND)
(Info) Readme loaded (readme.txt)
(Info) Moduls loaded (GUI)
(Warning) Empty rows - no problem (master_part_list.csv)
(Info) Cargo loaded (master_part_list.csv)
(Warning) Empty rows - no problem (units.csv)
(Info) Bases loaded (units.csv)
(Info) Galaxy loaded (milky_way.xml)
Exception in thread "Thread-1" java.lang.IllegalArgumentException: setSelectedIndex: 0 out of bounds
        at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:603)
        at vstrade.moduls.map.MapView.enabled(MapView.java:291)
        at vstrade.moduls.map.MapView.setData(MapView.java:277)
        at vstrade.Program.settingsUpdated(Program.java:163)
        at vstrade.io.DataCreater.run(DataCreater.java:57)
After compiling the current source myself in Eclipse and running it there without problem, I suspected a race condition. It is. Loading the data model and the GUI are two threads, and sometimes on my old computer the GUI is displayed earlier with a still empty combo box in the map view.

Changing line 157 in vstrade/Program.java from

Code: Select all

dataCreater.start();
to

Code: Select all

dataCreater.run();
solved the problem for me, at least as a temporary workaround. The data model loader is not started as an individual thread anymore
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Welcome huginn(Andreas) hope the registration process worked properly This little patch should make for a few happy traders :D

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
huginn
Merchant
Merchant
Posts: 58
Joined: Sun Jun 15, 2008 9:58 pm
Location: Germany

Post by huginn »

I went through the tool and realized that it does not draw jump lines as the internal data structure does not hold the jump connections.

There is already code in vstrade.data.galaxy.GalaxySystem commented (get/has/addJump(s)). I'm not sure whether this is old deprecated code or new to be. The jumps could be in an own data structure (List<GalaxySystem> jumps, as almost present in the commented code), or they just could be (kind of virtual) Node-children of the current System. The latter would fit into the path syntax.

I'd add it the one way or the other but do not know whether there is a preferred way.
drinkypoo
Hunter
Hunter
Posts: 81
Joined: Thu Oct 11, 2007 6:19 pm
Location: Kelseyville, CA, USA
Contact:

Post by drinkypoo »

you might look at older versions, I believe it used to draw the lines? I could be wrong though.
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

Just a short message...

I'm still alive, and I'll look at all the problems soon (I just got back from a small trip). Please, bear with me...

I'll add a reply here, as soon as I have read and found/fixed the new bugs...

I truly thought there was no interest in VSTrade anymore... But, I'll be happy to take up the coding again...
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
drinkypoo
Hunter
Hunter
Posts: 81
Joined: Thu Oct 11, 2007 6:19 pm
Location: Kelseyville, CA, USA
Contact:

Post by drinkypoo »

Welcome back! And not just because we want bugs fixed :D
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

A little update:

Lines/jumps are not drawn on the map bug:
Found and fixed.

Race condition bug:
I could not reproduce the bug, I'll try to find a slow machine to test it...
Logical, It should work AFAIK, please correct me if I'm wrong.
It's however possible to make a workaround, that still lets the loading happen in its own thread.

Wrong paths bug:
I have started coding a new way for VSTrade to find the files in the Vega Strike directory.
Hopefully it will fix the bugs with bad paths etc.
It'll externalize the paths, so people will be able to edit the searched paths, if Vega Strike change Its file structure...

The cargo images are not shown bug:
It's a known issue, it's because the images are now in DDS format, I did work on a DDS library before I stopped coding on VSTrade... I might take it up again...


That's all for now, I'll try to release something soon, so people can use the program again.


@drinkypoo

Thanks mate! :)
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

a little update...

Race condition bug:
I would be happy if anyone who gets this bug, care to try this workaround:
(Should be used on the 0.2.0.5 source)

replacing:

Code: Select all

jSystemList.setSelectedIndex(0);
with:

Code: Select all

if (jSystemList.getItemCount() > 0) jSystemList.setSelectedIndex(0);
in: vstrade\moduls\map\MapView.java @ line: 291

That said, it's only a workaround. And I still haven't found the course of the bug... What I really need is steps to continual reproducing the bug...


Yet another update
Compatibility with Vega Strike 0.4.3 is broken in VSTrade 0.2.0.5, This is now fixed...
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
huginn
Merchant
Merchant
Posts: 58
Joined: Sun Jun 15, 2008 9:58 pm
Location: Germany

Post by huginn »

Thank you.

I tried your proposed workaround. It works.

The first ComboBox on the MapView-Module (Vegamap-Tab) sometimes shows nothing (empty field) and sometimes "Aanpzezyqqh", depending on which thread (GUI or Loader) finishes first on startup. The drop-down list contains all systems.

Which line do I have to modify so that GalaxySystem contains the jumps as child nodes again?
huginn
Merchant
Merchant
Posts: 58
Joined: Sun Jun 15, 2008 9:58 pm
Location: Germany

Post by huginn »

huginn wrote:Which line do I have to modify so that GalaxySystem contains the jumps as child nodes again?
Found it. In vstrade/data/galaxy/GalaxySystem.java had to add in add(Node)

Code: Select all

values.add(n);
at its end (below line 54).
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

I think I fixed the bugs for now...

However I'm almost sure that the Bases & Galaxy classes are not released properly when the Vega Strike path is changed and saved. So, that's one major memory leak... I never fixed any memory leaks, before, but I'll try my best to fix it ASAP. However, It'll not be in the next release...

I also want to thanks all the bug reporters. I'm happy to see that there is still interest in VSTrade, and that people care to take the time to report bugs. Thank you! :)

@huginn

You sure seems to know your way around Java. 8)

Could you please tell me how it's a race condition. The Program.load() function is not call before all the GUI is done loading. (Which you can also see from the log output)

I did fix the race condition when saving, thou...
It was possible that Program.load() got called, before DataSaver.start() finished.

I'll release my fixes very soon...
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

This is a alpha release by name and quality, however, it might be the only working version... :oops:

Download: VSTrade: 0.2.0.6 ~900KB (jar and source)

Here is the change log, since 0.2.0.5:

New Features:
-Add To Sell Base Button was not disabled, when list was synced, fixed.
-Posible fix for "race condition" bug. (Please test this)
-Missing jumplines on map bug fixed.
-0.4.3 Compatibility restored
-Externalized the file paths (now have better mods compatibility)

Known Issues:
-Splash screen can't be translated (Won't fix)
-Danish translation is incomplete
-Vegamap: System combobox key presses activates vegamap key controls
-Cargo images are not shown

ToDo:
-More mods compatibility
-Try to fix memory leaks
-test "race condition" fix
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
GoldenGnu
Bounty Hunter
Bounty Hunter
Posts: 155
Joined: Fri Jan 27, 2006 6:58 pm
Location: Denmark

Post by GoldenGnu »

@huginn

The workaround, I wrote before, is not in the latest version.

However if you still get the "race condition" bug, with the latest version.
Could you please try to change:

Code: Select all

load();
...on line 143 of Program.java

to

Code: Select all

DataCreater dataCreater = new DataCreater(this);
dataCreater.run();
If that fix the problem, it is indeed a race condition AFAIK.
Then I'll add it permanent in the program and release a new version, pronto...

The reason it load in a thread is that, otherwise it would lock the GUI when saving the settings. It's not important when it loads first time...
Image
VSTrade - A Merchants Guide to Intergalactic Trading!
0.3.0.0 Stable (3 july 2008)
huginn
Merchant
Merchant
Posts: 58
Joined: Sun Jun 15, 2008 9:58 pm
Location: Germany

Post by huginn »

GoldenGnu wrote:Could you please tell me how it's a race condition. The Program.load() function is not call before all the GUI is done loading. (Which you can also see from the log output)
I have no thorough explanation, as I do not have experience with Swing. You are right, the DataModel is loaded last. But, my guess is, that loading the GUI is not a sequential task and that Swing spawns GUI creation/preparation threads on its own, which run in parallel to the main thread. So, the main thread starts loading the DataModel while GUI prepartion is not finished.

Somehow, the window is only created, when the main thread finishes ... as I said, I don't know what's happening under the hood, but I heard that Swing relies on threads.
GoldenGnu wrote:However if you still get the "race condition" bug, with the latest version.
Could you please try to change:
I run the program in a vanilla data directory ($PWD in the following outputs) with only master_part_list.csv, units/units.csv, and universe/milky_way.xml from svn. No vstrade settings. I got the following error first:

Code: Select all

(Info) Starting VSTrade 0.2.0.6
(Warning) No paths loaded (NOT FOUND: "$PWD/files.xml")
(Info) Using default settings (NOT FOUND: "$PWD/vstrade_settings.xml")
(Info) Readme loaded
(Info) GUI loaded
Exception in thread "DataCreater" java.lang.NullPointerException
        at vstrade.data.files.Paths.getPath(Paths.java:82)
        at vstrade.data.settings.Settings.getMasterPartListPath(Settings.java:172)
        at vstrade.data.bases.Bases.<init>(Bases.java:68)
        at vstrade.io.DataCreater.run(DataCreater.java:44)
sKey is "masterpartlist", sVegaStrikePath is "", this.keys does not contain any elements.

After replacing line 82 with (I wanted to see what happens after)

Code: Select all

for (int i = 0; paths != null && i < paths.size() && !file.exists(); i++){
I encountered the race condition bug again. After trying your suggested change (rf. first quote of this post), the bug disappeared, but vstrade does not find the files and cannot initialize:

Code: Select all

(Info) Starting VSTrade 0.2.0.6
(Warning) No paths loaded (NOT FOUND: "$PWD/files.xml")
(Info) Using default settings (NOT FOUND: "$PWD/vstrade_settings.xml")
(Info) Readme loaded
(Info) GUI loaded
(Warning) No cargo loaded (NOT FOUND: "")
(Warning) No bases loaded (NOT FOUND: "")
(Warning) No galaxy loaded (NOT FOUND: "")
(Info) VSTrade closing
Hope that helps. I could not go further, as I did not explore the loading procedures so far.

Regards.
Post Reply