Calimaw Posted April 25, 2010 Share Posted April 25, 2010 I'm really not sure where to begin, so I may not even ask the right questions; please assume I know nothing, as that's probably the case. I'm wanting to start with getting an environment loaded from a sandbox map, including water and environment lights, textures ect, but I'm completely new to setting anything up to work with C#, the project configuration utility doesn't seem to have any templates for C#, which is confusing to me because I thought it was officially supported. If some one could take the time to help me set things up by provide an 'idiot tutorial' I would greatly appreciate it. In return if there are projects you may be working on that require sound effects and or music I am also available to provide my services; as I that is my forte. I'm attempting to pull together some very basic code to run an environment and populate it with my audio work. Quote Link to comment Share on other sites More sharing options...
cassius Posted April 25, 2010 Share Posted April 25, 2010 check out the tutorials on the wiki such as the character controller tutorial. They are written in c so you should have no problems converting to csharp. Start with a simple level at first the learn from it. Only a minority of people are using csharp and the header files are third party designed.But you will find example code on this forum. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
ZioRed Posted April 26, 2010 Share Posted April 26, 2010 The following are the simple steps to begin a new C# project for LE (I'm building a project template to add to the solution wizard or even on ProjectWizard if he likes): 1. Open the IDE (Visual C# Express or Visual Studio) 2. Create a new Console or Windows Forms project 3. Add reference to the Leadwerks.dll wrapper (download the latest from here) 4. In the main procedure (or where you want to start the game) write the following code (haven't tried but it is similar to what I'm using): // Graphics initialization Graphics.Initialize(800, 600); // Framework initialization (the parameter enables/disables LUA) Framework.Initialize(true); if (Framework.Layers.Main.World.Pointer == World.NullPointer) return; // Details process Texture.TFilterMode = 1; Texture.AFilterMode = 4; // Collisions initalization (to change as you need) Collisions.Set(1, 1, true); Scene yourScene = Scene.Load("abstract::YOURMAP.sbx"); yourScene.CollisionType = 1; while (!Leadwerks.Window.HasRequestedClose()) { Framework.Update(); Framework.Render(); Graphics.Flip(0); } Engine.Terminate(); Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Calimaw Posted April 27, 2010 Author Share Posted April 27, 2010 @ ZioRed, Thanks a ton bro, thats just what I'm looking for! Let me know if you're needing any audio done for anything. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted April 27, 2010 Share Posted April 27, 2010 No problem, I'm happy to be useful and appreciate your offer, it may be useful nextly since I am planning something Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Calimaw Posted April 27, 2010 Author Share Posted April 27, 2010 Cool, you can message me on aim as CalimawMAP or Yahoo! as Wamilac if you don't get a hold of me on the forum. Is there a list of all the commands any where? I'm trying to figure out how to get the position of entities in the sandbox, I.E. the water plane. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted April 27, 2010 Share Posted April 27, 2010 Unfortunately the wrapper is not documented, but it is enough OOP to let you discover everything (I usually search the functions I need in the wiki for C++, then open the wrapper source and search inside for Core.TheSearchedFunctionName method to see what is the relative method call). For positions and rotation every Entity has the properties Position and Rotation, which are Vector3. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Calimaw Posted April 27, 2010 Author Share Posted April 27, 2010 Well, what Im trying to do is find the water plane in the scene, and then grab its position Quote Link to comment Share on other sites More sharing options...
ZioRed Posted April 27, 2010 Share Posted April 27, 2010 Try to use GetChild on your Scene object, you can pass it the property "name" that you assign to the object in the Editor (not sure if it is, maybe you should cycle through the Children array of the Scene to find what you want). Scene yourScene = Scene.Load("abstract::YOURMAP.sbx"); Vector3 waterPosition = yourScene.GetChild("YOUR_WATERPLAN_NAME").Position; Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Calimaw Posted April 27, 2010 Author Share Posted April 27, 2010 Thanks bro, I'm sorry I'm so ignorant, I really appreciate the help you're giving me, I'm learning C# as I do this as well and have very little experience with LW. Quote Link to comment Share on other sites More sharing options...
Calimaw Posted April 30, 2010 Author Share Posted April 30, 2010 How do I set the fluid plane? I have a mesh parented to a body and its floating mid air, I assume thats because the fluid plane is assumed to be at that position, but Im having trouble figuring out how to format the values correctly for Core.SetFluidPlane. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted April 30, 2010 Share Posted April 30, 2010 Have you setup the Mass (at least 1) and CollisionType (remember to initialize the collisions with Collisions.Set) of your body? Instead of using directly Core.SetFluidPlane you can use the OOP way of the wrapper with Fluid.SetPlane There is an example for C in the wiki, try that code (you have to convert from C to C# but it should be an easy task). Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted May 1, 2010 Share Posted May 1, 2010 You could also use the framework that comes with the engine (2.3+) to easily add water into your scene. Framework.Effects.Water.Enabled = True I find it alot easier than creating the water plane yourself! Quote Link to comment Share on other sites More sharing options...
Calimaw Posted May 1, 2010 Author Share Posted May 1, 2010 Im using Framework.Effects.Water.Enabled and have set its position in the scene (havent built a loader to do it for me yet), problem is, I create a mesh, which I parent to a body, and this body would 'float', or what looked to be floating (bobbing up and down a bit) at a different location than the visual location of the water, so I assumed that was the fluid plane, which Im unable to quite figure out how to set its position correctly. My water plane is at 0, 28, 0. In addition to this, when I set the physics body (the one with the mesh attached to it) to myBody.CollisionType = 1; while myScene.CollisionType = 1; and Collisions.Set(1, 1, true); with a mass of any amount the body will drop down with gravity for a brief moment, then shoot off in an unlikely directly very quickly and vanish from sight. Quote Link to comment Share on other sites More sharing options...
Calimaw Posted May 1, 2010 Author Share Posted May 1, 2010 Right now Im just playing with values and determining their ranges and setting stuff manually so I can better build a separate class to automatically create the scene for me, at which point I want to create a few entities for the sandbox editor so I can then add those to that class as well. I've not used C# in a long long time, nor did I use it very much when I did, so I'm learning syntax as well. I understand the logic at least Quote Link to comment Share on other sites More sharing options...
Calimaw Posted May 1, 2010 Author Share Posted May 1, 2010 Whats up with the editor not being able to render my sky? I select it like the default 'FullskiesBlueClear...' and it does a "hall of mirrors" no-draw effect. The *.mat file contains the following (it works correctly in the engine) texture0="abstract::sky.dds" clamp0=1, 1, 1 blend=0 depthmask=0 depthtest=1 depthmask=0 alphatest=0 overlay=0 zsort=0 castshadows=1 shader="abstract::skybox.vert","abstract::skybox.frag" Quote Link to comment Share on other sites More sharing options...
Calimaw Posted May 1, 2010 Author Share Posted May 1, 2010 Ah, never mind, for some reason it wasnt passing the correct location of the .mat file, solved for problems concerning the skybox in the editor. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.