Friday, September 1, 2017

c++ - Spaceship interiors: How to approach, implementation-wise?


I'm creating a 3D space game using Ogre3D for graphics with C++ and one of the features is to be able to freely wander around spaceship interiors, but I am lost with how to implement it. Here is what I can think of so far:



  • A single model of the spaceship that has an interior modelled too, but somehow double-sided and double-normalled? Not sure if this is possible!

  • Two models, one of the spaceship outside and one of the interior with flipped normals, when in game the interior model is placed inside the spaceship mesh, but that wouldn't be very flexible (different spaceship sizes, hull thickness etc)

  • Two models, when a player enters the space ship the screen fades and their view is switched to the inside model where the windows are live render textures of their respective place on the outside part of the spaceship, but it wouldn't be very optimised (rendering to several textures) and wouldn't have the gameplay aesthetic of smoothly entering or exiting (possibly via explosion) the ship



So, GameDev, how would you approach this?



Answer



The first option is what I would use. One model for everything. It's totally possible to have an interior and exterior of a model. Just like it's possible to have concave shapes. There's no double normals or double sided faces. Imagine a slice out of a crappy ship like this:


enter image description here


(I have no idea why the floor isn't flat, I only realized that after I posted it...)


Black lines are faces, red lines are normals. The surfaces wrap around. This allows you to have different hull thicknesses, blocking off interiors where the engines are, stuff like that. The doors are easy to place as separate parts (since you'll probably want to be able to move them anyway).


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...