-
Posts
7,936 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Rick
-
Here is what I do for timers in Lua. Below is usage: -- This is the timer method that gets called when the interval is up function MoveTimer(tmr, param1, param2) -- Can stop the timer if I want with the below code StopTimer(tmr) end moveTimer = {} CreateTimer(moveTimer, 50, MoveTimer) AddGlobalTimer(moveTimer, 10, "hello") -- call the below method in your main loop every cycle and it'll manage all the timers for you that you added to AddGlobalTimer() UpdateGlobalTimers() Below is Timers.lua file I add to my project function CreateTimer(tmr, interval, eventHandler) tmr.onTick = eventHandler tmr.lastTime = 0 tmr.interval = interval tmr.enabled = false end function StartTimer(tmr) tmr.lastTime = os.clock() * 1000 tmr.enabled = true end function UpdateTimer(tmr, param1, param2) if tmr.enabled == true then if (os.clock() * 1000) > tmr.lastTime + tmr.interval then tmr.lastTime = os.clock() * 1000 --if param1 ~= nil and param2 == nil then tmr.onTick(tmr, param1, param2) --else -- tmr.onTick(tmr) --end end end end function StopTimer(tmr) tmr.enabled = false end globalTimers = {} globalTimerCount = 1 function AddGlobalTimer(tmr, param1, param2) -- Store off the parameter inside the timer tmr.parameter1 = param1 tmr.parameter2 = param2 -- Add an index ID tmr.id = globalTimerCount -- Insert into global table globalTimers[globalTimerCount] = tmr globalTimerCount = globalTimerCount + 1 --table.insert(globalTimers, tmr) end function RemoveGlobalTimer(tmr) -- Setting to nil removes the entry from the table globalTimers[tmr.id] = nil end function UpdateGlobalTimers() for k,v in pairs(globalTimers) do UpdateTimer(v, v.parameter1, v.parameter2) end end
-
Yeah you need to branch your logic off based on if the enemy is dead or not.
-
Another update of GvB. Switched from real-time to turn based with a twist. Check out the LE video section link below! http://www.leadwerks.com/werkspace/page/videos/_/leadwerks-engine/gvb-4-r110
-
The "ideal" way for the editor is to give each model a lua file. The lua file needs to be the same name as the model and the editor will automatically associate the 2 together. Look at Scripts/Template.lua. This is a template file for your models. You can uncomment what you need. Look at some of the lua files in the Models directory to get example of how this should look. When you have a lua file with your model you can now bring up the properties to that model in the editor by dbl clicking it or right click properties on the tree view. The base lua script adds some default settings for you. Collision being one of these settings I believe.
-
Just place your gmf, dds's, and mat's in the Leadwerks directory and they'll show up. The name of the file will be listed on the right. To make subfolders in the editor you use underscores in your file name. The actual folders in your Leadwerks directory have nothing to do with the folder layout in the editor. So for example if you had 3 tress you'd probably want to group them so you might name them. tree_Eagle.gmf tree_Rick.gmf tree_Blah.gmf Note that you have to restart the editor each time you copy new gmf's to the Leadwerks dir for them to show up in the editor.
-
I gave it about 5 mins and I ended up with about 20 Some of those things really come flying at you. Escape didn't exit the game for me though. I tried spamming every key but must not have found the right one. Had to ctl-alt-del. Woot 66! I think I found a way to sort of cheat. When I pressed ` to bring up console I felt like I wasn't getting pushed around as hard and could last longer.
-
Nice. Those skeletons look really good. I'm excited to see what kind of race models you can make.
-
Sweet that worked, thanks! Forgot the ms conversion. I'll check out the forum doc on that parameter name also if not done already. Thanks again.
-
Dang docs say position for 3rd param http://www.leadwerks.com/wiki/index.php?title=Emitters#CreateEmitter I want it to be .2 actually but yeah missed that. I set my parameters in the editor first to get the look I'm after and trying to translate it to code. If you haven't figured it out by now I'm not very good at following directions This is the look in the editor and settings I'm generally going for. Just made this quick so not all settings like rotation are what I was looking for but it's the basic idea. http://dl.dropbox.com/u/1293842/EmitterTest.png So I must be missing something else because it's still not working when I make your changes.
-
I didn't overlook it I left it out on purpose because I didn't think it was needed. I just added the code to change worlds and I'm still not seeing anything. SetWorld(fw.transparency.world) object.iceEmitter = CreateEmitter(200, 1, EntityPosition(object.model, 1), 0, nil) object.iceEmitter:Paint(LoadMaterial("abstract::smoke.mat"), 0) object.iceEmitter:SetRadius(.1, 1) object.iceEmitter:SetColorf(112/255, 254/255, 236/255, 1) object.iceEmitter:SetWaver(2.0) object.iceEmitter:SetRotationSpeed(2.6) object.iceEmitter:SetVelocity(Vec3(0, 4, 0), Vec3(0, 0, 0)) object.iceEmitter:SetArea(Vec3(2.0, 2.0, 2.0)) SetWorld(fw.main.world)
-
oh really? OK I'll give the transparent world a try.
-
The world should be set. I can have emiiters in the base world right?
-
So in one of my model entities I'm trying to create an emitter and place it at the model's location but I don't see any particle effects. Wondering what I am missing? I used the firepit as an example. function class:CreateObject(model) local object=self.super:CreateObject(model) object.model = model object.iceEmitter = CreateEmitter(200, 1, EntityPosition(object.model, 1), 0, nil) object.iceEmitter:Paint(LoadMaterial("abstract::smoke.mat"), 0) object.iceEmitter:SetRadius(.1, 1) object.iceEmitter:SetColorf(112/255, 254/255, 236/255, 1) object.iceEmitter:SetWaver(2.0) object.iceEmitter:SetRotationSpeed(2.6) object.iceEmitter:SetVelocity(Vec3(0, 4, 0), Vec3(0, 0, 0)) object.iceEmitter:SetArea(Vec3(2.0, 2.0, 2.0)) end
-
LE3D isn't complete yet.
-
I've starting shifting a little into promoter now. Trying to get the word out about my game. I've started a blog and post to a couple various game sites. I've also requested a project at kickstarter.com to see if I can generate any money to help fund the game development. I've been purchasing art assets and it's starting to add up and kickstarter.com looked to be a perfect way to get some interested parties to help out if they wanted to. Added the following blog to my signature http://good-vs-bad.blogspot.com/ I feel like the game is coming along nicely and so I wanted to get a little more serious about it. Stepping outside the LE developer community and into the players world to see what they think. Scary B) I have 2 models being created for me which are visual aids for 2 abilities. Should get them by mid week and hoping to get them in the game by early next week. I'll make another video then.
-
Very cool!
-
Good call. If you had multiple instances of the model you wanted highlighted and applied the shader at run-time to one instance would they all get that shader applied? If so a possible side effect to the shader based methods.
-
Another play with the hightlighting using lighting could be to have the object in another world. When you mouse over it you hide the one in the base world and show the one in the highlighted world. You can then have a high ambient light in that world and it would stand out then. If you went this route creating a system to automatically do all of that on special objects would be ideal. This is sort of a world of warcraft deal as when you highlight things the lighting changes on the object to show it's highlighted.
-
You are correct. It's a trade off between those 2 things. You'd probably want your previous sbx map to stay loaded though so you can transition back to it fast and not have to save any states off from it so that you can return to it with all the things doing whatever they were doing. Then the "stores" or whatever can be loaded/unloaded at will.
-
You can have multiple maps loaded I think, but you can only have 1 (LE) terrain at a time I believe. I'm picturing your example being an RPG where you are in the open world with a terrain and you walk into a store and it loads another map and you are just in the store now and can't see the outside. Then when you leave the store it brings you back out to the map. You should be able to do that. There might be a noticeable load time though. I would assume these stores are their own models so you could have them in the same map as the outside world but maybe just underneath the terrain. That way everything gets loaded at once and your trigger is really just a transporter that instantly moves to the store model that's beneath your map. The player would never know and it would be instant.
-
I tend to agree with this. I've never had issues with a gun or body going into the wall a little bit. If your gameplay is good enough nobody will care, but I do know some people that go crazy when they see that happen.
-
I agree that I like more responsiveness from moving, but you would eventually still want to use blend. Just increase the blend value faster. Once you put it in it's kind of amazing how subtle yet nice it looks. About split animation. I have given that a go and when buying premade models I almost always find that they don't really look that good (it can functionally work) because the animator probably didn't have that in mind. The angles of the spine and legs generally don't look natural. I think to have split animation look really good the animators have to have that in mind when making the animation. Keep up the good work!
-
Nice tutorial. Noticed you are using a switch statement (not sure if it's just because of the tutorial to keep it simple) but a long time ago someone showed me how to get some easy C++ "events" working. When I use RakNet I always use this because messing around with a giant switch statement is a pain after it gets huge (which in networking and dealing with messages it generally does). Usage: class Server { private: // the message id is the key, and the event which I make take a packet and a bitstream is the data stored map<RakNet::MessageID, Event2<RakNet::Packet*, RakNet::BitStream*>> _networkEvents; // network event handlers. this becomes where you handle the network messages void OnNewIncomingConnection(RakNet::Packet* p, RakNet::BitStream* reader){} void OnRequestLogin(RakNet::Packet* p, RakNet::BitStream* reader) {} public: // assign the function "event" to the raknet message id. for each new message you just define the function like above and then add this 1 liner to link the function to the message // note that you can link multiple functions to the same message and when you raise the event each function will be called automatically for you, which can come in handy sometimes Server::Server(void) { _networkEvents[iD_NEW_INCOMING_CONNECTION].Bind(this, &Server::OnNewIncomingConnection); } // your main loop becomes nice and small and never changes now void Server::Run() { while(1) { for (_packet = _peer->Receive(); _packet; _peer->DeallocatePacket(_packet), _packet = _peer->Receive()) { // if we registered this event then call the method it's bound to if(_networkEvents.find((RakNet::MessageID)_packet->data[0]) != _networkEvents.end()) { RakNet::BitStream reader(_packet->data, _packet->length, false); // this calls the function(s) for the message _networkEvents[_packet->data[0]].Raise(_packet, &reader); } } } } }; Your head will probably explode if you try to understand this code below (it took me some time to really fully understand what's happening and feel comfortable making changes) but if you can understand it you can add different event function signatures (return a value and/or take a different amount of parameters). I've found this code so useful in C++ in many different ways. From networking events to gui events to game events. If you can't understand it know that you can just copy and paste it in a header and use it as: Event2<type1, type2> myEvent; The file below is only setup to take 2 parameters of any type and return void. The code below doesn't have this but at some point I set it up to also take non class method points so you were able to mix and match class methods and non class functions to be fired which can be nice too. EventHandler.h #pragma once #include <list> using namespace std; template<class P, class Q> class TFunctor2 { public: virtual void Call(P var1, Q var2)=0; }; template <class TClass, class param1, class param2> class TSpecificFunctor2 : public TFunctor2<param1, param2> { private: void (TClass::*fpt)(param1, param2); TClass* pt2Object; public: TSpecificFunctor2(TClass* _pt2Object, void(TClass::*_fpt)(param1, param2)) { pt2Object = _pt2Object; fpt=_fpt; } virtual void Call(param1 var1, param2 var2) { (*pt2Object.*fpt)(var1, var2); } }; template<class T1, class T2> class Event2 { public: list<TFunctor2<T1, T2>* > mCaller; template<class Target> Event2(Target* t, void (Target::*fnPtr)(T1, T2)) { mCaller.push_back(new TSpecificFunctor2<Target, T1, T2>(t,fnPtr)); } Event2(){} template<class Target> void Bind(Target* t, void (Target::*fnPtr)(T1, T2)) { mCaller.push_back(new TSpecificFunctor2<Target, T1, T2>(t,fnPtr)); } void Raise(T1 V1, T2 V2) { list<TFunctor2<T1, T2>*>::reverse_iterator iter; for (iter = mCaller.rbegin(); iter!= mCaller.rend(); iter++) { (*iter)->Call(V1, V2); } } void Clear() { mCaller.clear(); } }; ////////////////////////////////////////////////// class TFunctor { public: virtual void Call()=0; }; template <class TClass> class TSpecificFunctor : public TFunctor { private: void (TClass::*fpt)(); TClass* pt2Object; public: TSpecificFunctor(TClass* _pt2Object, void(TClass::*_fpt)()) { pt2Object = _pt2Object; fpt=_fpt; } virtual void Call() { (*pt2Object.*fpt)(); } }; class Event0 { public: list<TFunctor* > mCaller; template<class Target> Event0(Target* t, void (Target::*fnPtr)()) { mCaller.push_back(new TSpecificFunctor<Target>(t,fnPtr)); } Event0(){} template<class Target> void Bind(Target* t, void (Target::*fnPtr)()) { mCaller.push_back(new TSpecificFunctor<Target>(t,fnPtr)); } void Raise() { list<TFunctor*>::reverse_iterator iter; for (iter = mCaller.rbegin(); iter!= mCaller.rend(); iter++) { (*iter)->Call(); } } void Clear() { mCaller.clear(); } };
-
Are you using blending between animations? The transition looks a little rough from animation to animation so I'm thinking you aren't. Would be curious to see how you are switching animations to check that out. Otherwise nice start!
-
Never got past the loading screen. Not sure why. Win 7 32-bit. Unpacked it to my desktop. Installed the AL sound thing. Ran the exe and just used the default settings and it gets stuck on loading screen. I let it sit for about 3 mins.