Jump to content

ZioRed

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by ZioRed

  1. Good luck with your new game! I'll be glad to follow your progress on your blog ;-)
  2. You cannot use 2008 with the new headers because it requires framework 4.0, so you must use 2010. You should just try with C# 2010 Express.
  3. Of course your project build platform is set to x86, right? I'll try to find a PC with VS10 Ultimate, even if it's a bit strange that the difference of VS family in the same version could create such issues but it seems to be the only difference between our systems.
  4. Sorry but I finished my ideas about your scene loading problems, have you tried to use the express version of VS 2010 instead of Ultimate (or use another folder for the compiled+medias like "C:\TEMP")? Or also running directly the compiled EXE instead of start debugging? I know this is odd but I don't know what to try next because I have no issues with that code and your sbx. Gravity vector is not initialized from default (even if I read somewhere in the forum that a ~20 gravity is already set by default internally in the engine), so you should initialize yourself with a new Vector3(0,WHAT_YOU_WANT,0)
  5. You could try to set the full path into a variable and debug its value, may be it returns a null or empty value so the engine LoadScene fails. After this I cannot see more possible issues (can you attach your sample not working project solution and demo.sbx?). // After initialize try/catch string path = FileSystem.GetAbsolutePath("abstract::demo.sbx");
  6. Have you tried using "\" instead of "/" in the AbstractPath?
  7. Really strange, I have win7 x64 and have no problems. Are you using C# 2010 express english version with a project targetted for 4.0 clients?
  8. The following code works without issue for me (I use the latest headers and the official 2.40 engine.dll, not the custom one available in the download section): namespace TestLeadwerks2Console { class Program { static void Main(string[] args) { try { Engine.Initialize(DisplayMode.Window, 800, 600); Framework.Initialize(); FileSystem.Initialize(); FileSystem.AbstractPath = "C:/Leadwerks Engine SDK"; } catch { Engine.Terminate(); } Scene scene = new Scene("abstract::test.sbx"); while (!(Window.HasRequestedClose || Keyboard.KeyHit(Key.Escape))) { Framework.Update(); Framework.Render(); Graphics.Flip(); } Framework.Terminate(); Engine.Terminate(); } } }
  9. You should use Scene class and not Core.LoadScene
  10. I hope more people will be allowed to view and if needed fix the source of the new headers (also these are the cases when it was useful the old Core namespace to call directly the engine functions and not only use the wrapped classes).
  11. Are you sure that your emitter doesn't work? At first glance you are using a one-shot emitter, so may be it's "quick" and you don't see it, try to using a looping ones, the following code works for me: TFramework fw = CreateFramework(); TCamera camera = GetLayerCamera( GetFrameworkLayer(0) ); TModel crawler = LoadModel("abstract::crawler.gmf"); TModel crawler2 = LoadModel("abstract::crawler.gmf"); MoveEntity(crawler2, Vec3(-2,0,0)); TMaterial mat = LoadMaterial("abstract::dust.mat"); TEmitter emitter = CreateEmitter(50,3000,Vec3(0,4,0)); PaintEntity(emitter, mat); SetEmitterRadius(emitter,0.005,0.1); PositionEntity(emitter, EntityPosition(crawler)); EntityParent(emitter, crawler); PositionEntity(camera, EntityPosition(crawler)); MoveEntity(camera, Vec3(0,0,-3)); flt mx = 0, my = 0; HideMouse(); TVec3 camrotation = Vec3(0); while( !KeyHit() && !AppTerminate() ) { mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; camrotation.Y=camrotation.Y-mx/10.0; RotateEntity(camera,camrotation); if (KeyHit(KEY_C)) { mx = 0; my = 0; camrotation = Vec3(); PointEntity(camera, crawler); } if (KeyHit(KEY_X)) { TEmitter newEmitter = CreateEmitter(50,3000,Vec3(0,4,0)); PaintEntity(newEmitter, mat); EntityColor(newEmitter, Vec4(0,0,1,1)); SetEmitterRadius(newEmitter,0.005,0.1); PositionEntity(newEmitter, EntityPosition(crawler)); MoveEntity(newEmitter, Vec3(0, 0, 2)); EntityParent(newEmitter, crawler); } TVec3 pos = EntityPosition(crawler); if (KeyHit(KEY_D)) pos.X += 0.5f; if (KeyHit(KEY_A)) pos.X -= 0.5f; if (KeyHit(KEY_W)) pos.Y += 0.5f; if (KeyHit(KEY_S)) pos.Y -= 0.5f; if (KeyHit(KEY_Q)) pos.Z += 0.5f; if (KeyHit(KEY_E)) pos.Z -= 0.5f; PositionEntity(crawler, pos); UpdateFramework(); RenderFramework(); Flip(); }
  12. Yes I tried your code both on C# and in C++ and it seems to be bugged in the wrapper, I wanted to try passing global position (of the cube which I moved with cursor keys on the screen) but unfortunately only now I see that GlobalPosition is no more a member of Entity class so I miss a way to get global/local position of an entity.
  13. I tried now with LE 2.40 (don't know if 2.28 has the same code because some functions were changed from 2.3x e.g. UpdateController, however I haven't pre-2.30 to test) the tutorial code from the last 2 pages and it worked for me with no exception: #include "engine.h" int main( int argn, char* argv[] ) { Initialize() ; RegisterAbstractPath("D:/LE/2.40"); SetAppTitle( "ConsoleC" ) ; Graphics( 800, 600 ) ; AFilter() ; TFilter() ; //Create a world if (!CreateWorld()) { MessageBoxA(0,"Error","Failed to create world.",0); goto exitapp; } //Create a camera TEntity cam=CreateCamera(); CameraClearColor(cam,Vec4(0,0,1,1)); PositionEntity(cam,Vec3(0,2,-10)); //Create a light TLight light=CreateDirectionalLight(); RotateEntity(light,Vec3(45,45,0)); Collisions(1,2,1); Collisions(1,3,1); Collisions(2,2,1); //Create a render buffer TBuffer buffer=CreateBuffer(800,600,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); Collisions(1,1,1); TModel scene=LoadModel("abstract::tutorial_spectator.gmf"); if (!scene) { MessageBoxA(0,"Error","Failed to load mesh.",0); goto exitapp; } EntityType(scene,1); TModel model=LoadModel("abstract::oildrum.gmf"); if (!model) { MessageBoxA(0,"Error","Failed to load mesh.",0); goto exitapp; } EntityType(model,2); SetBodyMass(model,1); for ( int n=1; n<=100; n++ ) { model=CopyEntity(model); PositionEntity(model,Vec3(random(-5,5),random(5,15),random(-5,5))); RotateEntity(model,Vec3(random(0,360),random(0,360),random(0,360))); } //Create the spectator TBody spectator=CreateBodySphere(); SetBodyMass(spectator,1); SetBodyGravityMode(spectator,0); SetBodyDamping(spectator,1.0); EntityType(spectator,3); PositionEntity(spectator,Vec3(0,2,-10)); TVec3 camrotation=Vec3(0); float mx=0; float my=0; float move=0; float strafe=0; HideMouse(); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); //Main loop while(!KeyHit(KEY_ESCAPE)) { DebugPhysics(KeyDown(KEY_P)); //Camera look mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; camrotation.Y=camrotation.Y-mx/10.0; RotateEntity(cam,camrotation); //Camera movement move=KeyDown(KEY_W)-KeyDown(KEY_S); strafe=KeyDown(KEY_D)-KeyDown(KEY_A); TVec3 force = Vec3(strafe*10.0,0,move*10.0); force=TFormVector(force,cam,0); AddBodyForce(spectator,force); //Update the world UpdateWorld(); //Position the camera PositionEntity(cam,EntityPosition(spectator)); //Render the scene SetBuffer(buffer); RenderWorld(); //Render lighting SetBuffer(BackBuffer()); RenderLights(buffer); //Swap the front and back buffer Flip(); } exitapp: return Terminate(); }
  14. Yes it is Timing.Time and you have to call Timing.Update() before Framework.Update() in your loop, as described here.
  15. Ok found the problem, you set playerHeadPosition as reference to playerController.Position and not a copy of it, so the last line of your update is not producing what you would mean (that is add an offset to ONLY head position) but it apply the operation to playerPosition (that is reference to playerController.Position as well). To fix your problem you can just clone playerController.Position into playerPosition in your updatePlayer() : ... //controller input playerController.Update(playerRotation.Y, playerMove * 3, playerStrafe * 3, playerJump, 500); playerPosition = playerController.Position.Clone(); playerHeadPosition = playerPosition; playerHeadPosition.Y += 1.8f; ... EDIT: I'd suggest to convert these variables into readonly properties in your class (since you would use them only to read and also add specific methods to move/rotate head or position if you need): class cPlayer { // ... public Vector3 PlayerPosition { get { return playerController.Position.Clone(); } } public Vector3 PlayerHeadPosition { get { Vector3 pos = PlayerPosition; pos.Y += 1.8f; return pos; } } // ... }
  16. I tried the use of World.Current.Gravity and it seems to work normally: using System; using Leadwerks; using Math = Leadwerks.Math; namespace TestLeadwerks2Console { class Program { static void Main(string[] args) { try { Engine.Initialize(DisplayMode.Window, 800, 600); Framework.Initialize(); FileSystem.Initialize(); FileSystem.AbstractPath = "C:/Leadwerks Engine SDK"; } catch { Engine.Terminate(); } Collisions.Set(1, 1, true); Scene scene = new Scene("abstract::test.sbx"); scene.CollisionType = 1; Vector3 debugGravity = new Vector3(0, -20, 0); bool gravity = false; Vector3 start = new Vector3(-1, 1, 0); Controller ctl = new Controller(); ctl.CollisionType = 1; ctl.Position = start; Camera cam = Framework.Layers.Main.Camera; cam.Position = ctl.Position; cam.Move(new Vector3(-2, 0, 0)); cam.PointAt(ctl); Debug.Physics = true; while (!(Window.HasRequestedClose || Keyboard.KeyHit(Key.Escape))) { if (Keyboard.KeyHit(Key.G)) { gravity = true; World.Current.Gravity = debugGravity; } else if (Keyboard.KeyHit(Key.H)) { gravity = false; World.Current.Gravity = 0; } if (Keyboard.KeyHit(Key.) { ctl.Mass = 1; } else if (Keyboard.KeyHit(Key.N)) { ctl.Mass = 0; ctl.Position = start; } cam.PointAt(ctl); Framework.Update(); Framework.Render(); Draw.Text("Gravity: " + (gravity ? "Set" : "Not set")); Graphics.Flip(); } Framework.Terminate(); Engine.Terminate(); } } } May be something in your LUA script? Could you show the controller code? PS: Isn't the gravity already set in the engine to something similar to Y -20 by default? At least on C#headers I don't need to manually set the gravity, just need to set the Mass to the bodies, if you don't really need to adjust more the gravity.
  17. Gratz mate, have a good experience and give my greetings to uncle Bill
  18. Yes I agree that a deeper management of the scene loading should be implemented, e.g. Unity's Application scene loading methods seem useful for this and it would be nice if we had something similar too (loading async/additive and get loading progress percentage).
  19. I think they are accounts for spider search bots to index Werkspace.
  20. Well in my opinion the simplest games at all are cards and boards, something like solitaire, poker, monopoly, since they require very few graphics (that is a programmer could do it completely by himself without buying models) and lower AI (I think). Just now I'm working on a board game, but unfortunately not with LE because I think that a SM3 card is really too high/expensive for a board game, so I had to stick with an engine with lower requirements.
  21. This function raises stack overflow for me too. The info on the wiki has been added from Lumooja but no examples given, is it an undocumented function/next feature? I remember Lumooja said that such function should be done before or after. Have you tried using "EntityViewRange(scene, VIEWRANGE_INFINITE, 1)" having other models in the scene which are not those which give you the issue? It's strange because it works for me in a sample scene with a house.
  22. Well I expect that the AppTime is calculated only once per update and then cached and it should return the same result per frame, so I think it's the same as performance. Also for the second question I say that it's the same as performance since you're not doing any operations on the Vec3 except the initialization with default values. At the end it's just matter of taste, I'd prefer to instantiate a variable in both cases just because if tomorrow I have to change their value it should be done on a single line and not 3+
  23. Well, after thinking that all the objects in the scene loaded with LoadScene are children, I tried your code with "EntityViewRange(scene,3,1);" (whose third parameter is recursion) on a sample scene with a house on a terrain and it works, when I move far away from the house it is ever visible, so make sure you have the latest 2.4 engine/newton/shaders.pak
  24. It really seems issue with view range, in your previous code you called (now commented): EntityViewRange(scene,3,1); But it is not intended to be used in that way, you should cycle through all the scene entities/children and call EntityViewRange for each of them and not just to the scene. But since you are using a SBX and calls LoadScene then I think it's easier if you set the view range to INFINITE directly from the editor interface for each object.
  25. What is the "server console" in that ball example? It creates a window as usually (there is still a call to Graphics())
×
×
  • Create New...