Project Plants

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
I think that it won't be realistic if you can't build a vessel using only Earth resources. It may be more effective to produce vehicles at other bodies though.

Why should we split resources into more individual?

And concerning a save game functionality, sorry, I don't get what you mean. How the module can use vessels as handles?
 

Grover

Saturn V Misfire
Addon Developer
Donator
Joined
Oct 3, 2010
Messages
1,468
Reaction score
0
Points
0
Location
Ascension Island
sorry, i should have made it clearer

first, more resources = more functionality, you may want to make the heat shield out of one alloy, but the airframe out of another

and as for the saving function, it would just make keeping a campaign of missions gathering many resources easier, it could record:
vessel positions
cargo stored at each plant
production status of each plant
etc

is that clearer?
 

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
Yes. We'll see later, whether it is better to have more different resources for vessels production. It should be easy to change that, we'll have to modify config files only. Just have in mind that each new resource will require a new UCGO cargo model and vessel config.

As I said the info about stored cargo and production status of each plant will be saved in scenario in a separate section. Don't know why should I record vessels positions too.
 

Trainguy

Trumpeter
Joined
Jul 12, 2010
Messages
47
Reaction score
0
Points
0
Location
Cheltenham
Thanks for this, it is much clearer. The only thing that springs to mind is - will the tugs have to be built as well, along the DG-XR2-XR5 progression or will they all be available from the start.

Neptune doesn't seem so far away now, so long as there are no time constraints.

Also, it would be fun if the actual processing functionality of the orbital stations were confined to one or two modules, which can be incorporated into larger stations as a more challenging construction prioject. Otherwise they could be built in a single Energia launch, which may not be enough for more advanced processors.

I like the resource progression, by the way.

Aren't vessal positions saved in the scenario anyway?

Sorry for the late reply

:hailprobe:
 
Last edited:

Grover

Saturn V Misfire
Addon Developer
Donator
Joined
Oct 3, 2010
Messages
1,468
Reaction score
0
Points
0
Location
Ascension Island
well i was worried about status being lost within a saveed scenario, i suppose UGCO wouldnt do that anyway, as long as you keep the module's operations strictly to plant operation, and not to carry on taking data whilst you're in flight

PS,[OT] is your picture railworks? i had that a while back ;)
 

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
Today the first resource cargos were created at the plants. For testing I made Cape Canaveral produce fuel and Habana - oxygen.

The config file for Earth:
Code:
BEGIN_PLANT
	BASE Cape Canaveral
	PRODUCT fuel
	VESSEL_PRODUCT UCGO\Cargos\CargoBarrelFuel
	RATE 4
	CAPACITY 20
	EXPOSITION -80.6795 +28.5218
END_PLANT

BEGIN_PLANT
	BASE Habana
	PRODUCT oxygen
	VESSEL_PRODUCT UCGO\Cargos\CargoOxygen
	RATE 1
	CAPACITY 10
	EXPOSITION -82.4003 +23.0001
END_PLANT

The RATE is a number of goods in a day. The EXPOSITION is a longitude and latitude where cargo appears when we order it.

The saved state in the scenario:
Code:
BEGIN_Plants
Earth:Cape Canaveral:7:0.336631
Earth:Habana:1:0.834865
END

This is how the dialog looks now:
dialog1.png

Now to give more sense to the fuel production I want to find a way to feed the UCGO fuel cargo to any vessel. Maybe I missed an add-on which do this already? Otherwise I have to choose whether to use storage facilities and dialog to fill tanks or to make a special MFD.

Haven't decided yet how to name and place produced vessels when more than a single is ordered.

Also I don't know if it is better to create a separate dialog for storage facilities or use the same one.

Since the module works already, it would be nice if someone, who knows how to create bases and is willing to help, found good places for plants and created bases config files. Later the models created by Grover could be added. I'd like to have fuel plants near Cape Canaveral, Wideawake, Jarvis, SRC Space Port and some European port.
 
Last edited:

Trainguy

Trumpeter
Joined
Jul 12, 2010
Messages
47
Reaction score
0
Points
0
Location
Cheltenham
Looks great vchamp!

A few things. Firstly, I think it would be good to have that dialog as generic, as I can't see anything manufacture specific.

Secondly, the UCGO fuel truck can already add fuel to any vessal. Perhaps take a look at this and modify it, to combine this and the ability to use fuel from a cargo (such as that on the DGIV).

Thirdly, the European port may well not exist, as I don't know of any european bases. It would make sense, however, to have one near Cayenne Rochambeau Airport, the Francophone one near Kourou CSG space centre, which a lot of orbinauts will use.

Also re placement, it is essential to ensure they can be moved by anyone with the nowhow to do so, so their positions can be customised and changed. This means thet, so long as the orbinaut can create and modify base configs, their position is not to critical

I would be happy to help with the placements, but I am currently loaded with mock exams, so I may only be able to help in about a fortnight or so.

I hope this is helpful! Let me kinow what you think.

Lastly::hailprobe:
 

Grover

Saturn V Misfire
Addon Developer
Donator
Joined
Oct 3, 2010
Messages
1,468
Reaction score
0
Points
0
Location
Ascension Island
im afraid i have bad news:

due to my parents' "Briliant" idea to move house, ill have to move into a rental proberty for about 3 months, during which time, i wont be able to get to my computer (it will be boxed up) and there probably wont be internet connection either :(

id love to help you man, really, but this stupid moving house business has me out of luck.

maybe ill come back in 3 months to find an awesome production addon sitting in the all time bests of OH

sorry about all this, ill inform you if this changes, and i'm able tog et me computer up in the rent house
 

Trainguy

Trumpeter
Joined
Jul 12, 2010
Messages
47
Reaction score
0
Points
0
Location
Cheltenham
That's a shame.

I'm sure we'll do our best to keep this running.

Could you add the mesh as an attatchment so others (not me, I'm still learning, but have enough experience to test and play with it in orbiter) can polish it, texture it etc.

Good luck moving house!
 

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
That are bad news, Grover, but don't worry. I didn't plan to make building models anyway. The look of bases will be worse of course, but it won't affect the functionality.

Trainguy, thanks for the feedback. There will be some differences in dialogs for plants and storage depots. The latter won't have the information about the product and the manufacture progress bar. I think it is better to make two tabs, but the same dialog.

The fuel truck with limited fuel and ability to refill its cistern is a good idea, but I don't know how to make it. The only way is to create a completely new vessel not derived from a generic UCGO car, I'm afraid. I think we should have an MFD that allows to pump fuel from either a fuel cargo or any vessel's tank in vicinity (because the UCGO fuel cargo is too small and it will be required to transport too many of them).

Placement of bases and other crucial parameters will be configurable definitely. Everyone will be able to create their own plants and depots.

Good luck at exams and of course :hailprobe:
 

Trainguy

Trumpeter
Joined
Jul 12, 2010
Messages
47
Reaction score
0
Points
0
Location
Cheltenham
Is that what the bar is? I hadn't realised.

Re the MFD - I think the ability to transfer LOX as well as fuel would be good, as these are both used in the vessals talked about (DGIV, XR etc)

A decision will have to be made soon as to how much fuel the cargo carries - on the one hand, fuelling an XR5 must be achievable in a resonable timespan, on the other, a single cargo mustn't fill a DGIV's tanks.

Re the buildings, I think that we could probably get the plants to the point whereby they are stable, so when Grover finally gets his computer back, the visuals are no trouble.

Thanks about the exams, and, for obvious reasons :hailprobe:
 

Grover

Saturn V Misfire
Addon Developer
Donator
Joined
Oct 3, 2010
Messages
1,468
Reaction score
0
Points
0
Location
Ascension Island
well, ive just been told its not definite, i may have the computer back sooner (maybe a week?), for now though, im being told to pack it up right now, and the only model thats ready is the one i started on, so its here it is generic, so you might be able to use it for the initial release at least, then hopefully ill be back and i can make you some more models
NOTE, its not scaled properly, i made it before i fixed my scaling issue, so it will be quite a bit smaller (units are inches, you need to make it meters, scale up by sf 39.3700787)

good luck guys!
 

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
Recently I was busy with ReFuel MFD modifications and creation of the new classes hierarchy for the Plants project. Before moving further I want to get rid of one nasty bug and need a help from people with a good C++ knowledge.

The problem is that after finishing a simulation session and closing the launchpad the orbiter.exe process often don't close. And if I finish a simulation and start a new without closing the launchpad I always get CTD. I think it is because of a memory leak and not freed resources, but I can't figure out what shall I do.

Can please someone tell me if I do something wrong using pointers to vectors and their elements as in the code below?

Plants.h:
Code:
class Plants : public Module {
public:
	Plants(HINSTANCE hDLL) : Module (hDLL) {};
	~Plants();
	...
	vector<PlantBase>* GetSelectedCBodyPlants();
	vector<PlantBase>* GetCBodyPlants(OBJHANDLE cBody);
	
	bool SetSelectedPlantIndex(int plantIndex);
	PlantBase* GetSelectedPlant();

	vector<OBJHANDLE> GetCBodies();
	...

private:
	
	// map of plants to cBody
	map<OBJHANDLE, vector<PlantBase>> _plants;

	OBJHANDLE _selectedCBody;
	PlantBase* _selectedPlant;

	PlantBase* GetPlant(const string& cBodyName, const string& plantName);
	...
};

Plants.cpp:
Code:
...

Plants::~Plants() {
	if (_selectedPlant) {
		_selectedPlant = NULL;
	}
}

vector<PlantBase>* Plants::GetSelectedCBodyPlants() {
	return GetCBodyPlants(_selectedCBody);
}

vector<PlantBase>* Plants::GetCBodyPlants(OBJHANDLE cBody) {
	return &(_plants[cBody]);
}

bool Plants::SetSelectedPlantIndex(int plantIndex) {
	vector<PlantBase>* cBodyPlants = &(_plants[_selectedCBody]);
	if (plantIndex < cBodyPlants->size() && plantIndex >= 0) {
		_selectedPlant = &(cBodyPlants->at(plantIndex));
		return true;
	} else {
		return false;
	}
}

PlantBase* Plants::GetSelectedPlant() {
	return _selectedPlant;
}

PlantBase* Plants::GetPlant(const string& cBodyName, const string& plantName) {

	for (map<OBJHANDLE, vector<PlantBase>>::iterator iter = _plants.begin(); iter != _plants.end(); ++iter) {
		char name[100];
		oapiGetObjectName(iter->first, name, 100);
		if (cBodyName.compare(name) == 0) {
			vector<PlantBase>* cBodyPlants = &(iter->second);
			for (vector<PlantBase>::iterator pIter = cBodyPlants->begin(); pIter != cBodyPlants->end(); ++pIter) {
				if (plantName.compare((*pIter).GetName()) == 0) {
					return &(*pIter);
				}
			}
		}
	}
	return NULL;
}

vector<OBJHANDLE> Plants::GetCBodies() {
	vector<OBJHANDLE> cBodies;
	for (map<OBJHANDLE, vector<PlantBase>>::iterator iter = _plants.begin(); iter != _plants.end(); ++iter) {
		cBodies.push_back(iter->first);
	}
	return cBodies;
}

Example of the Plants class usage in PlantsApp.cpp:
Code:
...
void UpdateDialogPlantInfo(HWND hDlg) {

	if (hDlg != NULL) {
		PlantBase* selectedPlant = g_plants->GetSelectedPlant();
		if (selectedPlant != NULL) {
			SetWindowText (GetDlgItem (hDlg, IDC_PRODUCTNAME), selectedPlant->GetProduct().data());
			... // show the status of the selected plant
		}
	}
}

void OnCBodySelect(HWND hDlg) {

	vector<PlantBase>* cBodyPlants = g_plants->GetSelectedCBodyPlants();
	PlantBase* selectedPlant = g_plants->GetSelectedPlant();

	int selectIndex = 0;
	if (cBodyPlants->size() > 0) {
		int index = 0;
		for (vector<PlantBase>::iterator iter = cBodyPlants->begin(); iter != cBodyPlants->end(); ++iter) {
			SendDlgItemMessage(hDlg, IDC_COMBOPLANTS, CB_ADDSTRING, 0, (LPARAM)iter->GetName().data());
			if (selectedPlant != NULL && selectedPlant->GetName().compare(iter->GetName()) == 0) {
				selectIndex = index;
			}
			index++;
		}
	}

	SendDlgItemMessage (hDlg, IDC_COMBOPLANTS, CB_SETCURSEL, selectIndex, 0);
	if (g_plants->SetSelectedPlantIndex(selectIndex)) {
		UpdateDialogPlantInfo(hDlg);
	}
}

If the problem is not in pointers to vectors and their elements, what else can be wrong?

Thanks in advance.
 
Last edited:

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
Funny, it wasn't because of wrong pointers usage.

To help anyone to avoid my mistake in the future:
ExitModule() is called only when launchpad is closed. All variables and collections that are loaded in clbkSimulationStart() should be cleared in clbkSimulationEnd().

---------- Post added 02-23-11 at 12:41 PM ---------- Previous post was 02-22-11 at 04:10 PM ----------

I need new cargos for metal, plastics, vessels frame, engines, electronics, etc. I'd be very grateful if someone makes it. At least some of them.

It would be cool to have, for example, a DeltaGlider or an XR2 engine models for a cargo.
 

orb

O-F Administrator,
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
ExitModule() is called only when launchpad is closed.
ExitModule is called when a DLL is unloaded from memory, so either when Orbiter process is terminated (respawned), after all instances of it have been unloaded by Orbiter for vessels, or when you disable the module at modules tab, if it's a plug-in module. ExitModule of Startup modules are called only when Orbiter is terminated (or respawned).
 

vchamp

Member
Joined
Mar 24, 2008
Messages
221
Reaction score
6
Points
18
It seems that I have implemented my initial idea in its basic form. I didn't decorate bases with buildings yet and didn't pay much attention to placing plants and their 'expositions' and 'inpositions' (don't know the correct english term for them). Just made it working and already had some fun transporting resources from base to base and producing vehicles.

If anybody wants to try this, here it is: View attachment 11-02-28_full.zip

For the configuration included in this archive you'll need UCGO, DGIV, all three XR vessels, TI Shuttle PB and [ame="http://www.orbithangar.com/searchid.php?ID=5103"]Houston Texas Terrain & Infrastructure v0.1[/ame] (this is where I placed resource producing plants). However it is possible to configure everything to work standalone, without other addons.

Until there are marks on bases to indicate 'inpositions' (places from where vessels are taken inside), there may be problems with finding this positions. The rule is: use STORAGE definitions in Plants.cfg, the fourth and fifth parameters are longitude and latitude of positions where vessels appear and are taken inside.

My next goal is to make depots where products are stored. Shouldn't take much time.
 

Trainguy

Trumpeter
Joined
Jul 12, 2010
Messages
47
Reaction score
0
Points
0
Location
Cheltenham
Looks great!

I'm having a little play with this, using markers (shuttle PBs) in a scenario just behind the 'inspositions'. It really helps!

I think the words you want may be intake and output, though I'm not sure if an XR5 can be an output yet.

Keep up the good work!

Trainguy
 

Carmen A

redneck kitten with pillow :3
Addon Developer
Joined
Jan 1, 2011
Messages
751
Reaction score
0
Points
0
Location
Can I be in Texas?
Website
v149th.yolasite.com
Wow, I just realised you're using my Houston area terrain.

If needed I can do sat-derived local terrain for other famous industrial areas too. Especially those renown for aerospace industries.

'expositions' and 'inpositions' (don't know the correct english term for them).

I believe you may regard these areas as "Loading/Unloading Bays".

For a start, the default landing pads might be used, and for purposes of marking which bay one should go to, just put a huge billboard labelled "INPUT" and "OUTPUT" or something.

When I get back to flying in Orbiter (busy with a Swiss and an Australian IL-2 virtual squad now) I'll see if I can test out the factories and doll some of them up if its easy for me to do.
 
Last edited:
Top