DigitalHax Posted March 29, 2012 Share Posted March 29, 2012 Hey everyone. I am looking for creating a lua weapon script for long term use. I want to be able to have them loaded in the editor and picked up on the hit of a key. I have seen the power tutorial with gamelib to load weapons. But I am not to keen on using it. Now I understand a few people are developing something similar, like the lua weaponwerks. One example I know of is pixel perfects weapon system. Something like that would be just what I need. If anyone knows anywhere I can get started(i am not that great with lua) or provide some basis would be great. Thanks in advance. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
smashthewindow Posted March 29, 2012 Share Posted March 29, 2012 I highly doubt creating a weapon system is hard. Just create a class that holds information on damage, range, fire mode, etc. Then you would need to create basic state machine system for fire, reload, or whatever else you need. Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
dennis Posted March 29, 2012 Share Posted March 29, 2012 There was already someone working on a weapon system called weaponwerks, why not waiting for that ? maybe you should get started with some variables and place holders, as smashthewindow said: damage fire range fire mode. and give every weapon it's own variables off-course for example: function m4a1() [indent=1]Damage = 10 -per bullet[/indent] [indent=1]FireRate = 300 -- per minutes [/indent] [indent=1]Range = 400 --in meters = realistic[/indent] [indent=1]FireMode = 3 --single, burst, automatic[/indent] and such... cheers Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted March 29, 2012 Share Posted March 29, 2012 There was already someone working on a weapon system called weaponwerks, why not waiting for that ? Don't wait for this. If it ever gets finished it will be a while. No offence to the creator of weaponwerks intended. He is busy studying or something I think. Smash has it right. Do it like that, make a weapons class with a base class which holds everything common to every weapon. Then make sub classes which inherit from the base class that have more detail specific to weapon types. 1 Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Pixel Perfect Posted March 29, 2012 Share Posted March 29, 2012 I would agree with most things that have already been said regarding this. I would however recommend just jumping in with both feet and designing as you go. You are going to change this many times as you progress and unless you have experience of this previously then designing up front is often not the best way as you will be unaware of many factors. Learning this way will teach you loads and is more likely to get you to where you want to be than having someone hand you code for their system. Once you have arrived with a system that meets your requirements you can refine your code, but yes, keep it object oriented as that will make your life so much easier. Some key aspects for consideration are: An easily configurable way of loading weapon data including the associated animation data A way of identifying which weapon types can be used by whom What the current selected weapon is, what state it is currently in, what animation is currently required, what sound file needs to be playing and the associated logic for controlling all of this An associated damage system which is dependant on the weapon and type of ammo Maintaining real time counts of ammo, clips etc A weapons acquisition system (picking up weapons or ammo you can use in your level) 1 Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
dennis Posted March 29, 2012 Share Posted March 29, 2012 Don't wait for this. If it ever gets finished it will be a while. No offence to the creator of weaponwerks intended. the systems he is creating would be very useful. easy to configure. and this summer he will be working on it. also now it's spring, in a matter of a few months (2) it will be summer. Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted March 29, 2012 Share Posted March 29, 2012 ... and what if Tyler decides to spend his vacation doing something else? I agree with Pixel and Ken, make a start yourself its all good experience. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
DigitalHax Posted March 29, 2012 Author Share Posted March 29, 2012 I would be already be into creating my own weapon system now, except I don't know almost anything about lua. Especially things like making classes etc. I just dont have the knowledge about lua to make something like this. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted March 29, 2012 Share Posted March 29, 2012 well, if you are not writing your game in lua dont use lua? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
dennis Posted March 29, 2012 Share Posted March 29, 2012 Tyler said he would be working on it in his vacation. and if he don't then it's his choice and we will have to respect that. I also can't wait for it so I will sturgle with those weapons myself, if it will work for me then I don't need Tyler's script. when it doesn't work out for me I just use his, analyse and then use it to empower my knowledge Quote Link to comment Share on other sites More sharing options...
DigitalHax Posted March 29, 2012 Author Share Posted March 29, 2012 Uh I am only thinking of using lua for use and placement in the editor easily. But I am using C++ mostly. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Pixel Perfect Posted March 30, 2012 Share Posted March 30, 2012 I would be already be into creating my own weapon system now, except I don't know almost anything about lua. Especially things like making classes etc. I just dont have the knowledge about lua to make something like this. So drop Lua for something like this and do it in C++. Game development is hard enough as it is, you really need to work from your strengths. Put some time aside, if you can, to develop your Lua skills and you'll have more flexibility in the future. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
DigitalHax Posted March 30, 2012 Author Share Posted March 30, 2012 I'm just thinking that how could I possibly have placement in the editor with this? I would have to spend ages messing with XYZ space to position all. No matter how much I want to use C++ I cant make a level in it. By the way pixel I'd like to see about how your one works. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Brent Taylor Posted March 30, 2012 Share Posted March 30, 2012 I'm just thinking that how could I possibly have placement in the editor with this? I would have to spend ages messing with XYZ space to position all. No matter how much I want to use C++ I cant make a level in it. By the way pixel I'd like to see about how your one works. I think you're misunderstanding things very slightly. While Lua can be used in the editor, that is generally used for quick tests, not for actually building your game. Furthermore, if you're building your game with C++, generally lua is used strictly to script entity behavior. If you're using C++, you can load levels created in the editor. Check the documentation. Specifically here. Quote There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?" Let's make things happen. Link to comment Share on other sites More sharing options...
DigitalHax Posted March 30, 2012 Author Share Posted March 30, 2012 I know that, and in my C++ programming I have been loading the scenes made in the editor. But if I want to have things put in my scenes, I don't really see any other option than using lua for scripting. I wouldn't really make sense to spend ages positioning things coded in cpp, only to be able to drag and drop lua into it. There is just not that interaction between main code and scenes you make. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted March 30, 2012 Share Posted March 30, 2012 Much like lights etc., that you can place in the editor, you could create a (pretty much) null entity that you can place in the editor and set its keys etc. You would have to code your own 'Load Scene' function so that when it comes across one of these objects it simple creates an instance of your ammo class and places it there... However, the above would work, I wouldn't do that myself... The way I do it is to make the game and have all positions in a database (SQlite) then while im in game (Debug Build only) I can press a button that makes the game go into dev mode which allows me to move things around. Then when I'm done it re-saves all the new positions into the database so next time it will be right. Its sort of an editor but more like a visual database editor. My UI system works like this too. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
DigitalHax Posted March 30, 2012 Author Share Posted March 30, 2012 Okay, SQLite. Now how can I incorporate this? But that is the sort of thing I am thinking of. Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted March 30, 2012 Share Posted March 30, 2012 Okay, SQLite. Now how can I incorporate this? But that is the sort of thing I am thinking of. Carefully..... I'm serious..... That's the only way I can describe it in a single post. Go to http://www.sqlite.com/ and try figure it out. Personally I think you're jumping the gun. You need to do something simpler first. The kind of stuff that I'm talking about is not particularly easy to implement, In the short term it is a longer path and more difficult that simply adding in some XYZ's. The SQLite method is... yes really good because it makes things easier in the long run.... but takes a while to set it up and to figure out how you want your code to flow around it. And not to mention there is not step by step way of doing this. you have to do it in the way that works best for your game..... now if you don't have much experience with this kind of thing then chances are you're going to re-code it a number of times to work nicely. Although, it's not rocket science either... its definitely not a starting point. I would suggest for now... just place objects in the editor... look at their XYZ's and then hard code those XYZ's into your C++... just for simplicity sake that is. Yes it may be annoying to do that but seriously just do it or risk bear trapping yourself. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Pixel Perfect Posted March 30, 2012 Share Posted March 30, 2012 Ken is right, that's essentially how I've handled the weapon acquisition side. In my case I place ammo clips and guns (actual models) in the editor scene which have properties associated with them (but it could just as easily be a pivot as a generic place holder). When the scene is loaded these items effectively sit there until my player comes across them where upon as a result of ray casting the items are identified and then, and only then, does anything happen in terms of instantiation of objects. No need to create object instances that may never be used ... by creating them during loading! The player may never find them or may already have that gun or a full set of ammo. The models are simply hidden at this point then subsequently destroyed and if it's ammo then ammo counts against the player updated or if a weapon then an instance of that weapon created and associated with the player. All the associated data for the weapons and ammo will already have been loaded as part of the initialisation of the game. In this way my game engine can acquire anything, as the player comes across them, as the objects identify themselves and my engine knows how to handle each type of object. The game engine actually has no idea what is in the level or where. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted April 2, 2012 Share Posted April 2, 2012 a "dummy" placeholder of your weapons can be used in the scene editor... and you can place em where you want... then, when the scene is be loaded (in c++) it can be parsed to find your weapons... then behaviors can be "attached" to em... all you need to do for the dummy weapons is to define the appropriate keys so the program can find em... --Mike 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.