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
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.
fuck if I'm looking up at a 45 degree angle which co-ordinate system do we use
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!
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
More related: the AI looks awesome.
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.
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
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 ?
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 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 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?
Why doesn't this work?
hook.Add("fire.spread","test",function(a) Block(a):SetID(1) end)