Jump to content

How would you start coding an RP gamemode?


Geo

Recommended Posts

Hello, I've been lurking for quite some time, thinking about learning Lua and scripting my own server. I've experience programming and I've been reading about Lua for a while, so I decided to ride on the quarantine and code something in these dark times.

I've decided to start coding an RP gamemode from scratch. The thing is that I don't know where to start, I'm overwhelmed by ideas and I don't know what to execute first. What do you think every RP gamemode should rely on? What system would you code first to lay down the fundamentals?

 

Also, if you've any tips that you want to share, please do!  

Link to comment
  • Moderators
20 minutes ago, Geo said:

What system would you code first to lay down the fundamentals?

  • The management of initiated/loaded players.
  • Design different gamemode states. (loading/lobby/started)
  • Making a list of resources you might need, instead of building every component from scratch. You do not have all the time of the world and you will be demotivated after a while, so make sure you will be able to finish it, else it is a waste of time. (99% of the people will be demotivated after a while...)

 

Edited by IIYAMA
Link to comment
4 minutes ago, IIYAMA said:
  • The management of initiated/loaded players.
  • Design different gamemode states. (loading/lobby/started)
  • Making a list of resources you might need, instead of building every component from scratch. You do not have all the time of the world and you will be demotivated after a while, so make sure you will be able to finish it, else it is a waste of time. (99% of the people will be demotivated after a while...)

 


Hey @IIYAMA thank you for such an honest answer. Would you be so kind to explain with more detail what you mean by different gamemode states? Excuse my ignorance, but I don't know jack about what you mean by this point. 

For the rest, thank you so much! I'll keep your answer in my mind, most importantly your third point, I think every developer has come through an inspiration phase that ultimately leads to demotivation, hopefully that wont be the case with me! 

  • Like 1
Link to comment
  • Moderators
1 hour ago, Geo said:

Would you be so kind to explain with more detail what you mean by different gamemode states?

 

Little example:


local gameModeState = "initial"

function setGameModeState (newState)
	gameModeState = newState
end

function getGameModeState ()
	return gameModeState
end





addEventHandler("onResourceStart", resourceRoot, 
function () 
	setGameModeState ("started")
    
	setTimer(function ()
  		setGameModeState ("lobby")
	end, 1000, 1)
end, false)


addEventHandler("onPlayerJoin", root, 
function () 
	if getGameModeState () == "lobby" then
      -- do something
	end
end)

 

 

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...