Can someone point me to a good tutorial or place to learn how to deal with online single player.
In other words, the main assets, code, algos are all done on the server or backend while the user mainly
just controls the player and does actions on the frontend (client). I think I saw some tutorials, but not sure
if they apply to this scenario, I think they are meant for actual multiplayer.
I just don't want the clients/users to use my algos/codes by simply looking in the archive/exe, I want to
protect at least something.
Thank you!
online single player
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: online single player
https://love2d.org/forums/viewtopic.php?t=85955
Shortly:
There is no reason to protect code, just add to your project license, which doesn't allow to distribute your game by someone else
Shortly:
There is no reason to protect code, just add to your project license, which doesn't allow to distribute your game by someone else
Re: online single player
Let's assume for a moment I didn't mention the part about protection, is there an answer to my actual question?
Is there a way to create a client that has basic features and gets info/assets/functions from a server? So basically
I press UP on keyboard, this is sent to server, server does processing based on what UP does in that situation and sends to
client to move character up by one.
That's literally all I am looking for. I saw something for multiplayer, but not sure it applies to this scenario. Just
wondering if anyone can guide me a bit here. Thanks!
Is there a way to create a client that has basic features and gets info/assets/functions from a server? So basically
I press UP on keyboard, this is sent to server, server does processing based on what UP does in that situation and sends to
client to move character up by one.
That's literally all I am looking for. I saw something for multiplayer, but not sure it applies to this scenario. Just
wondering if anyone can guide me a bit here. Thanks!
Re: online single player
The basic concepts would be the same in both cases. You just have one player instead of many players.
You may be overestimating the ingenuity of your work if you're convinced that people will be so eager to steal it, even though you can't even figure out how to do it in the first place. You're in way over your head.
You may be overestimating the ingenuity of your work if you're convinced that people will be so eager to steal it, even though you can't even figure out how to do it in the first place. You're in way over your head.
Re: online single player
https://www.love2d.org/wiki/socketstepps wrote: ↑Wed Jul 28, 2021 9:56 pm Let's assume for a moment I didn't mention the part about protection, is there an answer to my actual question?
Is there a way to create a client that has basic features and gets info/assets/functions from a server? So basically
I press UP on keyboard, this is sent to server, server does processing based on what UP does in that situation and sends to
client to move character up by one.
That's literally all I am looking for. I saw something for multiplayer, but not sure it applies to this scenario. Just
wondering if anyone can guide me a bit here. Thanks!
https://www.love2d.org/wiki/lua-enet
For assets you can serialize data and send it to user to download, for example, like in any Valve's Source game, when you connect to server with custom map, server send to user map data so they can connect and play
For multiplayer stuff, you can, on client side, generate from frame to frame table and send it to server where server checks if data is correct and after that, sending back data
For example:
On server you have x position of player:
Code: Select all
playerX = 100
Code: Select all
map = {obj1 = {x = 10, y = 10}, obj2 = {...}, etc
On client side, you can start generate controls data:
(in pseudo code)
Code: Select all
local xPlayer
love.update = function(dt)
local dataDromServer = deserializeData(serverGetData())
xPlayer = dataFromServer.playerX
local sendData = {}
if love.keyboard.isDown("w") then
sendData.up = true
end
sendDataToServer(serializeData(sendData))
end
(still pseudo)
Code: Select all
local dataFromClient = deserializeData(getDataFromClient())
love.update = function(dt)
if type(dataFromClient.up) == "boolean" then
playerX = playerX + 1
end
sendDataToClient(serializeData({playerX, ..., ..., etc}))
end
(but you should remember about: packages loss, high ping, cheating, etc, etc, which not covered in my example)
All that problems highly depends on type of your game, on server perfomance, etc
More about that you, probably, can learn from google
Just try searching: "multiplayer game code architecture"
https://www.reddit.com/r/gamedev/commen ... hitecture/
https://www.gabrielgambetta.com/client- ... cture.html
- Gunroar:Cannon()
- Party member
- Posts: 1088
- Joined: Thu Dec 10, 2020 1:57 am
Re: online single player
Woah woah woah. He just wants an anwser, no claims of superhuman coding .
I think simple enet works. It can be used with sock.lua to make things easier. Reading the tutorials at sync.lua might also help your understanding. It's simple sending and recieving of string values.
Edit: Dang it, GVovkiv beat me to it while I was typing
I think simple enet works. It can be used with sock.lua to make things easier. Reading the tutorials at sync.lua might also help your understanding. It's simple sending and recieving of string values.
Edit: Dang it, GVovkiv beat me to it while I was typing
Re: online single player
I actually appreciate all the help with sample code there and links guys! Thanks a ton! <3
Re: online single player
I think it is effort misspent but if you insist then Google enet, Udp, Sockets.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Re: online single player
Yeah...Gunroar:Cannon() wrote: ↑Wed Jul 28, 2021 10:37 pm Woah woah woah. He just wants an anwser, no claims of superhuman coding .
I think simple enet works. It can be used with sock.lua to make things easier. Reading the tutorials at sync.lua might also help your understanding. It's simple sending and recieving of string values.
Edit: Dang it, GVovkiv beat me to it while I was typing
But it was better, if i know Engilsh so it will be easer to understand what i wrote
Re: online single player
Also, remember about rule:
"Never trust clients"
"Never trust clients"
Who is online
Users browsing this forum: No registered users and 71 guests