Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the float Name#Password
Comment
[*]Italic Text[/*]
[**]Bold Text[/**]
[~]Taimapedia Article[/~]
[%]Spoiler Text[/%]
>Highlight/Quote Text
[pre]Preformatted & Monospace text[/pre]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


How do i even design games? by James Heblingchidging - Fri, 14 Dec 2018 15:17:53 EST ID:VJfwbkxf No.37698 Ignore Report Quick Reply
File: 1544818673648.png -(66725B / 65.16KB, 816x1056) Thumbnail displayed, click image for full size. 66725
Hey guys. Tech-degree dropout here with a question too vauge / stupid for stack overflow.

I'm trying to work on a (mostly) text-based mmo (a pet project of mine).
I think I actually have a decent enough grasp on what im going to have to do in terms of design for the game-server and SQL implementations....

But one thing that puzzles me is how to implement scripting? I understand the basics, write out a text file in a script, parse and execute accordingly... but are there any best practices?
Currently I'm building my prototype in Java, but will probably do the final as a .net app in C#. I'd like to script as much of the game as possible but yeah... no clue where to start on that front. Any good literature / video tutorials would be wonderful. Thanks and sorry for the dumb question!
>>
Angus Pizzlefuck - Fri, 14 Dec 2018 15:47:10 EST ID:ztur2YT8 No.37699 Ignore Report Quick Reply
My personal recommendations:

  • Keep the scripting language itself as simple as possible. Just make it good enough to do what you need to do, of course.
  • Architecting exposure of your game engine concepts into the scripting language is something you should think deeply about. You'll need some way for the scripting system to interface with the game, and that should be done in a sane way that tries to balance ease of use from both the scripting side and the game code side of things.
  • If performance of your scripting language is a problem, then just lower the update rate. Most MMO games can go to really low scripting rates so long as players expect a turn-based game experience (for example, World of Warcraft updates its scripting 5 times per second, but updates character movement 30 times per second and they have lots of nice animations and sounds that play instantly so players don't really notice the delay when casting abilities or whatnot).
  • Make sure that your scripting system accounts for as many players as you want to have for your game.
  • Think about whether you want to have a "polling" or an "event-based" scripting system (or both). This decision is probably going to have large performance impacts on your game (and server-side performance is often the limiting factor in the maximum number of simultaneous players per server).
  • Consider using a pre-existing scripting language or scripting engine. Things like lua are basically made for this, and you don't have to build your own unless you want to.
>>
Phineas Lightford - Sun, 16 Dec 2018 04:09:43 EST ID:0u7XtIRD No.37701 Ignore Report Quick Reply
>>37698
first, off i'm not a java guy, so most below leans on C#

simple scripting can be implemented with text comparison or regex, along with a bunch of ifs or switch...cases. The key point is that the interpretation of the commands is quick, yet secure. You don't want a given command to "leak" into another command, for example. Stay away from "else ifs", your code will quickly turn to spaghetti.

i've often used regex and switch...cases to implement simple scripting and CLI stuff in various programs. For example (board might mangle this, sorry):

//command is regex'd from input

switch(command)
{
case "GO":
{
//now you regex search for the parameter
switch(parameter)
{
case "NORTH":
{// stuff for going north}
case "SOUTH":
{//stuff for going south}
}
}
default:
{
//this handles invalid input
}
}

Always have the default clause in place to handle invalid input, that way you get a nearly idiot-proof parser. I dunno if java does "default", but C# does.

A good start for your script language is to make a command reference sheet that describes each command, along with its parameters.
When you get started with coding, note down what methods are called on execution of the command (if any) for later reference. It helps having a simple map of what calls where and saves time down the road.

The most important part is drawing the line early between what the program handles and what is scripted. The more you want to script, the more you have to flesh out your language. At first I suggest you just use scripting for game "assets", ie. the text and available commands.
If you want to script the game mecanics also, then it can be added later, but the key is, you start simple and make sure that works well first before moving on.

In C#, the scripting itself should be implemented in a class library/DLL file, that way, you can reuse your script language anywhere. If in any case you think code could be used somewhere else, put it in a class library

Also have a look at different plugins for visual studio. There are lots and lots of useful stuff out there. Fody, for example can mash DLL files and other assets into the EXE so you end up with a single file, which is excellent for distributing a game client.

If you do your game on the .net core framework, OSX and linux users can play along too.

Another good VS tip: learn to triple slash (///), this triggers XML documentation. triple slash comments can be parsed by documentation generators (like Sandcastle) and helps IntelliSense help you... Even experienced pros don't do this (especially in company code), usually because they don't have the time "here and now" to do it... truth be told, that time will be paid back twofold in the end

also, for exception handling, use "throw;" not "throw new WhateverException;", why?, because it shaves off a significant portion of the stack trace. When you instantiate a new exception like that, only the first 40 or so entries in the trace are preserved.

happy coding ;)
>>
Augustus Birryshaw - Mon, 24 Dec 2018 16:51:08 EST ID:iMkSw2EC No.37715 Ignore Report Quick Reply
>>376986
Go on libgen.io and get the Game Design Workshop book by Tracy Fullerton, contains everything you need to do when planning a game prototype
>>
Martin Biggledale - Mon, 24 Dec 2018 21:19:39 EST ID:ztur2YT8 No.37716 Ignore Report Quick Reply
1545704379540.png -(54229B / 52.96KB, 1920x1050) Thumbnail displayed, click image for full size.
>>37715
Which one? There's five different ones.
>>
Nicholas Blackbury - Tue, 01 Jan 2019 23:14:51 EST ID:Vu8mgKGQ No.37721 Ignore Report Quick Reply
I'm trying to grasp gamedev as well, gonna borrow your thread for a little.

Want to do something for mobile/vr in a diablo clone or something akin to that.

My issue: Been looking at unity/unreal and both seem to be more like a glorified 3d modeler rather than a software development tool.
Creating my source code in the forms of scripts I create in the gui is not what I like. I'd rather have a traditional IDE, and just have some libraries to do things like loading rigged and textured 3d models and tell the engine to display them/ animate them.
I don't like to use the convoluted event model with check boxes and dropdowns but rather directly create my own semaphores / mutexes.

Is there something like FreeRTOS but for games? More low level than unity/unreal engine but more high level than SFML/OpenGL/Juice etc?
>>
Nicholas Blackbury - Wed, 02 Jan 2019 16:04:02 EST ID:Vu8mgKGQ No.37722 Ignore Report Quick Reply
>>37721
Wasn't planning to replying to my own post, but here we go
https://github.com/bkaradzic/bgfx

>Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

sounds good.

The question is can it load animated / rigged meshes I create with blender?
It's also a little bit too low level for my taste, I don't really want to have to handle pushing stuff to the gpu myself.
>>
Eliza Dinnerlotch - Sun, 06 Jan 2019 10:02:51 EST ID:/uES1IhA No.37723 Ignore Report Quick Reply
The only reason scripting languages are used in games is compile times. That's it. If you don't have brutal compile times, don't use a separate scripting language. Scripting languages typically come with a lot of downsides, like lack of static types and poor perf. Of course, make sure to separate actual configs and data into text files or whatever, don't hardcode it. Also, consider using a language that compiles quickly like Go. Go also has really nice networking built in.
>>
Eliza Dinnerlotch - Sun, 06 Jan 2019 10:04:39 EST ID:/uES1IhA No.37724 Ignore Report Quick Reply
Oh yeah. If you're still convinced you need a scripting language (you don't), just use one that already exists and is simple. like Lua or Lisp.


Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.