StringsOnUDP

Standard

Good morniiiiiing vietnam! Today i bring you a tool that I’ve created for a game i am (still) working on. The objective of this tool is to keep sending strings through UDP protocol, to a local port, using dynamic commands that can be added in a .cfg file, one string for one command, you can concatenate commands in the application. You have the Server, where all the sweet magic will happen, and you have the Client which is there just for testing proposes. This is a little bit weird to explain (and I’ve only slept for 4 hours so, sorry for my lexical laziness) but I’ll cover it up with a small tutorial.

StringsOnUDP Github repo

Source Code

StringsOnUDP- Server and Client

StringsOnUDP- Server

You can always type help, where you will have the list of loaded commands.

StringsOnUDP – help display

If you want your Client to receive “walking forward”, you just need to type “send walk forward” and the Server will start sending “walking forward” without stopping, whenever you want to stop, just write “stop”, pretty straight forward.

StringsOnUDP – Sending a string to the client!

 You can also concatenate commands, using &&, e.g. “send turn left && shut up && … “. Since this is using UDP and it’s working really fast, you can’t rely on packages being received in correct order, it’s normal if you receive 3 strings from the same command and only one from the second.

Usefulness of this? Well, i’ve used one tool similar to this ( this one is cleaner and more general than the original one) to emulate a motion sensor hardware i used in a game i was making, the hardware sent udp data regarding the direction of the movement and in which camera it was captured, afterwards i used that information in my game. Additionally, this could lead into a basic multiplayer solution for a game, feel free to use the source code as you wish 😉

That’s all for now, hope to bring one new surprise later today!

Again, you can get the source code of this in my GitHub:

StringsOnUDP Github repo

Source Code

Feel free to contact me anytime!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s