-
Posts
141 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by GorzenDev
-
like i said my expertise in networking is limited so there is no way i can say you are wrong. but i have ran gameservers for steamgames and those are in the port ranges of 27000. anyway thanks for the help i can tinker some more now (fun fun )
-
this did work thank you for that. could you maiby explain why ? my expertise in networking is limited
-
very nice i am trying to recreate your example for my own purposes and get stuck at Server:Create() it always returns a nil value for me . at some point i even added a line of code like this what gave the same result if server == nil then server = Server:Create(port) end my Main.lua gives an "attempt to index local 'server' (a nil value)" error i know what this means but cant realy understand why. anybody able to help me out here ? Main.lua --Set the application title title="GameServer" -------------------------------------------------------- --Function to build user interfaca -------------------------------------------------------- function BuildServerGUI(context) local interface = {} interface.gui=GUI:Create(context) interface.root = interface.gui:GetBase() interface.root:SetScript("Scripts/GUI/Panel.lua") interface.chatlog = Widget:TextArea(4,4,interface.root:GetClientSize().x-8,interface.root:GetClientSize().y-30-8,interface.root) interface.textbox = Widget:TextField("",4,interface.root:GetClientSize().y-30,interface.root:GetClientSize().x-8-72-4,26,interface.root) interface.sendbutton = Widget:Button("Send",interface.root:GetClientSize().x-4-72,interface.root:GetClientSize().y-30,72,26,interface.root) return interface end -------------------------------------------------------- --Initialize client and server -------------------------------------------------------- local MESSAGE_CHAT=1 local peer = nil local port=8000 --local client = Client:Create() local server = Server:Create(port) --local success = client:Connect("127.0.0.1",port) -------------------------------------------------------- --Create a server window -------------------------------------------------------- serverwindow=Window:Create(title,0,0,800,600,Window.Titlebar) local serverInterface = BuildServerGUI(serverwindow) -------------------------------------------------------- --Main loop -------------------------------------------------------- while true do -------------------------------------------------------- --Exit the program -------------------------------------------------------- if serverwindow:KeyHit(Key.Escape) then return end -------------------------------------------------------- --Handle closed window -------------------------------------------------------- if serverwindow:GetHidden()==false then if serverwindow:Closed() then serverwindow:Hide() server:Disconnect(peer) end end -------------------------------------------------------- --Update server -------------------------------------------------------- while true do if server == nil then server = Server:Create(port) end local message = server:Update() <<----------Gives error on this line if message==nil then break end if message.id==Message.Connect then serverInterface.chatlog:AddText(">> New client connected.") peer = message.peer elseif message.id==Message.Disconnect then serverInterface.chatlog:AddText(">> Client disconnected.") elseif message.id==MESSAGE_CHAT then serverInterface.chatlog:AddText("Client: "..message.stream:ReadString()) end message:Release() end -------------------------------------------------------- --Handle GUI events -------------------------------------------------------- while EventQueue:Peek() do local event = EventQueue:Wait() if event.id == Event.WidgetAction then if event.source == serverInterface.sendbutton or event.source==serverInterface.textbox then local s = serverInterface.textbox:GetText() server:Send(peer,MESSAGE_CHAT,s) serverInterface.chatlog:AddText("Me: "..s) serverInterface.textbox:SetText("") serverInterface.gui:SetFocus(serverInterface.textbox) end end end end
-
i agree and love it , the only wall i had to work around whas not being able to use "CallFunction()" in lua and GetScript() doesnt return the script table. so currently the animationlogic is outside of the widget script which i love to have inside the script or some kind of Script:Update() function could also work (havent tried that yet to be honest) other then that i dont see any restrictions holding me back for now.
-
that looks very nice. happy to help
-
this is still a work in progress and dont mind the graphics, i used whatever images i had laying about. just wanted to show that even animated elements could be created http://www.youtube.com/watch?v=4sapsnW9O1I
-
dont forget to look at the documentation for Widget. it helps understanding whats available for adding and what to use for get/set script variables. good luck and have fun messing with it i like the GUI system it is very flexible and fast .
-
adding elements to the current menu doesnt involve pivots. i am still figuring it all out but i can try to explain what i learned so far. so lets start with saying Menu.lua is basicly just a function which creates/returns a table. function BuildMenu(context) local GameMenu={} local scale = 1 in this function we create a gui for the menu to hold the elements. --GUI local gui = GUI:Create(context) gui:Hide() gui:SetScale(scale) local widget gui:GetBase():SetScript("Scripts/GUI/Panel.lua") gui:GetBase():SetObject("backgroundcolor",Vec4(0,0,0,0.5)) GameMenu.gui=gui GameMenu.context = context then we create menu elements (in this case 3 buttons) --Create a link button for new game GameMenu.newbutton = Widget:Button("NEW GAME",100,gui:GetBase():GetSize().y/2-60,300,20,gui:GetBase()) GameMenu.newbutton:SetString("style","Link") GameMenu.newbutton:SetAlignment(1,0,0,0) --Create a push button for options GameMenu.options = Widget:Button("OPTIONS",100,gui:GetBase():GetSize().y/2-10,300,20,gui:GetBase()) GameMenu.options:SetString("style","Push") GameMenu.options:SetAlignment(1,0,0,0) --Create a push button for Quit GameMenu.quit = Widget:Button("QUIT",100,gui:GetBase():GetSize().y/2+40,300,20,gui:GetBase()) GameMenu.quit:SetString("style","Push") GameMenu.quit:SetAlignment(1,0,0,0) after we added the elements we need , we could scroll down to the function GameMenu:ProcessEvent(event) in that function there are some events WindowSize,WidgetSelect and WidgetAction in this case we just need the elseif event.id == Event.WidgetAction code block create your button logics here (for easier reading i left only the 3 buttons we are using as example in this code block) elseif event.id == Event.WidgetAction then --Options Button Logic if event.source == self.options then self:GetSettings() self.tabber:SelectItem(0) self:ProcessEvent(Event(Event.WidgetAction,self.tabber,0)) self.newbutton:Disable() self.options:Disable() self.quit:Disable() self.optionspanel:Show() --New/Resume Game Button Logic elseif event.source == self.newbutton then if self.newbutton:GetText()=="NEW GAME" then if Map:Load("Maps/WorkSpace.map") then prevmapname = "WorkSpace" --Send analytics event Analytics:SendProgressEvent("Start",prevmapname) self.newbutton:SetText("RESUME GAME") end end self.gui:Hide() --self.context:GetWindow():HideMouse() self.context:GetWindow():FlushMouse() self.context:GetWindow():FlushKeys() self.context:GetWindow():SetMousePosition(self.context:GetWidth()/2,self.context:GetHeight()/2) Time:Resume() --Quit Button Logic elseif event.source == self.quit then self.newbutton:Disable() self.options:Disable() self.quit:Disable() self.confirmquitpanel:Show() end end and the function that will make it all tick will be the update function function GameMenu:Update() --show/hide menu logic if context:GetWindow():KeyHit(Key.Escape) then if self.optionspanel:Hidden() then if self.newbutton:GetText()=="NEW GAME" then self:ProcessEvent(Event(Event.WidgetAction,self.quit)) else if self.gui:Hidden() then Time:Pause() self.gui:Show() self.context:GetWindow():ShowMouse() else self.gui:Hide() self.context:GetWindow():FlushMouse() self.context:GetWindow():FlushKeys() --self.context:GetWindow():HideMouse() self.context:GetWindow():SetMousePosition(self.context:GetWidth()/2,self.context:GetHeight()/2) Time:Resume() end end else self:ProcessEvent(Event(Event.WidgetAction,self.closeoptions)) end end while EventQueue:Peek() do local event = EventQueue:Wait() if self:ProcessEvent(event)==false then return false end end return true end i hope this explains a bit as to how Menu.lua is build in basic ways. and how to add new buttons.
-
can we in some way mark a section of the gui as changed to force a redraw? in some cases: image as button for example the control needs a mousehover at least once to draw the image correctly
-
for that you dont need to edit Panel.lua at all just add a button or panel as you would normaly. look at Menu.lua for example we could change the options panel if we like. 33 optionspanel = Widget:Panel(gui:GetBase():GetClientSize().x/2-250,gui:GetBase():GetClientSize().y/2-300,500,600,gui:GetBase()) 34 optionspanel:SetAlignment(0,0,0,0) --load and set out image here local image = gui:LoadImage("path/to/texture.tex") optionspanel:SetImage(image) -- 35 GameMenu.optionspanel=optionspanel
-
local image = gui:LoadImage("Path/To/Texture.tex") -- local imageButton = Widget:Button("", 0, 0, 1024, 768, gui:GetBase()) imageButton:SetString("style","Push") imageButton:SetImage(image) -- local imagePanel = Widget:Panel(0,0,1024,768, gui:GetBase()) imagePanel:SetImage(image) Result: this works for me. undocumented though
-
I assume using the build-in water shaders and textures on a brush/model will not work like that. either use the build-in water by going to your root in the scenepanel and enable waterlayer and set height etc. or create your own shaders to work on a brush/model.
-
to answer my own question i dont think it is possible to have suspensionless tires with the current vehicle class. my solution to this is calculate each wheels moment force then calculate the rotation and velocity of the main body. (this does not use the vehicle class but rather 4 individual wheels) preview of robotic body moving by individual wheel forces (WIP)
-
thanks for the answers guys. maiby josh can elaborate on the current possibilty of the vehicle class parameters ? and if suspensionless tires are currently possible at all ?
-
this is a lot better thank you. although this still has suspension and bounces during cornering and slopes. i am building a robotics game and want to attach wheels to a chassis. but most robotics wheels/servos do not have any kind of suspension.
-
After playing aroud with the Vehicle:AddTire() parameters i get some weird results. Is there any way to have a tire with 0 suspension length? I have tried setting the length parameter to zero and playing with the damp and spring values. wich gets some weird and fun result but nothing that comes close to a suspensionless tire. Any help or tricks?
-
thank you very much just what i needed. feel a bit stupid i missed that
-
first i like to say happy new year to all and i wish you a safe and productive year. i have a question about the pin argument of creating a joint. after playing around with joints it looks like the pin argument is in global space. how would i go about setting a joint's pin orientation based on some local rotation? for example 2 cubes binded by a hinge joint with a pin value of Vec3(1,0,0) X axis looks alright when both cubes are aligned with 0 rotation. but whenever i bind 2 cubes togheter with some rotation in mind the result is always global axis based? ------------------------------------- Edit: currently i have a workaround which involves aligning both cubes to a global axis then bind them with the joint:hinge then rotate it all back to there origional state. the joint then rotates as if local to the parented cube. but i assume there must be a better way.? please help.