Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Bar » ActiveX object model for Stars files
ActiveX object model for Stars files Fri, 08 February 2008 19:02 Go to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
I've had a request to make a uility that allowed editing minerals on planets, rather than making something specifically for him I've written an ActiveX object that allows editing certain properties of planets as shown below inside a .vbs script.

I am intending to make the object available to anybody who wishes to use it since it would be useful for custom games and access to the .hst file is required to be able to effect a game or see anything you shouldn't be seeing. Before doing so however I would like to see if anybody foresees any problems in doing so that I have not thought of.

Available Properties
PlanetID - Readonly
OwnerID - Any changes are currently ignored, intend to have it working in next version (0=player 1)
Homeworld - The .hst file seems to ignore changes, the m files do see an effect but will lose it when the host generates
Terraformed - Readonly Boolean
Ironium, Boranium, Germanium & Population - Any positive 32 bit signed value
IroniumConcentration, BoraniumConcentration & GermaniumConcentration - 0 to 255
Temperature, Gravity & Radiation - 0-100

To give an idea of how the object is intended to be use I've included a sample script below

set obj=createobject("AtlantisSoftware.StarsHostEditor" ;)
obj.load("games\game.hst")
for each Planet in obj.planets
  planet.ironium=1000000
  planet.Boranium=2000000
  planet.Germanium=3000000
  OwnerID=int(planet.ownerid)
  if ownerid<>-1 then
    planet.population=11000
  end if
next
obj.save ("games\game1.hst")
msgbox ("Game1 Saved")

Report message to a moderator

Re: ActiveX object model for Stars files Fri, 08 February 2008 21:36 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
There have been hosts who have cheated...

If you don't release the source code, perhaps you could trigger a message to every player.

If you do release the source, and/or cannot add a message, then don't worry about it too much, there are lots of ways a host can cheat, adding another won't change anything really.



- LEit

Report message to a moderator

Re: ActiveX object model for Stars files Sat, 09 February 2008 01:23 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

Personally, I would like a copy of the utility. For setting up custon games it would be a great help. The most valuable aspect for custom game set-up is the ability to set the home world mineral values.

Ptolemy




Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: ActiveX object model for Stars files Sat, 09 February 2008 16:35 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
The original request was for something that could edit surface minerals, the person that asked me for it was considering a Willy Wonka type game from a few years ago without the excess management needed for it that would normally be required.

The object model I have at the moment could provide interesting scenarios. Things like setting every planet to the same hab so every planet is 100% for everybody or having everybody have the same hab and making everything except homeworlds uninhabitable or setting all minerals concentrations to 1 and placing a set amount of minerals on planets, effectively meaning the game is limited to the starting x kts of each mineral.

The next version would also allow setting factories and mines on planets and should allow specifying the owner and probably allow specifying a starbase. It would be possible to have a game that is pretty much just fighting by having every planet shared out between the players and starting with identical habs, 2 billion kt of minerals, 1 million pop, and 4000 factories and maybe even a starbase so that a race doesn't need to build any infrastructure at all. Could provide an interesting training ground in combat.

At the moment the object model only changes the file that is loaded, ie if you edit a .hst to give planet minerals you either have to then make the same change in each .m file or generate a turn. While it can edit .m files at the moment I am intending to make this version specific to editing .hst and which is why it is named the way it is. When I make it specific it will apply changes to .m files automatically and insert a message along the lines of, 'This game has been edited by the host using the StarsHostEditor available from URL. This message is provided to stop host from making changes without players knowing that they have done so'

I'm planning a read only model for .m files that can add commands to a .x file which would make a number of utilities possible, from providing information only to an entire AI if someone wanted to create one. It won't provide direct editing of the .m or .x files, you'll specify a command to add to a .x file along the lines of Load(SourceObjectID,DestinationObjectID,Ironium,Boranium,Ger manium,Population) and it will check that you have the required minerals and population before adding it to the .x file, basically the same things the stars interface already does but making it possible to do so programatically.

Report message to a moderator

Re: ActiveX object model for Stars files Sat, 09 February 2008 16:48 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

That's fine,

When generating games with even planet distribution, it takes numerous gens to get the desired universe. All I need for these games is an easy way to change the HW mineral concentrations. It really sucks to get the perfect universe after numerous gens and find that iron and germ have concentration 15 when I want them in the middle of the scale at least to give a fair chance to all players.

Ptolemy




Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: ActiveX object model for Stars files Mon, 11 February 2008 04:27 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Sat, 09 February 2008 22:35

I'm planning a read only model for .m files that can add commands to a .x file which would make a number of utilities possible, from providing information only to an entire AI if someone wanted to create one. It won't provide direct editing of the .m or .x files, you'll specify a command to add to a .x file along the lines of Load(SourceObjectID,DestinationObjectID,Ironium,Boranium,Ger manium,Population) and it will check that you have the required minerals and population before adding it to the .x file, basically the same things the stars interface already does but making it possible to do so programatically.

Pretty promising! Cool

I assume you're still working with the unencrypted version? Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Mon, 11 February 2008 05:18 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
I'm working with the normal version, Captain Maim sent me the decryption algoritm that Kotk sent him and I've used it to make a VB.net class that can load a file into memory decrypting it and then save it back to disk reencrypting it.

Report message to a moderator

Re: ActiveX object model for Stars files Mon, 11 February 2008 09:50 Go to previous messageGo to next message
Soobie

 
Officer Cadet 3rd Year

Messages: 270
Registered: May 2007
Location: Australia
This thread makes me want to ring my bank and quiz them on the strength of the security they employ Surprised

Report message to a moderator

Re: ActiveX object model for Stars files Mon, 11 February 2008 13:35 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
For anybody interested in trying out the ActiveX object it is now far enough along to make a public release. It applies any changes to the .hst file to any .m files. You do need all the .m, .hst and .xy files available and in the same directory.

The .m files do get a message in them from player 17, it's been copied from the Planet swapper utility since stars encodes text and I haven't got round to doing a function to encode text yet so I just took the existing message I had, it does serve in letting people know that the files have been altered.

The release is recommended for testing only, I do not recommend using it for a live game until it's been tested exhaustively by a number of people, I have not been able to find anything that may cause a problem but it is possible that doing something I haven't thought of trying could do.

If anybody does find any problems with it then please let me know, if you can think of anything useful that could be added to it the suggestions are also welcomed. I'm intending to allow editing of factories, mines, defenses, scanners etc and I'm also considering allowing Wormholes to be added, amended or deleted but I can't think of anything else that might be useful for being edited before a game starts except for possibly starting tech and MT Items and it doesn't seem worthwhile adding something that would only be useful afterwards since once a proper game starts you wouldn't be able to edit the .hst unless it is being hosted manually.

If you've managed to read this far and are looking for the URL then here it is http://stars.atlantissoftware.co.uk/data/files/starshostedit or.zip, if you've just jumped to the URL then go back to the top and start reading. Also remember to read the readme.txt file for details on how to use it and you'll probably need to change the filename to the .hst file in the .vbs script if you want to try running the sample.

Edit: You will need the .net framework to be able to make use of the DLL.


[Updated on: Mon, 11 February 2008 13:36]

Report message to a moderator

Re: ActiveX object model for Stars files Mon, 11 February 2008 16:21 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

Is it relevant that http://stars.atlantissoftware.co.uk/ gives a MySQL error?

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 12 February 2008 04:02 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Mon, 11 February 2008 11:18

I'm working with the normal version, Captain Maim sent me the decryption algoritm that Kotk sent him and I've used it to make a VB.net class that can load a file into memory decrypting it and then save it back to disk reencrypting it.

Cool! Cool

Can you extract from the m file a reasonably complete report of things like M.Ts, minefields, wormholes, packets, debris? Sherlock In the same simple format that Stars! own reports use? Teleport



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 12 February 2008 04:06 Go to previous messageGo to next message
gible

 
Commander

Messages: 1343
Registered: November 2002
Location: Wellington, New Zealand

I have to ask, can you extract enough info from the .m file and create enough info for a .x file to create a stars client?

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 12 February 2008 05:42 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
m.a@stars wrote on Tue, 12 February 2008 09:02


Can you extract from the m file a reasonably complete report of things like M.Ts, minefields, wormholes, packets, debris? Sherlock In the same simple format that Stars! own reports use? Teleport


MTs, Minefields, wormholes and packets are actually the same structure type albeit with different uses for each byte which I've already decoded, I actually have an editor for them already although it only edits existing object and it shows the full info such as what the MT is carrying and who has been through it, Wormholes also give info on who can see it and who knows what it is connected to.

gible wrote on Tue, 12 February 2008 09:06


I have to ask, can you extract enough info from the .m file and create enough info for a .x file to create a stars client?



That's pretty much what I am intending to do for the client object, I'll only be developing the object model, I probably won't bother to do an interface since there is already one. The idea for it's use was to make creation of bots for sweeping, scanning, pop & mineral management, queue optimisation etc possible and even potentially a full AI which would need every object available and every command to be able to be entered into the .x file.

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 12 February 2008 08:34 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Tue, 12 February 2008 11:42

MTs, Minefields, wormholes and packets are actually the same structure type albeit with different uses for each byte which I've already decoded, I actually have an editor for them already although it only edits existing object and it shows the full info such as what the MT is carrying and who has been through it, Wormholes also give info on who can see it and who knows what it is connected to.


Pretty interesting! I guess you'd need to report out only those bits that the player actually has a right to know. Very Happy

I wonder if a stand-alone utility to do just that would be easy/fast to build. Rolling Eyes

Also, Planet and Fleet reports could probably be made more complete/readable than what Stars! itself already gives. Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 12 February 2008 08:37 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
gible wrote on Tue, 12 February 2008 10:06

I have to ask, can you extract enough info from the .m file and create enough info for a .x file to create a stars client?

Or, conversely, if the x file can be completely decoded, and the m file can be accurately reconstructed, would it be possible to use a non-buggy turn-generator with the standard client? Twisted Evil



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Wed, 13 February 2008 12:43 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
Doing a stand alone reporting utility would be quick to do, I'll probably have an object model out by the weekend for .m files, doing an entire host though would take quite a bit of time, I probably know enough of the file format to do it and I can create valid .m, .x and .xy file from scratch, however a complete host needs a lot more work than just the file format. Just working out the battle engine would probably take quite a bit of work.

I've added a new version of the StarsHostEditor to the website, the previous release stopped the planets being updated when I added the message. Pretty much everything associated with the planet can now be edited though, changing OwnerID does require a regen at the moment since the original structure for them wouldn't have been in the .m file, I expect to add them in the next version. It is also possible that the population in the .m file won't appear correctly although if you click it the pop up does show the correct value, it seems to be showing the estimated pop value which I don't update yet and I'm not sure yet why that is. I've not updated the Readme file for the new properties yet, anyone with the vb.net or c#.net should be able to add a reference to it and see what is available. Some of the more useful properties are OwnerID(0-15) & StarbaseSlotID (0-9)

Report message to a moderator

Re: ActiveX object model for Stars files Thu, 14 February 2008 03:25 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Wed, 13 February 2008 18:43

Doing a stand alone reporting utility would be quick to do, I'll probably have an object model out by the weekend for .m files,


I can't wait. The potential usefulness is mind-boggling. Cool

Quote:

doing an entire host though would take quite a bit of time, I probably know enough of the file format to do it and I can create valid .m, .x and .xy file from scratch, however a complete host needs a lot more work than just the file format. Just working out the battle engine would probably take quite a bit of work.

Indeed. Whip

But I was thinking of starting with just the game creation. Galaxy shape, HW positioning, planet properties, race checking... Rolling Eyes

I could dust up my old "generator" (which already does most of that) and finish polishing it if it had a chance of actually being used to create "real" games. Very Happy

I'm sure there are other generators out there too.

Pity the standard Stars! client won't take a galaxy of 5000+ planets. Twisted Evil

Note: If you have a "game generator" and also an "x file sanitizer" then you're half-way to the whole "server" side of things. Add "production" and the fleet targeting/moving/routing gymkhana, and there should be little more than the Battle Engine left to get you done. Teleport

Spice it up with a bit of "logistics & builds planning" plus some "map analizing" and you can even set up "AIs" Smile



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Sat, 16 February 2008 19:09 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
I have an object model from .m files on the website at http://stars.atlantissoftware.co.uk/data/files/starsplayered itor.zip, there is a lot in it so I won't go into detail here, I'll just give details of the StarsPlayerEditor object which is the highest level object and should give an idea of what you can access with it. All the properties are listed in the readme.txt file.

StarsPlayerEditor
  Load(filename)
  PlanetCount
  PlayerCount
  GameName
  TurnNo
  Planets[] - Currently only your occupied planets
  Scores[]
  Wormholes[]
  Minefields[]
  MTs[]
  Fleets[]
  EnemyFleets[]
  ShipDesigns[]
  StarbaseDesigns[]
  Errors[]

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 19 February 2008 12:00 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Sun, 17 February 2008 01:09

I have an object model from .m files on the website at http://stars.atlantissoftware.co.uk/data/files/starsplayered itor.zip, there is a lot in it so I won't go into detail here, I'll just give details of the StarsPlayerEditor object which is the highest level object and should give an idea of what you can access with it. All the properties are listed in the readme.txt file.

Hmmm, looks like I'd need to install .Net to build a proper standalone "reporting" utility? Confused



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 19 February 2008 13:23 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
m.a@stars wrote on Tue, 19 February 2008 17:00

Hmmm, looks like I'd need to install .Net to build a proper standalone "reporting" utility? Confused


There is a sample .vbs script to show how to use it in VBScript. The sample just dumps a line for each ship type in each fleet listing the FleetID, Location, SlotID, ShipCount, Damage in 1/65536ths I think, when testing dividing by 65536 did get the % almost correct but sometimes it needed rounding down and others up so it may be a different figure.

It should be possible to use it in anything that can use ActiveX Objects to write a utility in, .vbs files being the easiest to edit and executable on any windows system but they don't offer a User Interface. Word, Excel, VB6, ASP.Net, VB.Net and C# should all be able to access it so they could be used, I would recommend vb.net since there is a free version, it would also be able to reference the DLL directly rather than going through ActiveX so the DLL shouldn't need registering and the .net runtime is needed anyway for the .DLL.

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 19 February 2008 13:53 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Tue, 19 February 2008 19:23

It should be possible to use it in anything that can use ActiveX Objects to write a utility in, .vbs files being the easiest to edit and executable on any windows system but they don't offer a User Interface. Word, Excel, VB6, ASP.Net, VB.Net and C# should all be able to access it so they could be used, I would recommend vb.net since there is a free version, it would also be able to reference the DLL directly rather than going through ActiveX so the DLL shouldn't need registering and the .net runtime is needed anyway for the .DLL.

OMG, the thing needs the .Net runtime to work? Shocked

I'd have hoped reading/reporting on m files would be easier. Perhaps it's the writing/checking that's harder? Whip

Also, I notice your sample vbs doesn't dump "direction" for fleets, or even "origin coords". Does that mean the info is not there, or you haven't figured out how to use/interpret it? Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Tue, 19 February 2008 20:30 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
There is a 2 byte Unknown property on the Fleet object that I've delibrately exposed that appears to hold the direction of travel but I've only taken a quick look at it which shows that it doesn't appear to be any sort of x,y coordinate, presumably it is an angle, probably something along the lines of value/65536*360 but I haven't taken the time to look into it further.

The thing is written in VB.Net which is what I'm writing in at present so it should need the .net runtime to work, someone could write something in something other than .net if they want to do so, I'd be happy to provide them with the information I have worked out so far on the file formats to allow them to write it.

The code I've developed could probably be converted fairly easily to an ActiveX object written in Microsoft C++ which could avoid the requirement for the .net runtime but I don't see me spending the time to do so since I can't see any worthwhile reason for it since there won't be enough people using it and pretty much anything that can use an ActiveX control can handle .net anyway.

Report message to a moderator

Re: ActiveX object model for Stars files Wed, 20 February 2008 09:45 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Wed, 20 February 2008 02:30

There is a 2 byte Unknown property on the Fleet object that I've delibrately exposed that appears to hold the direction of travel but I've only taken a quick look at it which shows that it doesn't appear to be any sort of x,y coordinate, presumably it is an angle, probably something along the lines of value/65536*360 but I haven't taken the time to look into it further.

That's an angle ratio I never tried. Confused

Can you confirm if the numbers are the same that the "dump fleet report to file" gives? Sherlock

Quote:

The thing is written in VB.Net which is what I'm writing in at present so it should need the .net runtime to work, someone could write something in something other than .net if they want to do so, I'd be happy to provide them with the information I have worked out so far on the file formats to allow them to write it.

The code I've developed could probably be converted fairly easily to an ActiveX object written in Microsoft C++ which could avoid the requirement for the .net runtime but I don't see me spending the time to do so since I can't see any worthwhile reason for it since there won't be enough people using it and pretty much anything that can use an ActiveX control can handle .net anyway.


I could probably cobble something together if I had Kotk's code for the decryption. Teleport



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: ActiveX object model for Stars files Wed, 20 February 2008 17:37 Go to previous messageGo to next message
PaulCr

 
Chief Warrant Officer 3
Stars! V.I.P

Messages: 187
Registered: February 2007
Location: An Island that kinda look...
The numbers in the Unknown property do calculate out to be the same as the ones in the fleet report. The 2 bytes are actually 2 single bytes, the lowest is the whole part of the value given in the fleet report. The high byte is the fraction part ie.

Report - Unknown (hex)
1.104 - 6801
5.18 - 1205
8.45 - 2D08

I haven't tried to work out what the figure in the fleet report means though, I would assume somebody else already has given they have been available for a while, for all I know the authors may have actually posted on how to use the value. I can tell that they aren't an angle directly since they only range in value from 0 to 255.99, my guess would be Value/256*360 but as mentioned that is only a guess.

Report message to a moderator

Re: ActiveX object model for Stars files Thu, 21 February 2008 13:59 Go to previous messageGo to previous message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
PaulCr wrote on Wed, 20 February 2008 23:37

I would assume somebody else already has given they have been available for a while, for all I know the authors may have actually posted on how to use the value.

Nope, not a clue, or at least none I could find. Wall Bash

Quote:

I can tell that they aren't an angle directly since they only range in value from 0 to 255.99, my guess would be Value/256*360 but as mentioned that is only a guess.

If I had a bit of time I could try some of those divisors and hopefully come up with the true meaning, or conversely, send a dozen test fleets at several angles and see what "angle" numbers they each get. Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: stars!.ini location in Vista
Next Topic: GAME CONCEPT: Mauryan Campaign [Very Long]
Goto Forum:
  


Current Time: Sun May 05 07:41:00 EDT 2024