• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
WackyWormer

Programming a Lua MUD server, trying to accept keyboard input

13 posts in this topic

I'm trying to program a MUD server in Lua, as I've had a good bit of experience in writing scripts for the Mudlet client and Lua is the language I'm currently most comfortable with. I've run into a bit of a brick wall though. I'd like for the server, a console application, to accept keyboard input, so when I'm running the games i can interact as an admin from the server itself. The problem is, all the functions for accepting input in Lua are blocking functions. Should I just program a backdoor into the server, so I can connect as an admin from any telnet client? Or is there a simple way to accept keyboard input to the console app without blocking the rest of the script from running?
0

Share this post


Link to post
Share on other sites
What environment are you using to host your Lua scripts? If it doesn't already provide a non-blocking console API, it should be possible to add one, depending on the hosting program and OS.
0

Share this post


Link to post
Share on other sites
Bah, stupid phone.

Its the Lua for Windows package, if that's what you're asking.(Sorry, I'm new at this thing... all my Lua experience has been scripting in Mudlet, which auto compiles/runs the scripts for you. Over there, you just type the code out and save it.) Edited by WackyWormer
0

Share this post


Link to post
Share on other sites
Gotcha. So LFW has support for some useful libraries that you might check out, including CUI (console-mode UI package) and LuaInterface (which lets you interact with .Net software). You could try using CUI to do the console stuff, or just write a full-blown UI in C# or something and rig it up with LuaInterface.
1

Share this post


Link to post
Share on other sites
It's a bit unclear what exactly are you asking for. Have you got a MUD server already? If what you mean scripts for it, then you'r probably be writing the script, uploading it to the server (or writing it on the server directly) and then reloading it in the Lua VM. There isn't a problem of blocking user input here, so perhaps I'm misunderstanding you.

For a Lua MUD server, check out [url="https://github.com/endgame/MudCore"]MudCore[/url], which is build on pretty good stuff. I can't vouch for how well it would perform, I've only fiddled with it a bit, but the tech behind it is pretty solid.

It's cross-platform as well so you wouldn't be getting tied down to finding a Windows server for your hosting. Edited by Vadi
0

Share this post


Link to post
Share on other sites
If I understand the question correctly: "Is there some way to read console input on Windows with LUA without blocking the running thread?"
It does look like the CUI library has a "nodelay" option to allow polled input.
However, if I were to do this personally, I would add an attribute to users for whether they are allowed admin options or not, and just do it using regular logins.
If this scales up to a bigger system, you'd want to replace "is_admin" with a list of specific granted privileges, and test different privileges for different management functions. This would allow certain users to be "wizards" without being "admins."
1

Share this post


Link to post
Share on other sites
I've decided to go with the "client with admin privileges" idea. Now the only thing that concerns me is closing the server without shutting down the client connections. Is there any way to call a function when the console window is destroyed, like the WM_DESTROY event I remember using in my c++ apps?
0

Share this post


Link to post
Share on other sites
Not sure I'm understanding your question. What exactly is it you want to avoid? Do you mean you want the server to keep running even if you close the console?
0

Share this post


Link to post
Share on other sites
No, I'm worried that I'm never calling the client: close function, because I have no way of exiting the game loop because I don't have input directly to the server. Though I suppose that the client with admin privs could send a shutdown command.



0

Share this post


Link to post
Share on other sites
[quote]Yep, a shutdown command is the typical way to handle that.
[/quote]

If your game is designed to require a "clean" shutdown, then the first "hard" crash you get will destroy your game.
Design your game to survive any "hard" failure. If you need to shut down the server, just kill the process. (You may want to tell users a few minutes before, of course ;-)

Netflix takes this one step further: Because systems will fail, and all systems should be written to survive failure, they have a "chaos monkey" that will randomly kill servers/services. You have to design your code so that you survive this. It's a different way of thinking.
0

Share this post


Link to post
Share on other sites
This is a good point.

However, especially during development clean shutdowns can be extremely useful as you can use them to spot-check for leaks, things that don't clean up properly, and so on. In my experience making sure things can shutdown cleanly is a good first step to making sure they are also recoverable in the worst-case scenario.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0