AirShip, AI and Physics

I was having some fun with 3DS Max and created an air ship. I’ve been spending the past weeks getting it flying in the Unreal engine, and getting some basic AI to see if I can get it to navigate in 3D space.

I used to play a lot of Garry’s mod when I was younger. Whenever you wanted to make something fly you would give it hover balls to lift it at certain points. This whole thing reminded me a lot of the buoyancy spheres I used when creating my ocean, except in reverse. So I created a hover ball game objects that would split the weight of the object among them and then apply equal force to get them the object to float perfectly on the spot. This was way more successful than I original thought it would be and I was even able to split the distribution of force among them to create a sort of procedural animation. I also stuck some fans onto the airship that would speed up or slow down depending on the amount of force being applied to its respective hover ball.

I also had to sort out some AI for the cannons on the side of the airship. This was harder than I thought it would be, but proved an interesting math puzzle. In the end I got it to aim perfectly at the target regardless of the turrets orientation.

Lastly I got some AI onto the airship to get it to follow patrol points, attack the player, or flee. The end result was really cool, as the airship would instinctively perform a 3 point turn to turn around. This was because instead of having the AI move the ship, it moves a virtual joystick that moves the ship. Creating a more natural and less clunky movement system. The video below shows me setting up a patrol route and letting the airship navigate it.

 

Advertisements

Ocean Optimisation

It has been fun programming this ocean, and I want to optimise its use. What I  want to use is a method projecting a flat plane from the camera and its frustum onto the ocean, and then use this plane to create my ocean. This would mean that in terms of the mesh i use for the ocean I will be making use of all of its vertices. A really cool method that was also mentioned in the article about the tech behind assassins creeds oceans that inspired me to start this (Assassins Creed Tech Article).

In the image below you can see what i have to do to get this method to work, not only to i have to project onto this invisible plane, but have to account for what to do if the projection does not hit the plane. So all i have to do is reflect the vector off the roof and fire it back down, some fun little math to get this working.

Accidentally left my music on during the video posted below, so enjoy the Persona 3 sound track.

projection of plane

I even managed to take this further by using a really cool site called Desmos to form some equations to force vertices to cluster around the point of focus on the ocean, making even more efficient use of the vertices, meaning i no longer have half of them rendering parts of the mesh being projected onto the horizon. Below you can see the equations on the site and the effect of the clustering.

 

screenshot_Wed_May_25_17.03.49screenshot_Wed_May_25_17.12.50