Jump to content

Josh

Staff
  • Posts

    23,339
  • Joined

  • Last visited

Blog Entries posted by Josh

  1. Josh
    The Leadwerks.com server started acting up earlier today, and I had no idea why. Database errors were occurring, and I had not made any changes to the site. I called our server site in Chicago. First they restored the full site from a backup from 2 A.M. yesterday morning. The matter was still not solved, though. A couple hours later, they determined that an automatic CPanel upgrade had caused PHP extensions to be loaded multiple times. This was fixed, and now we are back to normal. If you've been around a while, you know I have a big fear of data loss but it appears our procedures were able to solve the problem on our dedicated server. You get what you pay for. B)
  2. Josh
    Leadwerks3D has built-in project management features that assist the user to create, share, and publish projects. When you first start editor for the first time, the New Project wizard is displayed. You can select a programming language and choose which platforms you want the project to support. It is possible to add project templates for new languages, too.

     
    Once a project exists, you can go into the project manager and switch projects. This will cause the editor to use the project directory as the path to load all assets from. All files will be displayed relative to the project directory. You can drag an image into the icon box to add it to the project. (Xcode users will probably notice the influence here.) The +/- buttons will allow you to import a project or remove one from the list, with an option to delete the directory (iTunes much?).

     
    I want to add more features like exporting projects into a folder or .zip file, or maybe a .werk project package the editor recognizes. The editor will have options to skip asset source files like .psd, .max, etc., and only copies relevant files, so all the hundreds of files the C++ compilers generate will be skipped. We might eventually even add integration with SVN repositories, backup systems, and team management features, but that's beyond what we need to worry about right now.
     
    A "project" in Leadwerks3D is a game or other program, and will typically contain many maps (scenes). Since this kind of defies a conventional design around file requestors and files and folders, we might not even use a traditional "Open Map" dialog. All the project's maps will be available in the "Maps" directory in the Asset Browser. I can even save a thumbnail of each map when the file is saved. To add a new map to a project, you would simply drag it into the Asset Browser, preferably in the "Maps" directory. Or maybe we will also include an "Open File" file requestor that can be used to import any map, material, texture, etc. into the project. The current design of the editor is the result of a lot of experimentation and testing, so I'll continue to play around with it as I add features.
     
    Michael Betke and I have traded a lot of projects back and forth, and this system is designed to make that task easier so we can all exchange self-contained projects. If you have any suggestions to add, post in the comments below, or in the feature requests forum.
     
    --Update--
    And here's the export screen. This is similar to the "publish" step. I need to write a parser that goes through source code to determine what files are actually needed in the project. The project template defines what file extensions to scan for used files:

  3. Josh
    As the founder of Leadwerks Software, software piracy is an issue that has directly affected my income. We solved the piracy problem by turning our product into a service. Only paid customers can access our community website and get full use of our product. Piracy rates dropped to virtually zero after that. I consider our piracy problem totally solved. The marketplace changed, we adapted to provide a better service, and overall both the customers and company are better off than before.
     
    Netflix, iTunes, and Steam proved that paid services can compete and win against piracy sites. Unfortunately, the copyright holders have been resistant to this model. They won't distribute their movies through Netflix, nor will they set up their own movie streaming system. Digital streaming media isn't the future, it's the present. Many copyright holders are choosing not to compete in the marketplace, then crying foul when no one participates in their archaic business models.
     
    Why are copyright holders choosing not to compete in the standard distribution model for digital media? It's because they don't want a level playing field. They enjoyed a monopoly on everything you watch, read, hear, and think for decades. They can't stand a free market, which is what the Internet allows. The idea that an artist, product, or idea could become popular by organic means outside their control is terrifying to them. They only want you to have the choices and ideas they create for you: Justin Beiber, Republican/Democrat, and McDonald's.
     
    Old media's death is imminent within the next 10-15 years unless they act now. SOPA is about handing the Internet over to old media. I don't know exactly how it will play out, but we know their ultimate dream is to limit you to a handful of "channels" all owned by the same company. This bill has nothing to do with piracy, and everything to do with control and censorship.
     


  4. Josh
    I've been working with "Klepto2" to integrate the Scintilla text control into the new Leadwerks editor. Scintilla is very powerful and feature-rich, but is somewhat insane to work with. You've got to have a Scintilla expert onboard to integrate it successfully, which we fortunately do.
     
    Previously, I was relying on calls to a Debug:Stop() function to control breakpoints. This was hard-coded into your script program, and breakpoints could not be dynamically added or removed. Since Scintilla gives us the ability to edit breakpoints in the editor, I rewrote the debugging interface to give control to provide more communication between the application and the debugger. Breakpoints can now be added and removed as the program is running. You can also pause the program at any time from the editor and see where the code is executing.
     
    The script editor includes a great debugger that lets you view the entire contents of the Lua virtual machine. As a finishing touch, I added in some icons from Microsoft's Visual Studio icon pack. As a programmer, the result is something I really like working with:

     
    We think having a professional-grade code IDE integrated in the editor will provide a smoother and more seamless user experience, so you don't have to switch back and forth with third-party IDEs.
  5. Josh
    Well, starting with leaving my iMac's power cord at home, this has been a chaotic day, but we're getting it under control. Leadwerks 3 is a much bigger step beyond Leadwerks 2. We're no longer confined strictly to the PC platform, we've now got a C++ code base that can be used in many ways, and our new tools are really nice to use, if I do say so myself. It's also nice to sort of reconnect with our origins in the CSG editing tools. The feedback on this has been very positive, and I think it was a good move including that.
     
    Our community was built up with hobbyists and indies on the PC platform. Leadwerks is growing up, but I wanted to make sure our long-time users can move forward with us. Therefore, I decided to give everyone an easy entry into the new game engine. The reduced price is good for Leadwerks 3 as a digital download and will be available to Leadwerks 2 users until April 30th, 2013.
     
    Thanks everyone for your feedback and participation in the whole design of Leadwerks 3. Today is the start of something really great.
  6. Josh
    Several people have asked me for my hardware recommendations for a new Linux gaming machine. I get rather frustrated by PC manufacturers who load computers up with expensive Intel CPUs and extra RAM you don't need, and then forget to include a graphics card. Or they proclaim PC gaming is not dead and proudly announce their "gaming machine" with a shoddy GPU, that costs more than my first car. I've been building my own PCs since high school, and I know you can build a PC with superior performance and lower prices than the garbage PC vendors are selling today. So I am writing this article to tell you what I would buy if I wanted to build a high-quality future-proof gaming PC with big performance on a small budget.
     
    These components were chosen to give great performance at an affordable price, with maximum upgradability. I expect this computer would run any PC game today with maximum settings at 1920x1080 resolution. Components were chosen specifically for gaming, thus more importance is placed on the GPU and the CPU is relatively more lightweight. If you do not want to assemble the components yourself, any computer shop will do it for less than $100. I only chose components from reputable brands I have purchased hardware from before, no cheap brands or refurbished parts.
     
    For Linux gaming, I recommend buying AMD CPUs. The integrated graphics chips in Intel CPUs may cause problems with detection of a discrete graphics card and make it very difficult to install graphics drivers. AMD CPUs also give a better price/performance ratio with somewhat slower single-threaded speeds at a much lower price. For gaming, the single-threaded CPU speed isn't actually that important since the intensive tasks like rendering and occlusion culling are typically offloaded onto the GPU, and modern game engines like Leadwerks make extensive use of multi-threading.
     
    Disclaimer: I have not built a machine with these exact components. I am not responsible if it doesn't work, do so at your own risk, blah, blah, blah. Now on to the parts...
     
    Motherboard
    Asus M5A78L-M LX3 Desktop Motherboard (Socket AM3+):
    http://www.newegg.com/Product/Product.aspx?Item=N82E16813131935
    Price: $44.99
     
    CPU
    AMD FX-4300
    http://www.newegg.com/Product/Product.aspx?Item=N82E16819113287
    Price: $109.99
     
    RAM
    Corsair 4GB DDR3
    http://www.newegg.com/Product/Product.aspx?Item=N82E16820233349
    Price: $39.99
     
    Graphics Card
    MSI Nvidia GEForce 650
    http://www.newegg.com/Product/Product.aspx?Item=N82E16814127703
    Price: $94.99
     
    Case
    Cooler Master Elite 350 with 500w power supply
    http://www.newegg.com/Product/Product.aspx?Item=N82E16811119269
    Price: $59.99
     
    Hard drive
    Seagate Barracuda 500GB
    http://www.newegg.com/Product/Product.aspx?Item=N82E16822148767
    Price: $59.99
     
    Optical drive
    ASUS DVD Writer
    http://www.newegg.com/Product/Product.aspx?Item=N82E16827135305
    Price: $19.99
     
    Total cost: $429.93
     
    Other cost-cutting tips
    If you have any old computer, chances are you can reuse the hard drive, memory, optical drive, and even the case. Eliminating these items would bring the cost down to a ridiculously affordable $249.97.
    I could have got the price down to about $350 if I used really cheap parts, but I don't recommend doing this.
    TigerDirect.com may have some prices even lower than NewEgg.com, but I find their pricing information to be confusing. I don't ever consider manufacturer rebates, since you have no guarantee you will ever actually receive a check.

     
    Improving performance:
    If you want better performance, invest in the graphics card. When shopping for graphics cards, just look at the number of "Cuda Cores". This will give you a pretty linear estimate of performance. (On ATI cards divide the number of "stream processors" by five and that is equivalent. But I don't recommend buying an ATI card for Linux gaming at this time.) My next choice up would be the Nvidia GEForce 670, which provides 1344 Cuda Cores versus the 650's 384, at a price of $299.99:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16814121707
    If I were to upgrade the CPU, I would get the FX-8320, which only costs $159.99 and gives the best price/performance ratio, according to cpubenchmark.net:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16819113285
    An SSD will significantly improve game load times, and will generally make your computer feel much snappier whenever files are accessed. However, the prices are still high compared to hard drives, like this 256 gb PNY SSD for $179.99:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16820178456

     
    Conclusion
    The companies selling PCs don't seem to have a clue about gaming hardware requirements. Fortunately, you can build your own gaming rig and get better performance for much less money than anything they are selling. A good gaming PC doesn't need to be expensive. My recommended build here costs less than $430, and can be less than $250 if you have any spare parts lying around or an old computer you can cannibalize.
     
    The upgradability of the PC means future upgrades can cost very little and add significant performance to your hardware. My suggestions for improving performance would raise the price by about $365, giving you a mid-high machine for $795. I don't recommend buying the very highest-end parts because the price/performance balance just isn't there, and a year from now whatever you bought will be second-best anyways.
     
    When you're done building your killer Linux gaming machine, remember to take the money you didn't spend on Windows and use it to buy some great Linux games.
  7. Josh
    Previously, I talked about my plan for Leadwerks for the next 6-12 months:
     
    Leadwerks Editor
    Adding new tools to make life easier.
    Refining the workflow to eliminate any remaining"sticky" points.
    Bug fixes, to make it a super slick and polished experience.

     
    The Engine
    New features in graphics, physics, networking, etc.
    Performance optimization.
    Improved compatibility across all OpenGL 4 hardware.

     
    Third-Party Technologies
    Blender, SteamOS, Steam Workshop, virtual reality, etc.

     
    With C++ support now added on Steam, I am getting ready to add the Linux build on Steam and elsewhere. This week will give me a chance to fix some minor problems and streamline the installation process a bit.
     
    The Blender exporter has not been done yet. I originally underestimated the value that having a bridge between various third party modeling applications can add. In order to make it easier to write exporters for various modeling packages, I am creating a C library that has commands for adding model limbs, mesh data, and animations, and then saving the resulting structure as a .mdl file. This library can then be used with lots of different plugin systems to create export plugins for various programs. (For Blender support, I will hire a contractor to write this and make the source code available for tinkering.)
     
    This month will mostly be about addressing any outstanding bug reports and making small improvements to the workflow and art pipeline. This is a necessary prerequisite to support for Steam Workshop; if I can find a few small ways to make the art pipeline more efficient, it will provide a big reduction in time spent prepping models for the Workshop. So it's time to eat my own dog food, as they say. Although the Leadwerks 3 art pipeline is largely frictionless, there's a few sticky points I would like to make easier in the workflow.
     
    OSX support is also on my list for the near future. I don't anticipate any problems here, as I just have to go into Objective-C and set up some OpenGL 4 contexts, which are only possible since OSX Mavericks was released last November.
     
    As always, this is an intended development plan, and may not be exactly what gets implemented as things change.
  8. Josh
    Physics simulations typically require physical geometry to be provided in a series of convex hulls that approximate the shape of the object. This is because the intersection of two convex objects can be calculated fast enough for use in real-time simulations.
     
    One solution for creating this type of physical geometry is to create a low-detail model of the object in a modeling program. However, this process can be tedious and is often overlooked by artists. Auto-generating this type of geometry from the visual mesh itself would be ideal.
     
    Convex decomposition is a technique that takes an artbitrary polygonal mesh and transforms it into a series of convex hulls. Unfortunately until recently such algorithms were unreliable and produced physics geometry that was far too high-detail for real-time physics, as shown in the image below:
     

     
    One solution was to model a low-poly polygonal mesh and then run that through the convex decomposition routine. Although this relieved the artist from the requirement of modeling shapes as separate convex objects, it created a situation that was the worst of both worlds; physics geometry still had to be modeled by hand, but the unreliability of a convex decomposition algorithm also had to be accounted for. For this reason, I have chosen to avoid using this technique until now. However, physics geometry is our bottleneck right now in getting more content into Leadwerks, and this is a problem that has been on my mind.
     
    VHACD is a new(er) convex decomposition library. Apparently it's been around for a while, but I've only heard of HACD until recently, which did not produce very usable results. VHACD works by converting polygonal geometry into voxel data and creating a series of convex shapes from this data. Integrating this into Leadwerks took just two days, as it was very similar to the old HACD code, which was integrated at one point, but never saw the light of day because I did not feel it was good enough to release. The results of the new algorithm are, in most cases, about as good as hand-modeled geometry. This is generated purely from the visual geometry, so there is no need to hand-model a low detail collision mesh:
     

     

     

     

     

     
    You can try this feature out right now if you opt in to the beta branch on Steam, on Windows. Open a model in the editor and select the Tools > Convex Decomposition... menu item to open the convex decomposition dialog.
     
    Thanks to Khaled Mamou and Julio Jerez for their work in this area.
  9. Josh
    PC towers have been about the same since they became popular in the 1990's, replacing the previous horizontal form factor:

     
    Cases have gone from beige to black, but very little else has changed.

     

     
    PC towers tend to be designed for the old ATX style motherboards, which were first introduced in 1995:

     
    PC cases are still designed primarily for this form factor, ignoring the fact that many internal components have changed.
    The sound and ethernet card are now typically built into the motherboard.
    Motherboards that support full-power components can now be purchased cheaply in the Mini-ITX form factor, with an area of just 6x6 inches.
    Hard drives have shrunk in size.
    3.5" floppy drives are long gone, yet most cases still include a slot for these.
    Optical drives aren't even necessary anymore, although they are still the most cost effective and reliable solution for data backup.
    Graphics cards, unlike other components, have gotten bigger, hotter, and thicker. I'm not sure a GPU can even be referred to as a "card" any more. With giant heat sinks, they're more like a "graphics block".

     
    Clearly, an update to the desktop form factor is needed to respond to these changes. There's been a lot of interesting developments in desktop / home theater miniaturization, which involves making a PC with "good enough" specs and a much reduced form factor. The Steam Machines have driven some of this interest, but it's been going on for a while. The utlimate result of this trend is the Gigabyte Brix Pro. Any smaller than this, and it would be a choking hazard:

     
    What about the full-size desktop PC though? Can we find a design that uses full-size components, but packs it into a form factor more suitable for modern hardware design? I set out the following critera when starting this project:
    The case must support a full-size PSU and GPU.
    The GPU must be easily accessible for quick changing.
    At least two hard drives and an optical drive.
    Airflow sufficient for the big hot PSU and GPU it would contain.

     
    Most Mini-ITX cases are designed for small home theater setups, and do not support full-size components. A few can accommodate a full-length GPU, but do not support adequate cooling or power requirements. The Antec ISK600, for example, is a disaster waiting to happen, with a closed side blocking airflow to the GPU:

     
    Other cases may have adequate cooling, but are too tightly packed for frequent GPU switching:

     
    The Bitfenix Prodigy is one popular case I considered, but it's not much smaller than a micro-ATX tower. When you consider the wider footprint of the case, the space savings are debatable:

     
    In the end, there was only one case that offered the hardware support, cooling capacity, and ease of access I was looking for. I give you the Cooler Master Elite 130:

     
    This case packs all my previous components into a volume a little smaller than a breadbox. The lack of a heavy steel case makes the machine much lighter, and the low profile feels safer than a heavy tower I am afraid could tip over at any minute. The GPU and PSU have better access to cool air from the exterior, and a large fan in the front blows air through the entire machine. An optical drive fits seamlessly into the case, under which is a clever mechanism for an SSD to hang sideways.
     
    On the down side, the front of the case under the optical drive is a mess of cables that impede airflow from the front fan. Removing the GPU requires a stick to press the release latch. Removing the SSD requires removal of the PSU, unless you have a very short screwdriver. I also broke the USB pins on my Zotac motherboard, but it's only $50 to replace.
     
    As an added bonus, my motherboard has built-in wifi connectivity. Coupled with the extreme portability of this unit, I am sure that will come in handy at some point.
     
    The net result is that my desktop PC is now portable in a way it's never been before. I could realistically take this with me on a weekend trip or to a LAN party, whereas I would never consider doing this with my tower. At last, we're seeing real technological innovation that isn't just a reduction of capabilities, but a real move forward towards something that was better than the old way.
     

  10. Josh
    There are three low-level advancements I would like to make to Leadwerks Game Engine in the future:
    Move Leadwerks over to the new Vulkan graphics API.
    Replace Windows API and GTK with our own custom UI. This will closely resemble the Windows GUI but allow new UI features that are presently impossible, and give us more independence from each operating system.
    Compile the editor with BlitzMaxNG. This is a BMX-to-C++ translator that allows compilation with GCC (or VS, I suppose). This would allow the editor to be built in 64-bit mode.

     
    None of these enhancements will result in more or better games, and thus do not support our overarching goal. They also will each involve a significant amount of backtracking. For example, a new Vulkan renderer is pretty much guaranteed to be slower than our existing OpenGL renderer, for the first six months, and it won't even run on a Mac. A new GUI will involve lots of bugs that set us back.
     
    This is likely to be stuff that I just explore slowly in the background. I'm not going to take the next three months to replace our renderer with Vulkan. But this is the direction I want to move in.
  11. Josh
    An update is available on the beta branch which resolves the AMD rendering issues on Windows 10 with 1x MSAA setting enabled:
    http://www.leadwerks.com/werkspace/topic/13273-graphical-glitch/
     
    The following components have changed:
    Lighting shaders adjusted to handle regular 2D textures (MSAA level 0)
    Editor updated, for Windows.
    Lua interpreter and debug interpreter updated, for Windows.

     
    The C++ library has not been updated yet.
  12. Josh
    I've added a textfield widget script to the beta branch, and a new build, for (Lua interpreter, Windows only, at this time). The textfield widget allows editing of a single line of text. It's actually one of the more difficult widgets to implement due to all the user interaction features. Text is entered from the keyboard and may be selected with arrow keys or by clicking the mouse. A range of text can be selected by clicking and dragging the mouse, or by pressing an arrow key while the shift key is pressed.
     

     
    I had to implement an additional keyboard event. KeyDown and KeyEvents work for all keys, but KeyChar events are called when typing results in an actual character. The ASCII code of the typed character is sent in the data parameter of the event function:

    function Script:KeyChar( charcode ) end
     
    Making the caret indicator flash on an off goes against the event-driven nature of this system, but I think it's an important visual indicator and I wanted to include it. I went through a few ideas including a really over-engineered timer system. Finally I just decided to make the GUI call a function on the focused widget every 500 milliseconds (if the function is present in the widget's script):

    --Blink the caret cursor on and off function Script:CursorBlink() if self.cursorblinkmode == nil then self.cursorblinkmode = false end self.cursorblinkmode = not self.cursorblinkmode self.widget:Redraw() end
     
    All in all, the script weighs in at 270 lines of code. It does not handle cut, copy, and paste yet, and double-clicking to select the entire text does not yet consider spaces in the clicked word. The drawing function is actually quite simple, so you could easily skin this to get a different appearance and keep the same behavior.
     

    Script.caretposition=0 Script.sellen=0 Script.doubleclickrange = 1 Script.doubleclicktime = 500 function Script:Draw(x,y,width,height) local gui = self.widget:GetGUI() local pos = self.widget:GetPosition(true) local sz = self.widget:GetSize(true) local scale = gui:GetScale() local item = self.widget:GetSelectedItem() local text = self.widget:GetText() --Draw the widget background gui:SetColor(0.2,0.2,0.2) gui:DrawRect(pos.x,pos.y,sz.width,sz.height,0) --Draw the widget outline if self.hovered==true then gui:SetColor(51/255/4,151/255/4,1/4) else gui:SetColor(0,0,0) end gui:DrawRect(pos.x,pos.y,sz.width,sz.height,1) --Draw text selection background if self.sellen~=0 then local n local w local x = gui:GetScale()*8 local px = x local c1 = math.min(self.caretposition,self.caretposition+self.sellen) local c2 = math.max(self.caretposition,self.caretposition+self.sellen) for n=0,c2-1 do if n==c1 then px = x end c = String:Mid(text,n,1) x = x + gui:GetTextWidth(c) if n==c2-1 then w = x-px end end gui:SetColor(0.4,0.4,0.4) gui:DrawRect(pos.x + px,pos.y+2*scale,w,sz.height-4*scale,0) end --Draw text gui:SetColor(0.75,0.75,0.75) if text~="" then gui:DrawText(text,scale*8+pos.x,pos.y,sz.width,sz.height,Text.Left+Text.VCenter) end --Draw the caret if self.cursorblinkmode then if self.focused then local x = self:GetCaretCoord(text) gui:DrawLine(scale*8+pos.x + x,pos.y+2*scale,scale*8+pos.x + x,pos.y + sz.height-4*scale) end end end --Find the character position for the given x coordinate function Script:GetCharAtPosition(pos) local text = self.widget:GetText() local gui = self.widget:GetGUI() local n local c local x = gui:GetScale()*8 local count = String:Length(text) local lastcharwidth=0 for n=0,count-1 do c = String:Mid(text,n,1) lastcharwidth = gui:GetTextWidth(c) if x >= pos - lastcharwidth/2 then return n end x = x + lastcharwidth end return count end --Get the x coordinate of the current caret position function Script:GetCaretCoord() local text = self.widget:GetText() local gui = self.widget:GetGUI() local n local c local x=0 local count = math.min(self.caretposition-1,(String:Length(text)-1)) for n=0,count do c = String:Mid(text,n,1) x = x + gui:GetTextWidth(c) end return x end --Blink the caret cursor on and off function Script:CursorBlink() if self.cursorblinkmode == nil then self.cursorblinkmode = false end self.cursorblinkmode = not self.cursorblinkmode self.widget:Redraw() end function Script:MouseDown(button,x,y) self.focused=true if button==Mouse.Left then --Detect double-click and select entire text local currenttime = Time:Millisecs() if self.lastmousehittime~=nil then if math.abs(self.lastmouseposition.x-x)<=self.doubleclickrange and math.abs(self.lastmouseposition.y-y)<=self.doubleclickrange then if currenttime - self.lastmousehittime < self.doubleclicktime then self.lastmousehittime = currenttime local l = String:Length(self.widget:GetText()) self.caretposition = l self.sellen = -l self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true self.pressed=false self.widget:Redraw() return end end end self.lastmouseposition = {} self.lastmouseposition.x = x self.lastmouseposition.y = y self.lastmousehittime = currenttime --Position caret under mouse click self.cursorblinkmode=true self.caretposition = self:GetCharAtPosition(x) self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true self.pressed=true self.sellen=0 self.widget:Redraw() end end function Script:MouseUp(button,x,y) if button==Mouse.Left then self.pressed=false end end function Script:MouseMove(x,y) if self.pressed then --Select range of characters local currentcaretpos = self.caretposition local prevcaretpos = self.caretposition + self.sellen self.cursorblinkmode=true self.caretposition = self:GetCharAtPosition(x) if self.caretposition ~= currentcaretpos then self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true self.sellen = prevcaretpos - self.caretposition self.widget:Redraw() end end end function Script:LoseFocus() self.focused=false self.widget:Redraw() end function Script:MouseEnter(x,y) self.hovered = true self.widget:Redraw() end function Script:MouseLeave(x,y) self.hovered = false self.widget:Redraw() end function Script:KeyUp(keycode) if keycode==Key.Shift then self.shiftpressed=false end end function Script:KeyDown(keycode) if keycode==Key.Shift then self.shiftpressed=true end if keycode==Key.Up or keycode==Key.Left then --Move the caret one character left local text = self.widget:GetText() if self.caretposition>0 then self.caretposition = self.caretposition - 1 self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true if self.shiftpressed then self.sellen = self.sellen + 1 else self.sellen = 0 end self.widget:Redraw() end elseif keycode==Key.Down or keycode==Key.Right then --Move the caret one character right local text = self.widget:GetText() if self.caretposition<String:Length(text) then self.caretposition = self.caretposition + 1 self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true if self.shiftpressed then self.sellen = self.sellen - 1 else self.sellen = 0 end self.widget:Redraw() end end end function Script:KeyChar(charcode) local s = self.widget:GetText() local c = String:Chr(charcode) if c=="\b" then --Backspace if String:Length(s)>0 then if self.sellen==0 then if self.caretposition==String:Length(s) then s = String:Left(s,String:Length(s)-1) elseif self.caretposition>0 then s = String:Left(s,self.caretposition-1)..String:Right(s,String:Length(s)-self.caretposition) end self.caretposition = self.caretposition - 1 self.caretposition = math.max(0,self.caretposition) else local c1 = math.min(self.caretposition,self.caretposition+self.sellen) local c2 = math.max(self.caretposition,self.caretposition+self.sellen) s = String:Left(s,c1)..String:Right(s,String:Length(s) - c2) self.caretposition = c1 self.sellen = 0 end self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true self.widget:SetText(s) EventQueue:Emit(Event.WidgetAction,self.widget) end elseif c~="\r" and c~="" then --Insert a new character local c1 = math.min(self.caretposition,self.caretposition+self.sellen) local c2 = math.max(self.caretposition,self.caretposition+self.sellen) s = String:Left(s,c1)..c..String:Right(s,String:Length(s) - c2) self.caretposition = self.caretposition + 1 if self.sellen<0 then self.caretposition = self.caretposition + self.sellen end self.sellen=0 self.widget:GetGUI():ResetCursorBlink() self.cursorblinkmode=true self.widget:SetText(s) EventQueue:Emit(Event.WidgetAction,self.widget) end end
  13. Josh
    So I've been using Valve's VR technology quite a while before the HTC Vive was released, but I only recently picked up the final consumer version. Here are my thoughts on VR games.
     
    First, VR games are completely different from non-VR games. Motion in the virtual world should never contradict motion in the real world. All the early Oculus demos are examples of what not to do.
     
    "The Lab" by Valve really shows the depth of interaction VR opens up. You interactions with the virtual world are so much deeper than you can achieve with a mouse and keyboard, looking through a pane of glass into the world.
     
    The problem of limited movement has been solved by adding a teleportation mechanic. You aim where you want to go, the screen fades out and back in, and you're in the new location. I found it very easy to understand and convenient.
     
    Being able to walk around in VR is critical. You can crouch down and look on shelves to find items, and it feels very natural. A good VR game will have "focal points" where the user tends to stay in one spot. In reality, we tend to do that as well. Right now I am sitting at my desk, and although I am not walking around, I can sit here and move within a limited space.
     
    Tactile feedback is possible, and extremely compelling. When you strike an object with a sword and feel a slight bump in your controller, it is incredibly convincing. One of the most surreal moments I had was when I walked up to a door and simply grabbed the doorknob. It was locked, but I felt a slight movement as I tried to turn it.
     
    There are no good full VR games right now. Valve's demos show the incredible depth of interaction that is possible, and the only things out right now are some unpolished lightweight indie games. When I was in "The Shop" I realized how incredible it would be to play a game like Amnesia: The Dark Descent in VR. There isn't anything out there like that right now, but the possibility is wide open.
     
    Finally, the approach and technology for making a VR game is a little different. Textures and models should be very high-resolution. At the same time, the best VR games focus on small areas instead of huge expanses, so your view range can be as little as ten feet. Framerates have to be consistently high, and I would only recommend C++ for a VR game. Finally, post-processing effects are pretty much a thing of the past since they work on a flat image and not in a real 3D world. The next major iteration of Leadwerks is going to be engineered specifically with these parameters in mind.
  14. Josh
    In this blog I am going to explain my overarching plan to bring Leadwerks into the future and build our community.
    First, regarding technology, I believe VR is the future. VR right now is basically where mobile was in 2006. The big publishers won't touch it and indies have a small but enthusiastic market they can target without fear of competition from EA. I have an HTC Vive and it is AWESOME! After using it, I don't really want to play games on a 2D monitor anymore. I want to be in the game, but there is still a serious lack of decent content out there.

    At the same time, I think Vulkan is eventually going to be the graphics API we want to migrate to. Although Apple still isn't supporting it, Vulkan provides the best chance at a real cross-platform graphics API in the future.

    We eventually want to move everything over to 64-bit and drop all support for 32-bit Windows (which almost no one has nowadays).
    None of these issues are pressing. In reality, a switch over to Vulkan graphics, if done right, would result in no apparent change in the user experience for you guys. This is more about future-proofing and performance gains.
    There is one last big thing I can do that could have a huge increase in performance. Right now Leadwerks runs your game code, which calls rendering and physics calls when you choose. A concurrent architecture would have four threads running your game logic, physics, rendering, and AI in separate threads, all the time, constantly. The data exchange between these threads is a complicated matter and would likely involve some restrictions on your code. It would also break backwards compatibility with our existing API examples. So this is probably something to discuss with Leadwerks 5, and may be quite a ways off in the future.
    However, it's important that we start developing now with a clear idea of where we want to go. If information changes between now and then I can always change our course in the right direction.
    Where we are today:
    OpenGL 4.0 Windows API / GTK / Cocoa 64/32 bit Sequential architecture Where we are going:
    Vulkan 1.0 Leadwerks GUI on Windows, Mac, Linux 64-bit Concurrent architecture What if VR Flops?
    It doesn't matter. Developing for VR simply means adding in the OpenVR SDK and focusing on performance gains. This isn't like mobile where there's a completely different API and texture formats. VR will not hold back Leadwerks on the PC. It will help it. VR needs a solid 90 FPS, (although it's perfectly fine to lower your quality settings to achieve that). So developing for VR means focusing on performance gains over flexibility. We have a good idea now of how people use Leadwerks and I think we can make those decisions wisely now.
    How to Begin?
    I just outlined a plan to replace some of our low-level APIs and a major architectural change. However, I'm not willing to go back and do that until I feel like we have really polished Leadwerks Game Engine and given the users what they need. There's always a temptation to go back to the low-level details, but that just makes you an eternal tinkerer. Leadwerks is good because it's the easiest way to build your own games. That is the whole reason for Leadwerks to exist and we mustn't forget that.
    If you read our reviews on Steam, it is pretty clear what the user needs. We are sitting right now with a solid 75% ("positive") approval rating, and a community that is actively churning out games. We are almost all the way there, but Leadwerks needs to take one last step to really connect with what the user needs. In my opinion, Leadwerks Game Engine is only as good as the default templates that come with it. If we can't provide polished game examples that look and feel like a real commercial game, it isn't fair to expect the end user to come up with one. I plan to add the following game templates to Leadwerks:
    Shoot-em-up space side-scroller Contra-like side scroller Simple racing game against AI opponents (like 4x4 Evo) RPG / dungeon crawler Next, I plan to add built-in offline help documentation and video tutorials. By default, the editor is going to open the new help system automatically when the program starts. Too many people come on the forum asking questions about YouTube videos from years ago and don't go to the official tutorials still.
    If we are going to make video tutorials, and I know that at some point we are going to revise the GUI, then it makes sense to revise the GUI first. Otherwise we will end up with a lot of video content that looks obsolete once we switch over to a new GUI. This is why I am working on Leadwerks GUI now. (Leadwerks GUI will also make it easier for us to switch the editor over the BlitzMaxNG, so that it can be compiled in 64-bit mode as pure C++.)

    The revised GUI, built-in help system, and additional game templates will raise our approval rating on Steam up to 80%, which is considered "very positive". Once I have a game development system with an 80% positive rating and (by then) 20,000 users on Steam, that gives us quite a bit of leverage. Success breeds success, and I can use those figures to our advantage when negotiating with third parties.
    Here are the steps we will take, in order:
    Leadwerks GUI Add Mac support Built-in offline help with videos New game templates Achieve 80% approval rating on Steam Once we hit the 80% mark, that's when I know Leadwerks is really giving the end user what they need. I can then go back into some of the internals and work on our next iteration of technology:
    Move completely over to 64-bit Vulkan graphics Concurrent multithreaded architecture This plan gives us a path forward into emerging technologies, in balance with the needs of the end user and the realities of the business. We won't have a major interruption of development and the game tournaments will continue as this is happening.
    As always, this plan is subject to change and I may decide to do things differently depending on how circumstances develop.
  15. Josh
    The revision of our vehicle system has been a long time coming, and I am happy to say the wait will soon be worthwhile.  The new system uses a hyperrealistic slip differencial system to adjust the power given to each wheel.

    The results are a clear cut above any game vehicle physics you've ever seen.
    I am also taking steps to make the vehicle system easier to use.  The AddTire() command can now accept an entity as a parameter for the tire object.  This would typically be a child limb found within a loaded car model.  The object's size can be used to calculate the exact width and radius for the tire.  This simplifies the vehicle setup code so you just load up the model, find the wheel limbs, add tires and axles, and build the vehicle:
    //Load car model auto chassis = Model::Load("Models/Desert Patrol/Desert Patrol.mdl"); chassis->SetMass(2000); vehicle = Vehicle::Create(chassis); //Add tires vehicle->AddTire(chassis->FindChild("WheelFL"), true); vehicle->AddTire(chassis->FindChild("wheelFR"), true); vehicle->AddTire(chassis->FindChild("WheelBL14")); vehicle->AddTire(chassis->FindChild("WheelBL15")); //Add axles vehicle->AddAxle(0, 1); vehicle->AddAxle(2, 3); //Finalize the vehicle vehicle->Build(); It's very easy to load up a model and turn it into a working vehicle without worrying about the exact tire sizes and positions.

    You no longer have to position the visible tire models yourself to match the tire orientations, as this is all done automatically.  So we've taken a very complicated advanced system and made it very accessible and quick to get running.
  16. Josh
    I'm asking the community to look over the new documentation system and find any mistakes before I sign off on the project. The tutorials are not completed. The API Reference should be completed, although the main API Reference page is not showing anything right now.
    https://www.leadwerks.com/learn
     
    Here are my notes to the developer who is working on the docs:
     
    Please review the material and make sure everything meets your satisfaction, and leave your comment below if needed. I figure many sets of eyes will be more efficient than just me looking through it. This is your documentation, and I want to make sure it's the best for you. Thanks for your help!
  17. Josh
    When considering the script system in Leadwerks 5, I looked at alternatives including Squirrel, which is used by Valve in many games, but these gave me a deeper appreciation for the simplicity of Lua. There are only a handful of rules you need to learn to use the language, it’s fun to use, yet somehow it does everything you could ever need.
    These were three big issues I had to solve. First, the Leadwerks 5 API makes extensive use of smart pointers, which our binding library tolua++ does not support. Second, I wanted better auto completion and a better user experience in the IDE in general. Third, if an external IDE is going to be used it needs to be able to interface with the Leadwerks debugging system.
    To support smart pointers, I found a new library called sol2 that does everything we need. @Rick and I discussed the idea at great length and I am happy to say we’ve come up with a design that is simple to use and quite a bit easier than Leadwerks 4.x even. The binding code is nowhere near done but at this point I can see that everything will work.
    @AggrorJorn suggested using Visual Studio Code as our official script IDE in Leadwerks 5, and after investigating I think it’s a great idea. The auto completion is quite good and the IDE feels more natural then anything I could come up with using a custom text editor made with Scintilla. In fact eliminating the built-in script editor in Leadwerks 5 relieves me of a lot of uncertainty and potential issues when this is written.
    Finally, VS Code has support for custom debuggers. I wrote an example command line debugger for Leadwerks and I will use this to show another programmer how to interface with Leadwerks. (I don’t plan on writing the debugger myself.)
    With your feedback and ideas are shaping up to make Leadwerks 5 a huge leap forward over our previous designs. The improved simplicity of the new script system is a big cognitive relief. Having fewer things to worry about makes life better in a subtle but definite way.
    There’s something else that consumes a lot of mental attention. Social media and the internet have grown and changed over the years and become more efficient at consuming our attention. (Many features of this site are designed the same way.)
    The scary thing is that normal non-technical people seem to be more vulnerable than nerds. We’ll fire up the Witcher and play for an hour, but regular people are checking their phones 24/7 for feedback and validation. It’s much much worse than any accusation we got as kids of being “Nintendo zombies” because we spent an afternoon playing games instead of staring passively at broadcast TV. People who play games generally don’t care about posting photographs of their food or collecting followers.
    Somewhere along the line the internet went from being a weird thing on your computer to the collective consciousness of humanity. Reality is online and the physical world around us is just a mirage, one possible instance of a million possible individual experiences. Maybe it was around the time they started using AI to optimize clickbait that things got out of hand.
    Although my career and the way I live my life are only possible through the internet, I am old enough to remember life before the web, and in many ways it was better. Things were more focused. Even the early web before clickbait ads and online echo chambers was pretty nice. You could go to a record store and hang out talking to people about new music. Printed paper magazines were a thing.
    I already removed the link to our Google+ page in the website footer and no one noticed. I think about deleting our Facebook and twitter accounts, or at least not linking to them on our site. Why must every website pay homage to these monopolies? What are they doing for me, besides a limited flow of hits that pale in comparison to what my own email list brings in? I have written about this before but now that it is fashionable to criticize social media I might act on it. I don’t know, we’ll see.
    Please like, share, and retweet.
  18. Josh

    Articles
    Many games store 3D models, textures, and other game files in some type of compressed package format. These can be anything from a simple ZIP file to a custom multi-file archive system. This has the benefit of making the install size of the game smaller, and can prevent users from accessing the raw files. Often times undocumented proprietary file formats are used to optimize loading time, although with DDS and glTF this is not such a problem anymore.
    Leadwerks uses built-in support for encrypted ZIP files. In our new engine I wanted the ability to load game files from a variety of package formats, so our tools would have compatibility with many different games. To support this I implemented a new plugin type for package files. Packages can be used like this:
    auto pak = LoadPackage("data.zip"); auto dir = pak->LoadDir(""); for (auto file : dir) { if (pak->FileType(file) == 1) { auto stream = pak->ReadFile(); } } I created a package plugin for loading Valve package files and added support for browsing packages in the new editor, alongside with regular old folders. Ever wanted to see what the insides of some of your favorite games look like? Now you can:

    This can work not just for textures, but for materials, 3D models, and even scene or map files.
    I envision this system being flexible enough to support a wide variety of games, so that the new editor can be used not just as a game development tool but as a tool for modding games, even for games that don't have any official tools. All it takes is the right set of plugins to pull all those weird specialized file formats into our editor and export again in a game-ready format.
  19. Josh
    People are starting to use Lua, which is good. Initially there was some confusing, but in each case it turned out to be a small misunderstanding. I spent a few hours editing the wiki to add Lua syntax to the commands. I'm going to start working on Lua demos and more high-level stuff, in addition to fixing any bugs that exist. I'm not too interested in adding new features right now. This engine has plenty of features. Tons. It's time to use them to make something.
  20. Josh
    The forum software has been updated to a major new version.  This completes my effort to give the entire website responsive design, and ensures we continue to receive security updates.  The responsive design part is really for SEO, but it is kind of cool to be able to browse the entire site on your phone without zooming in.
    Documentation has been switched over to the new system here, which is independent from the forum software:
    https://www.leadwerks.com/learn
    The entire site is now using SSL on every page, again for SEO purposes.
    There are a few bits that need improvement, but overall it's a solid upgrade and I think you will find the new site to be very helpful.  I've added a new Q & A forum where you can get technical assistance and rate the answers.  Code formatting has been improved a lot, and the notifications system does a really good job of catching replies to your posts.  (If you're receiving a lot of emails you can disable this in your account settings.)
    Finally, you can now set a cover image to show at the top of your profile, which is pretty cool.
  21. Josh
    Dave Lee has joined the Leadwerks team. His job is to create a AAA game environment in Leadwerks Engine. Check out his work here.
     
    (Influences of Crysis and S.T.A.L.K.E.R., how could I not hire him? )
     
    Simon Benge, the lead artist from FPS Creator X, is also completing some animations for us.
  22. Josh
    Before Leadwerks 3 existed, Leadwerks 2 used a little tool called "Phygen" to generate collision shape files for 3D models:
     

     
    The user would input the parameters and then save that file with the same name as the model it was to be associated with, with the PHY file extension. This was not a very good system, but the idea of storing a physics shape in a PHY file that was automatically loaded along with the model was a good one.
     
    In Leadwerks 3 we implemented prefabs to make it easier to have a ready-to-use game model. However, after using the system for a while it became obvious that 90% of your models just need a simple collision shape and no other special settings. The prefab system was overkill for a simple static model.
     
    I've simplified physics shapes by adding physics shape generation in the model editor, for convex decomposition, boxes, spheres, cones, and cylinders. When you generate a physics shape it is created automatically from the model's bounds and saved as a PHY file alongside the model. Whenever that model is loaded, the engine will look for an associated physics shape file and load it at the same time.
     

     
    The physics tab has been simplified with no more confusing physics shape fields to be adjusted:
     

     
    However, under the hood the ability to assign an arbitrary physics shape to any entity is still there. If your map depends on this feature there is a hidden setting in the config file you can use to retain this feature in the editor. Just open your Leadwerks.cfg file and set the "EnableLegacyFeatures" value to 1 and it will appear. Existing maps will be unaffected, even if you don't enable this feature.
     
    These changes improve the workflow because now you just open up a model, generate a shape of any type, save it, and you have a model with physics ready to go. It does mean physics shapes are more strongly associated with models, and I originally intended them to be assigned to any old entity. However, in practice the ability to set a physics shape to a light or camera or something in the editor is pretty useless, and it's better to focus on the way it's used 99% of the time instead of designing for edge cases.
  23. Josh
    Leadwerks 3 is compiling for Android. There's presently a problem with the file system that is preventing any 3D rendering, but we'll get that worked out shortly. We're targeting Android 2.2.
     
    In order to compile C++ for Android on Windows, we had to install the following:
    -Java SDK
    -Eclipse IDE
    -Android SDK
    -Android NDK
    -CygWin
    -GDB
     
    We also learned that OpenGL ES 2.0 does not run in the Android simulator. For the time being, we have to run the engine on an actual Android device. That was rather surprising, but I think Google will have this functionality added fairly soon. I also learned there is an x86 version of Android, but no one uses it.
     
    Debugging C++ on Android is done with GDB, a command-line debugger. You definitely don't want to use this to do any heavy work. In this case, the cross-platform nature of coding with Leadwerks comes in handy, and you can debug on Windows or OSX and then just compile your finished code for Android, without much testing.
     
    The plan is to allow one-step publishing for Android when you use Lua. You write your program in script, test it on PC or Mac, then you can export a package for Android that's ready to install on your phone, without even having to install the Android SDK. You can also use C++, and it takes more work, but it's not too hard and we'll have instructions on how to get set up.
     
    Behold the mighty blue screen running on an HTC Evo, and tremble!:


  24. Josh
    This year, Halloween makes an early arrival. Either that, or Josh is working on animation!
     
    Obviously this is wrong, but it's only a few lines of code away from being right, and I'll figure it out.
     
    Skinning in the new game engine is done on the CPU. You don't have to assign a special shader to make an animated model appear, but it is slower than GPU skinning. I can distribute the load across CPU cores, but no matter what we're not going to have free skinning like we do with Leadwerks Engine 2. Unfortunately, there is no cross-platform technique to get the bone matrices to the GPU in OpenGL2/OpenGLES2. Heck, I could barely get it working on NVidia and ATI cards on Windows.
     
    OpenGL 3+ provides a technique for handling this that is built into the specification. The vertex skinning routines are being designed for GPU skinning, so that it will be easy to adapt to OpenGL 3-4 in the future.
     
    Ha, this one's even better:

×
×
  • Create New...