Jump to content

TylerH

Members
  • Posts

    525
  • Joined

  • Last visited

Everything posted by TylerH

  1. Right on the money Josh
  2. I still think you are trying to reinvent the wheel here as well... Lua has such great support for packages, tables, prototyping, etc., all you have to do is some work for it to be efficient and easy to use.
  3. Rick has the right idea. If we were to go to single-state, I would have to ask for it to be in that form. I don't want to have to start prefixing my functions in code, the engine, if it wants them that way, will have to do that itself.
  4. Until you read the PIL (http://apache.dataloss.nl/~peter/www.lua.org/pil/) Book, and learn about true OO and Inheritence methods in Lua via metatables and the like. If I can grasp it, I am sure you can use the techniques presented there to innovate a nice approach.
  5. http://apache.dataloss.nl/~peter/www.lua.org/pil/ Chapters 15,16,17 are excellent. They taught me loads of new stuff I didn't know about. You can change the environment (kind of like a new lua state) by calling setfenv(1, { }) Look into it, it is very promising. Those chapters describe everything from namespaces, to protoyping, inheritence, full OO patterns, weak tables, etc.
  6. That is surprising. The inheritence in Lua is rather easy, if not, then Garry's Mod does hell of a good job at it. I would recommend e-mailing garrynewman [at] gmail [dot] com and asking him how he set it up. In fact, I will do the same, too. He is usually quick to respond to professionals (non-12 year olds who know what they are speaking about), though he tends to swear a bit if you come off wrong.
  7. File Name: Enhanced base.lua File Submitter: TylerH File Submitted: 02 Dec 2009 File Category: Lua Scripts Adds entity:RelayMessage(message,delay,extra) Click here to download this file
  8. File Name: math_counter Draft Test Entity File Submitter: TylerH File Submitted: 02 Dec 2009 File Category: Lua Scripts See the thread in Lua Programming. Click here to download this file
  9. I would like some people to look at and find some ways to test out my math_counter entity. Attached Downloads section links are included to an improved base.lua file and the Counter.zip file archive. base.lua just has an added function entity:RelayMessage(message,delay,extra), which simply sends the message to all 8 targets of the entity that you call RelayMessage for. ZIP: http://leadwerks.com...ads&showfile=25 Base Lua: http://leadwerks.com...ads&showfile=26 The Counter folder should be placed in SDK Root/Models/Entities/Math/. (Idea/Icon/Names entirely stolen from Source Engine's Hammer -> math_counter on Source Engine Dev Wiki) Here is a little write-up the entity, what it does, and how to use it: Name: Math Counter Icon: Description: Stores a number (integer or floating point) value and manipulates it via Increments, Decrements, forced Set, Add, Subtract, Multiply, and Divide. It has a startvalue, which is what value will reset to if reset is true and it hits the max or min values. Keys: Start Value, Value, Minimum Legal Value, Maximum Legal Value, Reset (Code friendly: startvalue, value, min, max, reset) Receivable Messages: add(number) - Adds the given number to the value. Triggers outvalue always and passes value as extra. Triggers onhitmin and/or onhitmax if the value is now >= max or <= min. Resets value to startvalue if reset is true. subtracts(number) - Subtracts the given number from the value. Triggers outvalue always and passes value as extra. Triggers onhitmin and/or onhitmax if the value is now >= max or <= min. Resets value to startvalue if reset is true. multiply(number) - Multiplies value by the given number. Triggers outvalue always and passes value as extra. Triggers onhitmin and/or onhitmax if the value is now >= max or <= min. Resets value to startvalue if reset is true. divide(number) - Divides the value by the given number. NOTE: If number is 0, it is set to 1 to prevent divide by zero errors. Triggers outvalue always and passes value as extra. Triggers onhitmin and/or onhitmax if the value is now >= max or <= min. Resets value to startvalue if reset is true. setvalue(number) - Sets the value to the given number. Triggers outvalue always and passes value as extra. Triggers onhitmin and/or onhitmax if the value is now >= max or <= min. setvaluenofire(number) - Sets the value to the given number. Triggers no other events. Use this or directly set the entity key to set the value for future checks and operations. setmin(number) - Sets the minimum legal value to the given number. Triggers no other events. setmax(number) - Sets the maximum legal value to the given number. Triggers no other events. getvalue - Sends the "ongetvalue" message to the entity that sent the "getvalue" message, and passes value. This is best used for entities that are not a target of the counter and need to know the counter's value, or for target's that want to circumvent "setvaluenofire"'s purpose. Sent Messages: onhitmax(self) - Sent when value is >= max. Passes the entity itself as extra. onhitmin(self) - Sent when value is <= min. Passes the entity itself as extra. outvalue(number) - Sent anytime the value is set (exceptions for entity key directly or via setvaluenofire). Passes the value as extra. ongetvalue(number) - Sent to any entity that sends the counter the getvalue message. Passes the value as extra. Please try this out! Thanks, Tyler
  10. I see, and like I said it isn't like I haven't overcome the problem already. I just am saying that it is strange that it will take strings and not integers, booleans, though I guess it is obvious since the strings are objects and strange that the integers are not. It should be able to somehow cast to raw userdata and back, though I can't say that is the least memory intensive.
  11. I said INTEGERS, which are NOT Lua Tables. It crashes with Integer variables...
  12. I have quite a bit of room to talk According to Josh, the Lua implementation he uses doesn't allow integers to be passed to BlitzMax and then back to Lua via his Entity Message System, thus I have to send them as strings and get them back out as strings using tostring and tonumber respectively. Sending direct integers nags me with Lua errors: "The object at index(3) is not a valid object/value". That occurs when I try to pass 0 as an integer to the 2nd parameter of SendMessage in Lua. But if I pass 0 as "0", no issues what-so-ever. I am not playing the blame game, I just want whoever has the power to fix this to fix it.
  13. YES! Terminal velocity is the only condition where any and all objects fall at the same rate and have the same time. Sorry about the above post by me with the math rants, it was meant to be after my first one, I hadn't expected two people to respond so quickly.
  14. Given Distance (d) = Rate (Properly called "Speed", denoted s or r) * Time (t), you get d = rt. You can derive: Rate = Distance / Time Time = Distance / Rate All of which are true. Just remember that you can substitute Speed for Rate, but NOT Velocity. Speed and Velocity are NOT the same, nor is Acceleration. Things to note: Velocity - Type: Vector - Has: Direction, Magnitude Speed - Type: Magnitude Quantity - Is: The magnitude of velocity Acceleration - Type: Vector - Is: Velocity over Time Speed is your Distance over your Time, or how far you have traveled in a given amount of time. Velocity is your Speed with your Direction. A change in speed is a change in velocity, but a change in velocity's direction only is not a change in speed. For example, a velocity of (1,0,0) and (0,1,0) have the same Speed (1 unit per second), but a different direction. The first is moving +X, the second is +y. Acceleration is the first order derivative of the same equation, giving your Velocity over Time. It is given in terms of distance units over time units squared. i.e. -9.8 m/s^2 is acceleration due to gravity at sea level. So to sum: Speed - Rate of change in motion. It is a scalar quantity with the dimensions distance/time. It is measured in the same units as velocity, but has no direction. Velocity - Both direction and magnitude (Speed) of motion. Acceleration - Rate of change in velocity. Links: http://www.edinformatics.com/math_science/acceleration.htm Links for people who like math notation as opposed to English words: http://en.wikipedia.org/wiki/Velocity http://en.wikipedia.org/wiki/Acceleration http://en.wikipedia.org/wiki/Speed
  15. Note, Newton had no concept of air resistance, dampening, etc. in his time, so his equations do not reflect that. Einstein proved his equations or "laws" (quote unquote) break down in non-Earth conditions. You need to go by universal laws of gravitation, not Earth laws. In retrospect, Newton's equations will work fine in game calculations as long as you ensure that the velocity has already been weighted by the factors necessary, including but not limiting to: static friction, kinetic friction, air resistance, host fluid viscosity, spring dampening, etc. etc. etc. As you can see, there are loads of factors that affect the fall time of objects. A lot of assumptions are made when those equations are presented to you in those simple forms. Force doesn't equal Mass times Gravity ALWAYS. Distance doesn't equal Rate times Time ALWAYS. Things like this crack me up, I had a 30 minute discussion with the Algebra II teacher about this: We were being taught the equation to calculate the ending height of an object that is dropped with no initial velocity. It is: end height = -16 * time ^ 2 + initial height. My first question, or rather statement, was "That can't be right? It doesn't take into account any physical properties of the object." The discussion continued with specifics, until I had pissed off every student in the class and had still not gotten anywhere. It basically equated to the teacher denying that physics has any impact on math... Lol, Tyler
  16. Yes, my intuition lead me to vote for Option 2. Good to see we agree. That alone is enough for me to decide to go with it, unless someone else provides an argument that can debunk intuition.
  17. This is a rather simple poll. Self explanatory. Basically means core stuff, such as the math entities' abilities to store numbers is core, and the specific entities manipulate it certain ways, i.e. math_base adds the ability to story a "value" key, math_add has the ability to add to it, math_subtract has the ability to subtract from it. For the LOLs. Sort of for the LOLs, or for people who think they are smarter than me.
  18. TylerH

    Hooks

    An info_camera node would be nice, with a Drop down in the property editor that had choices from a recursive search of the Models/Entities/Cameras folder, so it could display "First Person Camera (Leadwerks)", "Third Person Camera (Klepto2)", "Third Person Camera (TylerP9P)" Where it reads the camera type (FPS, TPS, RTS, etc.) and the author from the Lua file of the camera entity, and adds it to the drop down list. Then at run time, info_camera basically relays to the selected camera entity, creates it, and then that implementation takes over. Seems like the best way to get "Drag and Drop" abilities for an infinitely large possible number of camera configurations. The possibilities are endless...
  19. He is hiding the fact that Crysis 2 was infact made using Leadwerks 2.28, and that CryEngine 3 is really Leadwerks Engine 2.3.
  20. Sure, because it is ultra viable to have global variables for every bullet that has loads of hit info to pass to its victim entity. That would be the nightmare if you were using anything more than a pistol and had more than ~10 bullets on screen. [/sarcasm] I am talking about one entity passing a table of information to another entity. For things like a single player's data in a singleplayer game, this could definitely be a global object. But in the case of say discreet information that is easier to pass in a table form from one entity to another in a single message is much more viable. For example, I will eventually have this: bullet -> SendMessage containing "damage amount" to -> prop bullet -> SendMessage containing "damage type" to -> prop bullet -> SendMessage containing "damage force" to -> prop bullet -> SendMessage containing "attacker" to -> prop bullet -> SendMessage containing "etc." to -> prop ... You get the point? It is much easier to do: bullet -> SendMessage containing hit info table (damage, amount, type, force, attacker, weapon, etc.) to -> prop And in that case, global variables also would fail, since you would now need to be prefixing of suffixing your variable names with some ID per bullet, which is ridiculous.
  21. Well, if we had some way of having SendMessage and ReceiveMessage be entirely Lua based, we can pass Lua tables to and from them. I just need a system that works for in Lua, and only for Lua. The fact SendMessage and ReceiveMessage have to work with the C++ and BMX portions as well is what causes the problem. I think logic entities will fix most of this issue.
  22. Oh wow, I completely forgot that now that we can have Lua scripted entities we can code up Logic entities. I will throw some together and post them up for others to utilize.
  23. It would require the use of OpenGL calls, specifically glReadPixels.
  24. Yes, it now takes the absolute coordinates X1 Y1 and X2 Y2, each pair is its own endpoint.
×
×
  • Create New...