Pipe Placement Logic


The Game space

In our i10 Pipe game, two players will share a same game space but each has their own pipe system. Therefore, it is important to maintain the consistency in the Pipe system. So that pipe of each player can’t be connected to the other.
The implementation There are two steps in the pipe placement checking. Pre-condition:
  • For each cube that player can place a pipe, the program will check what kind of pipe can be placed in. The check is done by getting the information about which face of the cube is available for a pipe connection. A face is considered available if it is not connected to any pipe in current cube and it is not a connection in the neighbour cube.
  • Once the available faces are determined, possible pipe is considered as following:
  • Closed pipe is always an option
  • If the opposite face of the connection is available, straight, flexi, reservoir are the options
  • If any of the face that is perpendicular with the connection is available, the curved pipe is the option
  • If the opposite face and any of the perpendicular face are available, the three-way pipe is the option
  • Final condition: After selecting the pipe, the user will perform the transformation to connect his new pipe to the current pipe system. Again at this step, we need to check if the pipe is correctly placed. The pipe is accepted only if it does not share the any connecting face with any other pipe and it does not connect with the other player’s pipe system.
Once the pipe passes the two conditions, it will be added into the player’s pipe system. On the other hand, if the condition is not satisfied, the player will need to undo the move, select different cube/pipe.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.