Huh, I never thought about it that way.
Huh, I never thought about it that way.
Don't get me wrong, I'm very used to the concept of Z being up; Quake engine does this, Source (which is derived from quake) does, as does just about every game I've had the pleasure of reverse-engineering the map files for.
It was simply the idea that a Minecraft modding platform would use a differing co-ordinate system that messed up my head.
The norm is still X Z Y for OpenGL though IIRC
You can't compile LuaCraft on your own so we could implement it..
Anyway, I am back from 5 days of no internet, so prepare for updates! :D
OpenGL's coordinate system is whatever you choose in your projection/view matrices, but I believe the standard is X/Y/-Z - so positive Z is coming out of the screen.
This looks epic, bro. Once I get into lua scripting, this will be a great client for me to practice on. I have a great idea for a addon, but im not so good at lua so ill try and practice untill then so I can implement it into LuaCraft. Anyway, great work.
hey still ain't got a reply on my super-great awesome suggestion
Sorry must have overread that, will look into it!
-snip-
That doesn't make any sense, using your same logic if I'm looking downwards or upwards the logical choice is XY
fuck if I'm looking up at a 45 degree angle which co-ordinate system do we use
What? What does looking have to do with anything?
I've added a simple Script-Enforcer like thing. It's not perfect by far but it gets the job done.
Started adding NPCs.
Will add a metatable to control them and stuff soon!
Edited:
Alight, so I made it so you can control a NPCs AI.
chatcommand.Add( "npc", function( ply, cmd, args ) local tr = ply:Trace() local npc = ply:GetWorld():Create( "NPC" ) npc:SetPos( tr.HitPos ) npc:SetName( ply:Nick() ) npc:SetAvoidWater( true ) npc:AddAITask( 0, "Swim" ) npc:AddAITask( 1, "Wander", 0.25 ) npc:AddAITask( 2, "WatchClosest", "Player", 6, 0.02 ) npc:AddAITask( 2, "Idle" ) npc:Spawn() end )
This will spawn a dummy version of myself who will try to stay out of water, swim if it has to, wonder around with a speed of 0.25, watch and look at any players in a 6 block radius or idle.
There's a ton of AI tasks I binded, so here's a giant compilation.
The EntitySOMETHING: indicates what base class it's meant for, the stuff after is what you would use with AddAITask and AddAITaskTarget like in my example.Code:EntityLiving: "ArrowAttack", float, int, int EntityLiving: "AttackOnCollideAll", float, boolean EntityLiving: "AttackOnCollideClass", float, boolean EntityCreature: "AvoidClass", float, float, float EntityWolf: "Beg", float EntityLiving: "BreakDoor" EntityCreeper: "CreeperSwell" EntityIronGolem: "DefendVillage" EntityLiving: "EatGrass" EntityCreature: "FleeSun" EntityVillager: "FollowGolem", EntityTameable: "FollowOwner", float, float, float EntityAnimal: "FollowParent", float EntityLiving: "HurtByTarget", boolean EntityLiving: "LeapAtTarget" , float EntityIronGolem: "LookAtVillager" EntityLiving: "Idle", EntityAnimal: "Mate", float EntityCreature: "MoveIndoors" EntityCreature: "MoveThroughVillage", float, boolean EntityCreature: "MoveTowardsTarget", float, float EntityCreature: "MoveTwardsRestriction", float EntityLiving: "NearestAttackableTarget", [[String]]: Entity Class, float, int, boolean, boolean EntityLiving: "OcelotAttack" EntityCreature: "OcelotSit" EntityLiving: "OpenDoor", boolean EntityTameable: "OwnerHurtByTarget" EntityTameable: "OwnerHurtTarget" EntityCreature: "Panic", float EntityVillager: "Play", float EntityCreature: "RestrictOpenDoor" EntityCreature: "RestrictSun" EntityTameable: "Sit" EntityLiving: "Swim" EntityTameable: "TargetNonTamed", [[String]]: Entity Class, float, int, boolean EntityCreature: "Tempt", float, int, boolean EntityCreature: "Wander", float EntityLiving: "WatchClosest", [[String]]: Entity Class, float, float
The backwards logic you were using is that you can decide which co-ordinate system by how x and y would match up to your screen, but in a 3d game mapped to a 2d surface, the co-ordinates along the screen would be different based on your view. You can't say that x being left and right and y being up and down fits to the screen right, because when you look in a different direction the co-ordinate along the screen will be different.
More related: the AI looks awesome.
It's not backwards logic, that's how it works. OpenGL and DirectX both use that coordinate system, so it's not just some retarded theory I pulled out of my ass.
Everything is rendered from a static camera in screenspace, with -1,-1,-1 being the top left corner of your screen and 1,1,1 being the bottom right of your screen and as far "in" as your screen goes.
World Geometry has to be translated and scaled into screenspace in order to be rendered, and for the lazy programmer it's easier if you don't have to change coordinate systems while doing this.
Which way you're "looking" has absolutely no bearing on the coordinate system, because looking is just another series of translations and rotations that need to be applied to the geometry.
You're still not getting it - I'm fully aware of the co-ordinates used in OpenGL and DirectX (I am in fact a programmer), and I see the mistake you're making when you're reading my posts, but I can't seem to convey to you what's wrong with your logic. I'll try it this way:
Look at what you're saying here - that the x and y on your screen match up to the co-ordinate system. But say your game is an RTS, or a simple top-down game - the co-ordinates will not match up. Now, believe me, I'm fully aware you can translate things based on your camera's view point, but what I'm saying is it doesn't make sense to claim that one co-ordinate system makes more sense than an other based on what is essentially different for each game.
The real decision when you're choosing a co-ordinate system is not which direction is up, but rather to use the left handed or right handed co-ordinate system, which will actually impact the math you use. DirectX and OpenGL actually use opposite co-ordinate systems in this respect. I was taught using the left-handed co-ordinate system, so that makes more sense to me - but your game engine determines what is up and down, not your rendering engine. IE, the source engine having up and down being Z despite being based on DirectX or OpenGL.
I never said one was better than the other, I briefly outlined why Y was up in minecraft:
That's how it is by default in OpenGL and Notch is lazy.
I was certainly not preaching the wonders of using screenspace coordinates for your assets, because as you say, that would be fucking stupid.
So much which ways up![]()
I think we need a new standard!
WELL SINCE IN SPACE THERE IS NO UP how about every direction possible?
let me end this discussion with an ultra-simple drawing explaining the coordinate system
EDIT: Well FUCK, i said end the discussion, not the whole goddamn thread
Why dying thread ?![]()
looks like ending that coordinate system discussion also killed the thread... or LuaStoned is lua-stoned
Project development should regain speed soon enough, finals are finally over for some of the development team.
This is THE shit! :D
While Garry's Mod is down I might start working on this again. I've just been out of the mood for playing Minecraft lately.
I've just set up my development environment.. :grin:
I posted this on our forums since it was requested there, but figured I would add some content here also.
![]()
I'd like to say get on the documentation before you go adding more stuff.
Without good addons LuaCraft isn't going to go anywhere, and without good documentation people unfamiliar with Gmod aren't going to make the switch. I'd love to get started, but I'm pretty sick of having to read code for documentation of late.
And once it's up to date, keeping it updated only requires someone with time to read changelogs
This is pretty awesome. Great job guys
The wiki has documentation though.
It's out of date.
It's also wrong on many topics, for example, there are serverside only hooks on the clientside only list.
There are also functions with wrong arguments and there are functions missing entirely.
will this ever work on mac ?
People can edit the wiki :V
So wait, you expect US to go looking around LuaCraft's decompiled source code just so we can fill out a tiny bit of documentation?
Seriously we need some proper documentation, I'm starting a StickRPG type thing for minecraft and having the GUI functions would help.
NPC's don't work clientside?
No, you can fix any obvious errors.. Why would I expect you to do that?
Edited:
LuaCraft has an auto wiki exporter though. I might try getting it to work later
Why doesn't this work?
hook.Add("fire.spread","test",function(a) Block(a):SetID(1) end)