![]() |
|
|
Simple Scene CreationFrom $1Table of contentsNo headersThis is based on my tutorial series here: So, let's start. First of all go to your Visual3d.net folder and copy "Tech Demos" folder. Rename the copy to "Tutorial". Copy "World Launcher.exe" and rename it to "Launcher.exe". In this folder create a new file called "Launch.bat". Type in this: Launcher.exe -world=tutorial This will start our new project. Try it out by double clicking Launch.bat. A dialog should be shown, select Tech Demos and click Open World. If this works we had success with first step. Now open the csproj file inside of Tutorials folder. Inside of the World folder of your project open TechDemosWorld.cs. Now uncomment this line at the beginning of the file. ,new SceneInfo(typeof(SimpleScene)) Now open up Scenes/SimpleScene.cs. Make the first lines of the constructor look like this: InitialCameraPosition = new Vector3(303, 146, 156); InitialCameraFocusPoint = new Vector3(0, 0, 0); InitialSkyboxMaterialName = "Skybox/DarkStorm"; // Threatening"; InitialAmbientLight = new VColor(0, 0, 0); First line changes the Cameras Position, second changes the point the camera looks at. In third line we change the Skybox to something darker and in the last line we set the environment colour to black. Which gives the scene a very dark feeling. Next in protected override void OnLoadStaticContent() change the first statement to look like this: Terrains.InfiniteTerrain.SetSceneTerrain("TheDesert.InfiniteTerrain.xml"); Now build the project. A DLL is created by Visual Studio. To use it just run our "launch.bat", select our world and you will get into the new main menu. The first entry is now "Simple Scene". It looks like this:
Select "Simple Scene" and click start scene. You should see the final result, only made by code:
My idea for this little tutorial was to do a little "Game with a jet". First of all open simple scene.cs and uncomment the line setting up our terrain. We will set it up in Architect now. Okay, let's start with the design of a basic game world... Run the sample from the last part, and when you are in our scene press F3 to open Architect(If this doesn't work, just press it again...).It should look something like this: This is Architect, Visual3d.nets world editor. So, to make a scene like the one in the picture follow this steps(all steps are shown in the red boxes in the pictures as well):
The jet should have moved in front of the camera, so that you are able to see it clearly. Your scene should now look like mine. Click the Save button at the top of the screen to save the whole thing.
Now we will do a little scene cleanup and prepare our main menu.Start architect and select World Explorer. All scenes are listed. Delete all of them expect "MainMenu" and "Simple Scene". During my tries I was not able to delete Dialog Test Demo, but at the moment don't know how to delete it by hand. Now in World Explorer open Main Menu scene. At the top of the screen select design mode, which will give you editor capabilities. If wouldn't have done that, ever when you select an object by cursor, you would have marked this object as your current player. Since we do not want to mark them, but edit them, we need this new mode. Select the two robots and delete them. Now drag and drop another F38Jet and move it to cameras position. You can also edit the terrain if you want. Now save the scene. Next go back to TechDemosWorld.cs and search for this line. new SceneInfo(typeof(MainMenu)),[1]hover over the MainMenu and right click now, click show definition. Now in protected virtual void AddSceneContent() [2]uncomment everything. We don't need it anymore since we setup our whole main menu scene in Architect(Note: Our scene, not our menu!). Find this line static public string MenuTitle = "Visual3D.NET Tech Demos";[3]and change the value to something you like. If you want you can change more values, the code is pretty easy, so if you are a programmer you shouldn't have a problem. Now in TechDemosWorld.cs make protected override void AddScenes() look like this: protected override void AddScenes() { this.Scenes.Add( new SceneInfo(typeof(MainMenu)), new SceneInfo(typeof(SimpleScene)) ); } So, we now only load what we need. so, if you now load our scene you should see the jet waiting for you. You can use it by clicking on it. Use WASD to navigate and mouse to steer. Left mouse button to fire a projectile. So, what is this now? Is it a real game? SURE NOT! The main goal for this game was to provide a useful starting point for you as developer. We didn't do advanced stuff, but we did a mixture of using Visual3d.nets toolset and coding using Visual Studio. And now I will answer one question that popped up when doing the main menu: Why didn't you just add a little button to load your scene? Actually answer is pretty easy: All scenes are defined somewhere in Visual3d stuff and the demos Main Menu gets every scene out of it and creates an option for it. So, if you would add another scene to the game it would just pop up in Main Menu after creating it.
Tags:
none |
Powered by MindTouch Deki Wiki |