Hrafna
-
Posts
12 -
Joined
-
Last visited
Reputation Activity
-
Hrafna got a reaction from Bambino in A LUA "Core Unit Emulator" Tool for New Programmers
I like this idea.
For now I'm pretending to have the API just so that I can get used to writing LUA
-- This function was borrowed from LUA's homepage. -- It will be used to remove some redundant decimals later on in the script. -- Feel free to ignore it for now. function round(num, decimals) local mult = 10^(decimals or 0) return math.floor(num * mult + 0.5) / mult end -- Newton's law: -- acceleration = newton / mass -- mass = newton * acceleration -- newton = mass * acceleration -- Gravity will, later, be a modifier that the player can determine through a control panel. -- The value can be anything, but in this example, the player is going to choose Earth's gravity. local gravity = 9.80665 -- Earth -- If gravity returns as a boolean, then gravity has not been set by the player, and gravity should be given a default value. if gravity == nil then gravity = 0 end -- The amount of force that ONE thruster can perform is assumed to make the script work. Thruster information should be available upon game's release. local thruster_n = 800000 -- N -- The ship's weight is assumed to make the script work. Ship's weight should be available upon game's release. local ship_kg = 135106 -- kg -- If there is a ship with weight to be calculated, then... if ship_kg then -- The amount of thrusters that this imaginary ship will have is assumed in order to make the script work. -- It is also assumed that thrusters are- or can be grouped in this manner. local thrusters = {"Thruster 1", "Thruster 2"} -- The number of thrusters found in the above array. local thruster_count = #thrusters -- The amount of thrust that all thrusters produce in total local total_thrust = thruster_n * thruster_count -- If there is gravity, then... if gravity > 0 then -- the total thrust needed to repel this gravity is thrust_needed = ship_kg * gravity else -- the ship is not affected by gravity thrust_needed = ship_kg end -- If the ship's total thrust is higher than the thrust needed to lift off, then... if total_thrust > thrust_needed then -- calculate redundant thrust in percent local thrust_per = ((total_thrust / thrust_needed) * 100) - 100 -- calculate the amount of redundant thrusters local redundant_thrusters = total_thrust / thrust_needed print("The ship has",round(thrust_per, 2),"% more thrust than what is required to repel",gravity,"gravity.") -- I'm a sucker for proper grammar... if redundant_thrusters >= 1 and redundant_thrusters < 2 then print("The ship has",round(redundant_thrusters,0),"thruster that can safely be removed.") -- 1 thruster elseif redundant_thrusters >= 2 then print("The ship has",round(redundant_thrusters,0),"thrusters that can safely be removed.") -- 2 thrustersssSSS end print("The ship accelerates",round(redundant_thrusters, 2),"m/s while in",gravity,"gravity.") else -- Calculates thrust missing in percent local thrust_per = ((total_thrust / thrust_needed) * 100) - 100 -- Calculates the amount of thrusters missing local thrusters_missing = thrust_needed / total_thrust print("The ship is missing",round(thrust_per, 2),"% of total thrust required to repel",gravity,"gravity.") -- What? Sue me. if thrusters_missing >= 1 and thrusters_missing < 2 then print("The ship needs",round(thrusters_missing, 0),"more thruster.") -- 1 thruster elseif thrusters_missing >= 2 then print("The ship needs",round(thrusters_missing, 0),"more thrusters.") -- 2 or more thrustersssSSS end print("The ship accelerates",round(thrusters_missing, 2),"m/s while in",gravity,"gravity.") end -- if total_thrust end -- if ship_kg Edited: Dual Universe will apparently be using LUA 5.3, so getn(thrusters) was deprecated. I had to change it to #thrusters. My bad. I also made sure that the script will run regardless of gravity, and edited the grammar to sound more neutral and coherent. I hope editing doesn't bump my post, but only makes sure that future readers can test out the LUA script if they want and it works as intended. Read CaptainTwerkmotor's post below mine to see what changes I made.
-
Hrafna got a reaction from Aesras in LUA and Programming Actuators/Doors/Turrets
What is really fair, and what is really the penalty here? I suppose what isn't fair is the fact that we, as humans, are all different from one another, and that the penalty is that one will not find solutions to ones problems if one does not so much as attempt to be creative and solve ones problems in the first place. I mean, can they not befriend someone who can script? Or, can they not take part of the economy, and purchase the services of someone who can script? Is it not realistic that factions will have different people, with different set of skills, and that this could, and most likely would result in secrecy, spying, and feuds between factions; in short, politics, which Dual Universe has advertised for a long time?
-
Hrafna reacted to yamamushi in Terminals/Computers
Wouldn't it have been more valuable to propose a solution to the client-side script limitation than to just abandon ship completely 11 posts into your account?
Since we're on the topic, it's worth discussing -why- scripts have to be executed on the client side as opposed to being uploaded to the server as well as limitations that causes.
To get a better sense of why simply just uploading a script to the server and expecting it to run wouldn't work in DU, one only needs to watch the server technology video:
With all of the dynamic clustering going on, it's not a simple matter of just running a script on a single cluster at a time, as player density shrinking the area sizes per-cluster would mean ultimately having to figure out a way to synchronize the execution of scripts across the dynamic clusters.
Alternatively one could imagine a whole other server resource running externally from the cluster that does all of the script execution and makes calls to the cluster with the output. However, now we're talking about adding a whole other step to the client input process, adding precious latency.
Regardless of the approaches, that still doesn't resolve issues like infinite loops bottlenecking server-side performance, which goes into a whole other topic of trying to also add in a static analyzer to the process.
I think the process of just having the server stream scripts with version checksums to clients when needed for any particular task would be much easier and provides more performance value overall. Whenever a user with the proper permissions accesses a terminal or device or whatever (something that sends an event to a DPU), their client would request the script from the server to execute locally.
They've said they're looking into ways of allowing for offline script execution, for bases with automated defenses/etc. I imagine that would be handled by some sort of upkeep cost, in in-game currency, to provide some balance. I also imagine it would work similarly to the external server resource I noted above.
-
Hrafna got a reaction from ForlornFoe in LUA and Programming Actuators/Doors/Turrets
What is really fair, and what is really the penalty here? I suppose what isn't fair is the fact that we, as humans, are all different from one another, and that the penalty is that one will not find solutions to ones problems if one does not so much as attempt to be creative and solve ones problems in the first place. I mean, can they not befriend someone who can script? Or, can they not take part of the economy, and purchase the services of someone who can script? Is it not realistic that factions will have different people, with different set of skills, and that this could, and most likely would result in secrecy, spying, and feuds between factions; in short, politics, which Dual Universe has advertised for a long time?
-
Hrafna got a reaction from Lord_Void in LUA and Programming Actuators/Doors/Turrets
What is really fair, and what is really the penalty here? I suppose what isn't fair is the fact that we, as humans, are all different from one another, and that the penalty is that one will not find solutions to ones problems if one does not so much as attempt to be creative and solve ones problems in the first place. I mean, can they not befriend someone who can script? Or, can they not take part of the economy, and purchase the services of someone who can script? Is it not realistic that factions will have different people, with different set of skills, and that this could, and most likely would result in secrecy, spying, and feuds between factions; in short, politics, which Dual Universe has advertised for a long time?
-
Hrafna got a reaction from Ben Fargo in LUA and Programming Actuators/Doors/Turrets
What is really fair, and what is really the penalty here? I suppose what isn't fair is the fact that we, as humans, are all different from one another, and that the penalty is that one will not find solutions to ones problems if one does not so much as attempt to be creative and solve ones problems in the first place. I mean, can they not befriend someone who can script? Or, can they not take part of the economy, and purchase the services of someone who can script? Is it not realistic that factions will have different people, with different set of skills, and that this could, and most likely would result in secrecy, spying, and feuds between factions; in short, politics, which Dual Universe has advertised for a long time?
-
Hrafna got a reaction from ATMLVE in LUA and Programming Actuators/Doors/Turrets
What is really fair, and what is really the penalty here? I suppose what isn't fair is the fact that we, as humans, are all different from one another, and that the penalty is that one will not find solutions to ones problems if one does not so much as attempt to be creative and solve ones problems in the first place. I mean, can they not befriend someone who can script? Or, can they not take part of the economy, and purchase the services of someone who can script? Is it not realistic that factions will have different people, with different set of skills, and that this could, and most likely would result in secrecy, spying, and feuds between factions; in short, politics, which Dual Universe has advertised for a long time?
-
Hrafna got a reaction from Kytheum in LUA Communication.
This means that you can sell your scripts in-game, and not have to expose your source code,and keep your client's products updated.
I approve.
-
Hrafna got a reaction from Kuritho in Ingame Names
I hope they add restrictions such as not allowing numbers and random capitalization. It's ugly, and folly.
I also see no reason why you can't change your name, or why people can't have the same name, and the same last name. I'm pretty sure there's more than one person on this planet with the name John, and with the first name John and the last name Smith. Their IDs may be different, but it doesn't have to be visible. It's not like we have to separate our friend John from our other friend John by asking for their birth certificates. We don't tattoo indistinguishable numbers on their foreheads, and call them John#1 and John#2, or call them by their last names.
Only in terms of economy does a distinction really have to be made in order to avoid identity theft. If John creates something, and sells it on the market, and is recognized for his name, then some other guy comes in pretends to be him, that could cause problems. So, in this case, anyone called John is given a unique ID. Not the player ID because it's too long, but something such as John[QR] and John[3T], two capitalized letters that are easy to recognize, distinguish, and remember. This means that if you want to keep your recognition, if you want people to know who you are, for what you have done, then you have to keep your name. Your [QR] economy-name ID doesn't follow you when you change names. If you change your name from John ([QR]) to Frank, then you might end up with Frank[b2]. You're going to have to build up your fame all over again, and maybe even suffer from the fact that someone else might end up with your name and ID, and pretend to be the old you.
I mean, if you call your game Dual Universe, the game gets known, then decide not to call it Dual Universe anymore, and you lose the trademark. That can actually happen. And it's not the system's fault. It's yours.
-
Hrafna got a reaction from ForlornFoe in A LUA "Core Unit Emulator" Tool for New Programmers
I like this idea.
For now I'm pretending to have the API just so that I can get used to writing LUA
-- This function was borrowed from LUA's homepage. -- It will be used to remove some redundant decimals later on in the script. -- Feel free to ignore it for now. function round(num, decimals) local mult = 10^(decimals or 0) return math.floor(num * mult + 0.5) / mult end -- Newton's law: -- acceleration = newton / mass -- mass = newton * acceleration -- newton = mass * acceleration -- Gravity will, later, be a modifier that the player can determine through a control panel. -- The value can be anything, but in this example, the player is going to choose Earth's gravity. local gravity = 9.80665 -- Earth -- If gravity returns as a boolean, then gravity has not been set by the player, and gravity should be given a default value. if gravity == nil then gravity = 0 end -- The amount of force that ONE thruster can perform is assumed to make the script work. Thruster information should be available upon game's release. local thruster_n = 800000 -- N -- The ship's weight is assumed to make the script work. Ship's weight should be available upon game's release. local ship_kg = 135106 -- kg -- If there is a ship with weight to be calculated, then... if ship_kg then -- The amount of thrusters that this imaginary ship will have is assumed in order to make the script work. -- It is also assumed that thrusters are- or can be grouped in this manner. local thrusters = {"Thruster 1", "Thruster 2"} -- The number of thrusters found in the above array. local thruster_count = #thrusters -- The amount of thrust that all thrusters produce in total local total_thrust = thruster_n * thruster_count -- If there is gravity, then... if gravity > 0 then -- the total thrust needed to repel this gravity is thrust_needed = ship_kg * gravity else -- the ship is not affected by gravity thrust_needed = ship_kg end -- If the ship's total thrust is higher than the thrust needed to lift off, then... if total_thrust > thrust_needed then -- calculate redundant thrust in percent local thrust_per = ((total_thrust / thrust_needed) * 100) - 100 -- calculate the amount of redundant thrusters local redundant_thrusters = total_thrust / thrust_needed print("The ship has",round(thrust_per, 2),"% more thrust than what is required to repel",gravity,"gravity.") -- I'm a sucker for proper grammar... if redundant_thrusters >= 1 and redundant_thrusters < 2 then print("The ship has",round(redundant_thrusters,0),"thruster that can safely be removed.") -- 1 thruster elseif redundant_thrusters >= 2 then print("The ship has",round(redundant_thrusters,0),"thrusters that can safely be removed.") -- 2 thrustersssSSS end print("The ship accelerates",round(redundant_thrusters, 2),"m/s while in",gravity,"gravity.") else -- Calculates thrust missing in percent local thrust_per = ((total_thrust / thrust_needed) * 100) - 100 -- Calculates the amount of thrusters missing local thrusters_missing = thrust_needed / total_thrust print("The ship is missing",round(thrust_per, 2),"% of total thrust required to repel",gravity,"gravity.") -- What? Sue me. if thrusters_missing >= 1 and thrusters_missing < 2 then print("The ship needs",round(thrusters_missing, 0),"more thruster.") -- 1 thruster elseif thrusters_missing >= 2 then print("The ship needs",round(thrusters_missing, 0),"more thrusters.") -- 2 or more thrustersssSSS end print("The ship accelerates",round(thrusters_missing, 2),"m/s while in",gravity,"gravity.") end -- if total_thrust end -- if ship_kg Edited: Dual Universe will apparently be using LUA 5.3, so getn(thrusters) was deprecated. I had to change it to #thrusters. My bad. I also made sure that the script will run regardless of gravity, and edited the grammar to sound more neutral and coherent. I hope editing doesn't bump my post, but only makes sure that future readers can test out the LUA script if they want and it works as intended. Read CaptainTwerkmotor's post below mine to see what changes I made.
-
Hrafna reacted to Anaximander in A LUA "Core Unit Emulator" Tool for New Programmers
Hopefully, people can see this and realise how easy Lua is.
-
Hrafna got a reaction from Anaximander in A LUA "Core Unit Emulator" Tool for New Programmers
I like this idea.
For now I'm pretending to have the API just so that I can get used to writing LUA
-- This function was borrowed from LUA's homepage. -- It will be used to remove some redundant decimals later on in the script. -- Feel free to ignore it for now. function round(num, decimals) local mult = 10^(decimals or 0) return math.floor(num * mult + 0.5) / mult end -- Newton's law: -- acceleration = newton / mass -- mass = newton * acceleration -- newton = mass * acceleration -- Gravity will, later, be a modifier that the player can determine through a control panel. -- The value can be anything, but in this example, the player is going to choose Earth's gravity. local gravity = 9.80665 -- Earth -- If gravity returns as a boolean, then gravity has not been set by the player, and gravity should be given a default value. if gravity == nil then gravity = 0 end -- The amount of force that ONE thruster can perform is assumed to make the script work. Thruster information should be available upon game's release. local thruster_n = 800000 -- N -- The ship's weight is assumed to make the script work. Ship's weight should be available upon game's release. local ship_kg = 135106 -- kg -- If there is a ship with weight to be calculated, then... if ship_kg then -- The amount of thrusters that this imaginary ship will have is assumed in order to make the script work. -- It is also assumed that thrusters are- or can be grouped in this manner. local thrusters = {"Thruster 1", "Thruster 2"} -- The number of thrusters found in the above array. local thruster_count = #thrusters -- The amount of thrust that all thrusters produce in total local total_thrust = thruster_n * thruster_count -- If there is gravity, then... if gravity > 0 then -- the total thrust needed to repel this gravity is thrust_needed = ship_kg * gravity else -- the ship is not affected by gravity thrust_needed = ship_kg end -- If the ship's total thrust is higher than the thrust needed to lift off, then... if total_thrust > thrust_needed then -- calculate redundant thrust in percent local thrust_per = ((total_thrust / thrust_needed) * 100) - 100 -- calculate the amount of redundant thrusters local redundant_thrusters = total_thrust / thrust_needed print("The ship has",round(thrust_per, 2),"% more thrust than what is required to repel",gravity,"gravity.") -- I'm a sucker for proper grammar... if redundant_thrusters >= 1 and redundant_thrusters < 2 then print("The ship has",round(redundant_thrusters,0),"thruster that can safely be removed.") -- 1 thruster elseif redundant_thrusters >= 2 then print("The ship has",round(redundant_thrusters,0),"thrusters that can safely be removed.") -- 2 thrustersssSSS end print("The ship accelerates",round(redundant_thrusters, 2),"m/s while in",gravity,"gravity.") else -- Calculates thrust missing in percent local thrust_per = ((total_thrust / thrust_needed) * 100) - 100 -- Calculates the amount of thrusters missing local thrusters_missing = thrust_needed / total_thrust print("The ship is missing",round(thrust_per, 2),"% of total thrust required to repel",gravity,"gravity.") -- What? Sue me. if thrusters_missing >= 1 and thrusters_missing < 2 then print("The ship needs",round(thrusters_missing, 0),"more thruster.") -- 1 thruster elseif thrusters_missing >= 2 then print("The ship needs",round(thrusters_missing, 0),"more thrusters.") -- 2 or more thrustersssSSS end print("The ship accelerates",round(thrusters_missing, 2),"m/s while in",gravity,"gravity.") end -- if total_thrust end -- if ship_kg Edited: Dual Universe will apparently be using LUA 5.3, so getn(thrusters) was deprecated. I had to change it to #thrusters. My bad. I also made sure that the script will run regardless of gravity, and edited the grammar to sound more neutral and coherent. I hope editing doesn't bump my post, but only makes sure that future readers can test out the LUA script if they want and it works as intended. Read CaptainTwerkmotor's post below mine to see what changes I made.
-
Hrafna got a reaction from gyurka66 in Scripting Languages
My first encounter with LUA was last night, and it's deliciously simplistic.
C#, on the other hand, is just awful. It looks awful, and worse, runs awful. It's repetitive and un-intuitive, spite having been created to be the opposite.