Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CO1301: Games Concepts Worksheet 13: Prototypes - Space Set up the Exercise This exercise asks you to set up the earth and the moon. You can then extend prototype can including other planets and the sun. You are not expected to implement anything remotely realistic. If you attempted to create the solar system to scale them it would be impossible to see and boring to use. The primary purpose of this exercise is to introduce the idea of a model hierarchy and the dummy model. Models There are two specific models in the TL-Engine for this prototype: “Planet.x” and “Stars.x” The planet model is a sphere (radius = 1.0f) that has several basic skins to create all the main bodies in the solar system: “Sun.jpg”, “Mercury.jpg”, “Venus.jpg”, “Earth.jpg”, “Moon.jpg”, “Mars.jpg”, “Jupiter.jpg”, “Saturn.jpg”, “Uranus.jpg”, “Neptune.jpg” and “Pluto.jpg” There are also some additional and hi-resolution skins: “EarthHi.jpg”, “EarthPlain.jpg”, “EarthNight.jpg”, “EarthPlainHi.jpg”, “EarthNightHi.jpg” and “MoonHi.jpg” Use the stars model to create a skybox (it's still called a skybox even though it is a sphere). The radius = 100 and placed in your scene it will create a background of stars. This model also has some alternative skins: “StarsHi.jpg”, “StarClouds.jpg” and “StarCloudsHi.jpg” Functions You can use TL-Engine scaling functions to make models larger or smaller. This will allow you to use the same planet mesh to create models for the Sun, the Earth and all the other planets - you scale each one differently to create appropriate sizes. There is also another engine function SetFarClip that changes how far away you can see. In a space game you can see very far so this is needed, use it when objects are “clipped” in the distance: myCamera->SetFarClip( 100000 ); // Now can see up to 100k distant Space Prototype Begin by creating the Earth and the moon. Note what I've said about realism and place them close enough together so that you can see them both comfortably. You will have to scale the model down for the moon. Set it up so that the Moon revolves around the Earth. You can do this by using: CO1301 - Games Concepts Gareth Bellaby Lab Worksheet 13 Page 1 moon->AttachToParent( earth ); This is all well and good, but what would happen if you wanted the Earth to rotate at a different speed? The way things are set up at the moment the Earth must rotate around its axis at the same speed that the Moon rotates around the Earth. It is possible to set up the scene so that the Earth and the Moon rotate at different speeds and this is by introducing a dummy model: "dummy.x". You load and use the dummy model in exactly the same way as any other mesh and model. The difference is that the dummy is never rendered: it is just an invisible point in space. Create a dummy model at the same location as the Earth. Attach the Moon to the dummy instead of the Earth. Now you can rotate the Earth separately from the dummy (and hence the Moon). The Solar System Continue by creating a mini solar system. Add the sun at the origin. Add a few planets around the sun and scale them to different sizes. You don’t need to worry about getting the sizes of the planets correct, just try to make it look interesting. Make the planets orbit in a realistic way (they rotate around the sun and spin on their own axes). You will need to think about using parenting and dummy objects, in a similar way to the pool prototype. You will need to think carefully about the scales and distances that you use. Try to make a your scene look good but feel suitably large without being impossible to navigate. For future reference. You are formally building an animation hierarchy. Your program uses the same concepts and general form that you would to build the an animation hierarchy for a person, for example. See Frank Luna, Introduction to DirectX, Chapter 15 where he builds a similar hierarchy for the solar system but also for a robot arm. Space Collisions Load up and create a spaceship. The model can be found inside "spaceship.zip" on the website. Make the spaceship big enough to be seen. Implement movement for the space. Remember to set this up local to the spaceship. Implement collision detection and collision resolution for the spaceship and the Earth. Use a sphere for the spaceship and check for sphere-to-sphere collisions. Just to remind you: o Calculate the vector between the two sphere centres (model positions) o Get the length of this vector (the distance between the models) o If this distance is less than the sum of the sphere radiuses then there is a collision Look the lecture notes for week 12 for how to implement collision resolution. Build a chase cam for the spaceship. You can refer back to the airplane exercise for how to do this. CO1301 - Games Concepts Gareth Bellaby Lab Worksheet 13 Page 2