Jump to content

Joshua

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by Joshua

  1. Not sure if it is the best idea to revive this older thread however the template project has gone many architectural changes over the last few months. I wanted to get some exposure on the existing features before I continue to diverge with further support. The framework is pretty solid and clean. Any feedback is welcome. I have not merge modifications into master as this will be breaking so make sure to pull the develop branch at this time. The new project features the following: A new service called AppController which takes control of your applications execution pipeline from startup, running and shutdown. A lightweight dependency injection framework known as Container. Added sqLite dependency as a database storage option (no interface yet). Added squirrel script support (no interface yet). Added LuaTables++ to make lua script serialization and deserialization very simple. Cleaned up StateManager class, utilizing generics for state manipulation. Added an optimized Leadwerks isosurface generator with a modeler utility to help manipulate your voxel data. A fully functional and expansive entity component system with several example components. There are also two example entities that are available that use the existing components as an example. Cleaned up EventManager with a handful of sample events. A great example of their use can be seen in the StateManager.
  2. Cassius, you are absolutely correct. You do not need the interpreter code that comes within the app.cpp file of a new project. I think it is there in case you would like yo utilize lua within your c++ application. When I upgraded from 3.2 to 3.5 I replaced the app.cpp file with my own and have had no problems. Just for simplicity, here is a copy of my current app.cpp file. ** EDIT ** To preserve formatting, I posted my source file on dpaste. It can be found here: http://dpaste.com/2DWKQ6W
  3. I made a post a while back about using c++ and Leadwerks which can be found at the following link. I have been working on the project however, I just have not had the time to post my changes recently. http://www.leadwerks.com/werkspace/topic/12666-leadwerks-and-c
  4. If you want to get to your directory structure easily, you can open the Leadwerks level editor, Select 'File -> Project Manager. You then clan 'double click' on your project. A windows explorer window will open, at your projects root directory.
  5. I currently develop for Leadwerks 3.5 in VS2015. Visual Studio can open and work with previous .csproj and or .sln files with having to convert the project. Visual studio will also use the compiler for the previous version(s) as long as it is installed on your machine. Keep in mind that VS2015 will create a .vs directory within the same directory as your solution. If you are using version control, make sure to update your .gitignore.
  6. Whoops, my apologies. I run Leadwerks on my laptop, and do not alweays have it connected to the wifi so when I check at the time of my post, I must have still been running 3.4.
  7. To give you a little more information here, When you launch Leadwerks Game Engine from Steam, the level editor should show up. Under the File menu, you should see an option called ' Project Manager', or something similar. When yuou select that, you can use the create new project button to create a new project. After you choose to create a new project, you will be able to specify whether you want a Lua or C++ project, the directory you want to store your project in, The creator's name, Copyright information etc. When you confirm the creation of your new project, it will be added to the project list of the Project Manager. If you double click the project name, a windows explorer window will open to the directory of your project. Inside the Project's directory, you will find solution folders for Linux and or Windows. The .sln file under the windows directory is the solution you will open in visual studios.
  8. There are two ways I would approach a solution. 1. If you really want an Arc effect, you would want to use something like AddForce. You could calculate your normal vector, indicating the direction you want your player to go, multiply it by your desired force, to launch your player in the direction of your calculated normal. I had a test-case of this when I was first messing around with bullets. 2. If effecting your character controller through the use of physics methods do not work, you can always accomplish this manually, in the same way that you move your character controller. You could calculate your normal vector, like above, only this time, you would apply your desired force over time using some basic trig algorithms to calculate your arc movement. Your player could still move normally however, the arc movement would be added to your character controller movement every frame, until your desired duration of affect is over.
  9. After a long while of inactivity on the forums, I wanted to take the time and share my boilerplate and base game application, in c++, for the Leadwerks game engine. The source can be found here. This project uses V$ 2013, C++11 and Leadwerks 3.X. There are currently no external dependencies outside from the full version of Leadwerks Game Engine, on Steam. If you have any problems setting up the application just let me know. I will gladly assist in any way possible. You should be able to clone/download the repo, drag in the Leadwerks asset folders, and be on your way! What it includes: Base Game Object Input Manager State Manager Camera Manager Planned enhancements: Event Management Network integration with Steam Voxel Management Game Object Management Weapons and Bullets Several generic C++ containers much much more The planned enhancements are actually already complete, I am just taking them out from my existing game application, cleaning them up, and adding documentation. I look to push changes to the public-facing repository bi-monthly. I would love to get some feedback about what you guys and gals think, whether you are using it in your projects, and or what you think the template could use. I will be posting notes on my IndieDB blog as well to follow my releases. P.S. The current template contains a simple example, demonstrating the use of the Game Object, Camera Manager, and how to switch between Camera Behaviors.
  10. Zancie, before Leadwerks 3.1, there were a bunch of tutorials that incorporated C++ development. If I can find them, I will send them your way. If you want to develop primarily in C++, your main source of information would be in the Documentation->Command Reference section of the page. This can be found in the nav-bar at the top of the page. Every officially-supported feature/functionality will be there with C++/Lua code examples. On a second note, I am working on a project programmed entirely in C++ with Leadwerks that is going to encapsulate developing a game project in Leadwerks from start to finish. The project will feature a Camera system, a Screen/State system, a Resource system, networking system etc... that can be expanded upon and used for a variety of other projects. At the completion of the project, there will be accompanying documentation that will outline the development life-cycle of the project (not necessarily start-to-finish tutorials) however, information that people entering Leadwerks, or any game development suite can follow. On a third note, if you have questions, search the forums or ask existing developers. We are all very open and love to talk about game development and Leadwerks. I do stand-by my initial statement that a lot of development-related questions can be solved through researching the leadwerks API documentation. Happy Coding!
  11. Could you please share the code you use to create the new surface and add it to the model? There are some possibilities I can think of for the cause of your problem but without seeing this section of the source I would just be speaking without any real direction. I have been working with models and custom surfaces and may be able to help.
  12. Not currently. A static_cast would require the given cast object to be of a related class, ex, derived from Object to allow for up-casts or down-casts. I could allow my own game objects to inherit from the Object* class however, this is not entirely desired for my purposes. For example, I may want to pass in the current class instance to gain access to its contents for some kind of manipulation. Passing in the current class instance casted to an Object* to the thread entry point and casting it back to an instance of the appripriate class to call functions to interact with private or protected class variables is what I currently do, however I feel this is an unnecessary work-around. I think there should be a way in which I would be able to create a thread entry point from within a class which already has access to its private and protected members. For example. In my Scene class I have a std::vector of Chunk* objects. I want to be able to add/remove chunks from this std::vector in a separate thread because my scene can be from 1 to n chunks in size where n is limited to some finite number of chunks I want to be loaded at any given time. I want to be able to access the scenes std::vector directly, allowing me to add a new chunk without having to create a function outside the scope of my Scene class to add the chunk to the Scene std::vector.
  13. @Shadmar, your example above still uses a Free Function for the thread entry point. I am looking to use a Class Member Function as the thread entry point. Using a Class Member Function as the entry point for a thread would allow me to remove global scope variables from my source. It would also minimize the number of typecasting and the creation of new instanced objects needed.
  14. Did installing xterm on your system fix the breakpoint problems you were having in Code::Blocks? I have tried using Code::Blocks in the past on WIndows and Linux, even with xterm installed and was never really able to get good results while stepping through my source in Code::Blocks.
  15. How is it possible to use the Thread and Mutex objects with class object methods? I have only been able to figure out how to use the Thread and Mutex objects with free object methods. so instead of: Object* UpdateChunk(Object* obj) { mutex->Lock(); esChunk* chunk = (esChunk*)obj; chunk->Update(1.0f); mutex->Unlock(); return NULL; } // -------------------- // Updates the esScene. // -------------------- void esScene::Update(float deltaTime) { int index = 0; for(unsigned int x = 0; x < 2; x++) for(unsigned int z = 0; z < 2; z++) for(unsigned int y = 0; y < 2; y++) { if(m_chunks.at(index)->IsSetup()) if(m_chunks.at(index)->IsDirty()) { thread = Thread::Create(UpdateChunk, (Object*) m_chunks.at(index)); } //m_chunks.at(index)->Update(deltaTime); index++; } } // end void esScene::Update(float deltaTime) // ----------------------------------------------------------------------------------------- I can do this: Object* esScene::UpdateChunk(Object* obj) { Vec4* data = (Vec4*) obj; mutex->Lock(); esChunk* chunk = (esChunk*)obj; GetChunk(data.x, data.y, data.z)->Update(data.w); mutex->Unlock(); return NULL; } // -------------------- // Updates the esScene. // -------------------- void esScene::Update(float deltaTime) { int index = 0; for(unsigned int x = 0; x < 2; x++) for(unsigned int z = 0; z < 2; z++) for(unsigned int y = 0; y < 2; y++) { if(m_chunks.at(index)->IsSetup()) if(m_chunks.at(index)->IsDirty()) { thread = Thread::Create(UpdateChunk, (Object*) new Vec4(x, y, z, deltaTime)); } index++; } } // end void esScene::Update(float deltaTime) // ----------------------------------------------------------------------------------------- thread and mutex are global in this scope however, I would prefer to have them objects of the esScene class structure. I have tried to create a function pointer that resides inside the class, however, this option does not seem to work. It appears that I need an instance of the class in order to get the function pointer however, there seems to be a big difference in how object member functions and free functions are handled.
  16. @josh, is there a way to interact with the world octree structure directly? Maybe even extend the structure? I am not at my computer right now or I would look into this more thoroughly. I have some further questions about best practices when it comes to using models and surfaces however I will leave them until I can share some example code.
  17. I am currently working with the Model and Surface components of the Leadwerks API and I was wondering if there was any further documentation on the internals of these structures. When a model is created through Model::Create(), it appears that the model is automatically added to the world. When the model is added, does the model component use display lists and or vertex buffer objects? I remember seeing the ability to create these components directly, however, I was wondering if their implementation is automatic? I was also wondering if the Model and Surface objects are automatically culled when created. I've noticed that the surfaces are culled if not visible, however, I am curious if other occlusion is done automatically. I was also wondering if the Model and Surface components are processed and rendered in Leadwerks through Direct Rendering, or through the GPU and if it is possible to modify/change the rendering pipeline of Leadwerks. Any feedback is appreciated, especially if my initial assumptions are complete wrong. Thank you all in advance.
  18. You could always implement a CSGIsosurface to support real-time CSG operations. This is however an advanced option and will take some time to implement with Leadwerks. (Currently finding out the hard way).
  19. If you want smooth movement, you could use the Curve method that is a part of the Leadwerks Math library to return an interval between the current object's position and the desired object's position. My example is for the movement of a camera, but I think you can get the idea. ex. m_camera->SetPosition( Math::Curve(Position().x, m_camera->GetPosition().x, m_fCameraSmoothing), Math::Curve(Position().y, m_camera->GetPosition().y, m_fCameraSmoothing), Math::Curve(Position().z, m_camera->GetPosition().z, m_fCameraSmoothing));
  20. I calculate movement a different way than using SetInput(...). Each object in my game has an UP vector and a Right vector. The right vector is calculate every frame. the Up vector is assigned when the object is created. When I want to move my object forward or backward, depending on the rotation of my camera, I calculate the objects forward vector and move the object in that direction by a given speed. In the folowing code snippet, the view vector is a Vec3 indicating where the object is facing. The allowY variable limit the ability to move the object in the Y plane, based on the objects rotation. // ------------------------------------------------------------------ // Moves the object forward or backward depending on the given speed. // ------------------------------------------------------------------ void esMovableObject::Move(float speed, bool allowY) { // Get the current view vector. Vec3 l_vVector = m_vView.Subtract(m_vPosition).Normalize(); // Add the current view vector to the position. m_vPosition.x += l_vVector.x * speed; m_vPosition.z += l_vVector.z * speed; // Add the current view vector to our view. m_vView.x += l_vVector.x * speed; m_vView.z += l_vVector.z * speed; if(allowY) { m_vPosition.y += l_vVector.y * speed; m_vView.y += l_vVector.y * speed; } } // end void esMovableObject::Move(float speed, bool allowY) // ----------------------------------------------------------------------------------------- Here is an example of how I accomplish strafing with my objects. The m_vRightVector is updated every frame in the base object's update method. This is accomplished from the following code. // ---------------------------- // Updates the esMovableObject. // ---------------------------- void esMovableObject::Update(float deltaTime) { // Update the Right Vector of the esMovableObject m_vRightVector = -m_vView.Subtract(m_vPosition).Cross(m_vUpVector).Normalize(); } // end void esMovableObject::Update(float deltaTime) // ----------------------------------------------------------------------------------------- // ------------------------------------------------------------ // Moves the object left or right depending on the given speed. // ------------------------------------------------------------ void esMovableObject::Strafe(float speed) { // Add the strafe vector to our position. m_vPosition.x += (m_vRightVector.x * speed); m_vPosition.z += (m_vRightVector.z * speed); // Add the right vector to our view. m_vView.x += (m_vRightVector.x * speed); m_vView.z += (m_vRightVector.z * speed); } // end void esMovableObject::Strafe(float speed) // -----------------------------------------------------------------------------------------
  21. Very interesting because a Terrain size of 64 units works just fine. Just anything under 64 causes the application to crash. I was thinking that the Terrain Size dictated the surface area, however, it must just be the number of terrain patches along the outside of the Terrain. This is why a size of 64 works, because it has a surface area of 256.
  22. Thank you Josh! I didn't even see the heightfield header in the dependencies list at first. I also noticed that if I try to create a Terrain component that is less than 64 units, my Leadwerks application crashes. Is this supposed to happen?
  23. I have been working with the Terrain component in Leadwerks 3.0 outside of the Leadwerks Editor and I was wondering if anyone else has done any programming with the Terrain component in this manner. If so, I was wondering what might be the best way to go about manipulating the Terrain component. Possibly what the different methods in the terrain component do as well as the other components in the Terrain.h file. I am looking to render a 2-d array of Perlin Noise to a Texture object and then using this texture as a heightmap for the terrain. I have already incorporated libNoise into Leadwerks, I just have to write an interface for it to work with the Leadwerks Terrain component.
  24. I use the same method that Josh describes above. Right Click in the VS Solution Explorer->Select the 'Add Existing File'->Navigate to the Source directory->right click-> Create new Text Document.. I even put a shortcut to the Source folder in the Projects directory to make navigation a little easier.
  25. I am trying to do is take a Wall object that holds a linked list of Leadwerks::Entity and perform a 'slice' operation, vertically or horizontally at a specific location on the wall, splitting the wall into two sections, or more. I was able to achieve an effect of this nature by passing in a percentage to the slice method, creating a new Entity, resizing the existing Entity to the left portion of the wall, then resizing the new Entity to the remaining portion of the wall, where the overall size, shape, rotation and scale are determined by the Wall object. The problem I started to run into was if I wanted to slice into a Wall where there had already been slices, I would need to perform a rayCast at the slice position, from the top of the wall to the bottom of the wall, and perform the slice operation for every Entity the rayCast collided with. I have tried DudeAwesome's suggestion which was very similar to the method I described in my initial post, however my rayCast is returning False. My source for the SliceVerticle method is below as a reference http://dpaste.com/hold/1564912/ I have created several different versions of the SliceVerticle method and stored different iterations so it is possible that my mathematic calculations are wrong, or missing.
×
×
  • Create New...