Jump to content

Luawerks


reepblue
 Share

Recommended Posts

< Linked Removed >

This was the replacement of LEX I was working on a while back. When you install this in your project, your app will have support for console commands, a working dev console, and a separation of main menu, in-game and paused states. As long as your map doesn't have spaces, you can load any map by entering map mymap in the console box. To open the console box, press tilde or slash. 

I was writing documentation, but then I got busy, and sorta forgot about it. 

< Linked Removed >

Decided to share this more publicly. Haven't worked on it in a while, so if you have any questions, please gimme a few moments to go over it to answer your question(s).

Thanks!

 

Edit: Gonna clean it up and fully document it. It'll also be on the workshop.

  • Upvote 3

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Hey, reepblue, always have been a fan of your videos (sad, that you don't post too often), but besides that, I was wondering if I could port your Luawerks API over to C++, especially for the use of the console. I fell it would be much faster and easier to implement into C++ code that way with an added touch of security from modification in a commercial game, and also as a project for me to continue learning C++. I will give credit to you and keep the code open source and on Github. Always have been a fan on how the Source Engine console worked, I might even use it in a project I'm planning. So, how about it? 

Link to comment
Share on other sites

Again, Luawerks was written in C++. There are many problems distributing it like that.

  • Leadwerks updates every few months. So it's a cat and mouse game keeping it updated and making sure projects work out of the box. Pre-compiled apps are a no go also. 
  • We'd have to test on all platforms that Leadwerks supports. While this was OK with Windows and Linux, but soon the engine will support macOS and I don't have a Mac!
  • Most people use Lua with Leadwerks. The developer for "A Demon's Game" didn't know C++ and if a bug happened or something wasn't quite right, they would have to wait on me to get back to them. I felt like I was taking control away from people.
  • With the full API, you have access to all public functions and members; fully supported or not. You can wake up one morning to an engine update and your code is broke because Josh did something to make the engine better. (Short or long term)
  • C++ programmers can be picky about how things are done. Even I'm like that! 
  • It's easier to debug and fix lua errors than application crashes. Also I had a case in which the app ran fine for everyone but one person. 

Speed isn't an issue as no to very little mathematics/weird calls are preformed in the script. I'm currently converting Luawerks for a paid release on the Workshop. Pretty much I'm just adding polish to the code, and documenting everything I feel the user should know about. I'm not sure about being ok with what you want to do unless it's for personal use. I'll keep you informed tho.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

  • 3 weeks later...

Luawerks will be updated for 4.4. I used Joshes recent menu to integrate it with the rest of the framework. 

Done:

  • Options will be saved to the cfg file upon hitting the apply button. Don't worry, it still changes the world settings too!
  • The new console interface is working.
  • Backwards compatible with 4.3.

To Do:

  • Figure out why the font looks garbled.
  • Find out how to change Fonts and colors for certain text. (The old console highlighted warnings in yellow and errors in red.)
  • Console user history, In the previous console, if you hit the up arrow you can cycle through previous entries.
  • Find the backup of LEX and see where I put the buttons and game logo. Going to recreate that.
  • I still need to support basic backgrounds when a map isn't loaded. If I have time, I'll add support for background maps.

luawerksgui.JPG

  • Upvote 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Looks like Luawerks is coming along nicely. Good work Reepblue.

 

// Console command: 'lua_run' - Executes lua string.
DECLARE_CONCOMMAND(
	"lua_run", 
	[](int argc, ARGS argv) {
		if (GetConvar("sv_cheats").GetInt() != 1) 
        	    return Leadwerks::System::Print("\"sv_cheats\" must be \"1\" to execute Lua code using \"lua_run\".");
		std::string _execString;
		for (const auto& value : argv) { _execString += value + ' '; }
		int stacksize = Leadwerks::Interpreter::GetStackSize();
		Leadwerks::Interpreter::ExecuteString(_execString);
		Leadwerks::Interpreter::SetStackSize(stacksize);
	},
	"Execute string on the interpreter's lua state."
)

 

 

The above code is kind of ugly because it doesn't handle errors so if your code errors the application crashes. Would like to find a way around this in the near future. Also it has a trailing space, which shouldn't hurt anything.

Link to comment
Share on other sites

27 minutes ago, Crazycarpet said:

Looks like Luawerks is coming along nicely. Good work Reepblue.

The above code is kind of ugly because it doesn't handle errors so if your code errors the application crashes. Would like to find a way around this in the near future. Also it has a trailing space, which shouldn't hurt anything.

Oh yeah, found that out myself. Not only the game crashes, but if it's hooked to the debugger, the editor will also crash, lol. 

Fixed my fullscreen issue, I really need to figure out how fonts work with the GUI as they still look broken, but everything else is pretty functional. 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Not sure if you know this, but there is some funny stuff I did with the error function to make the debugger catch errors.  See the code in the default App.cpp file.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Redid the UI. I had to make two GUI's for different font size support, but hopefully the widget class/scripts will allow this with just one GUI in the future. Also removed <4.3 support in the next build to keep the code clean.

Oh also implemented simple networking. It's really just a glorified chat box. I also did a chat box panel for communicating with players; not really gonna talk much about it since it's still very rough. I just got the options menu to redo with custom control support. 

luawerksgui2.PNG

  • Upvote 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

The text field will emit an event when it loses focus or when the user presses enter, so you don't necessarily need that send button if you don't want it.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Send button looks nice though, plus sometimes you find yourself looking around for say in the future a server IP or something in another menu before finishing whatever you're typing. (Example: In source sometimes you'll type "connect " then go find the IP and paste it in.)

Link to comment
Share on other sites

8 hours ago, Josh said:

The text field will emit an event when it loses focus or when the user presses enter, so you don't necessarily need that send button if you don't want it.

That button is there mostly for aesthetics as not having one makes it look weird. Most chat applications still have a send button, and I think it falls under the same dilemma. It's 90% useless, but if you remove it, something will feel off. 

  • Upvote 2

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Pretty much final now. I removed my mess of networking and my menu GUI is just a set of buttons that open panels via console commands! Only thing left to do is to add a "Controls" tab in the options menu, but I'm still investigating how that'll work. The functionality already exists, the issue is what Widget would be best.

Now I'm just gonna spend the next few days polishing, bug hunting and updating documents. I'll push this update when 4.4 goes gold as you now need 4.4 for this to work. 

luawerksguifinal.PNG

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...