Pumps, tranfer, water, Tank =(

:spin::spin::spin::spin:I am a beginner, I have done some school work using BGE, but the one I am trying to do this roasting my mind. I am wanting to transfer water from one tank to another using pumps, and so the tank can empty when the valves are correctly connected to receipt tank, it can use one or two pumps and would change the flow and fill the tank slower or more fast, or use the pump 1 or 2 to fill another tank. And in each tank has a green bar which is proportional to the level , In the tank would have the maximun value of the tank, the current value of tank level and the percentage of the tank.
Plz help me :spin::spin:

Attachments


Not a professional myself but I’ll try to give this a start.
First I would add objects for the 2 pumps and give them a boolean property and call it “pump”. Same goes for the valves you want to be able to open and close. add some objects, boolean properties and call them “valve”.
With mouse sensors you could then set the propeties to either True or False. (Mouse over sensor to detect the object, Left Mouse/Right Mouse to change the property of the object)
For the actual water transfer part I would need to know if you have some knowledge of python scripting to give you an idea on how to proceed.

Hi, first of all you can find a lot of good info about blender here:
http://www.tutorialsforblender3d.com/

Secondly, unfortunately this is one of the kind of problems in Blender which is rather hard to model. But it can be solved with logic bricks. It would be better to use python, but maybe not easier.

Each pump and valve would need to be an object, you would need to give them a mouse over sensor if you want to open and close them with the mouse. When the valve is open it would activate a property actuator, to add or subtract from a property called “water”. You can change the pump/valve’s behavior by designing different states.


State 1 is “off” the valve doesn’t do anything, but it needs the mouse over and mouse click logic to change to state 2. it also has a “replace mesh” actuator to change color to show it is closed.
State 2 is “on” It subtracts from one water object and adds to another. It has the same mouse over logic so you can change back to state one and the same replace mesh actuator to show it is open.

Here’s a quick demo to show how it could be done:
water_pump_demo.blend (474 KB)

Using this method you may get problems if a valve neighbors two sources of “water” as the logic is not detailed enough to add water flow together. You could try adding other states… but maybe a python script could do it more easily at that point.

What python would help you to do:
Calculate water volume based on water flow. Calculate water percentage. Calculate combined water flows, simplify your overall design.

As an example:

import bge

cont = bge.logic.getCurrentController()
own = cont.owner

water = own['water']

tank_size = 200.0


map = 1.0 / tank_size
percent_filled = (water * map) * 100.0

own['Text'] = str(int(percent_filled))  + "%"

I suggest you think about your game model.

That can be Python data and/or a few game objects in your scene.

The model keeps

  • the structure what entity is connected to what other entity
  • the operations on the entity (e.g. open, close, fill)
  • the status of each entity (e.g. how much water is in what tank, how the valves are switched)

Then you have that you can think about how you want to present that model to the player. E.g. what meshes you need what they represent etc. pipes to represent the connections, cylinders with animated water-surface, valves with wheels. They have nothing to do how the model works, but show it to the viewer -> this is the view.

Finally you need some interaction to let the player tell the model what operation he wants to request. E.g. clicking on valves.
This is the control. It collects the user input and transfers it to the model to be processes. The model updates itself and tells the view to update. The view reads the model to present the new status to the viewer.

I hope this helps a bit.

MVC master :smiley:

Thanks Thanks a lot!!! Solved !!! Really Amazing !!:smiley: I studied python, but I still don’t know apply in Blender =/

THANKS A LOTT!!! Solved!! I’ve already studied python but i don’t know to apply in Blender =/ … however Logic Bricks is the way =) ty