Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 23 Jan 2015 02:48 AM |
| Are there any examples or articles about how to structure complicated games with lots of code? I can't seem to find anything suggestions ways I should go about structuring my game. I'd rather not have to refactor it as much later on! :p |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2015 03:06 AM |
You could: 1. Create an idea and map out every single detail and once you know you have everything go to step 2. 2. Create everything that you imagined to the letter. Don't follow moments of inspiration. Solely do what you planned.
Now the above may seem like a joke, but there is no perfect way to create a game and not have to go back and change things to incorporate it later. Part of the joy of scripting is the joy of typing 1000 lines of code only to have to go back and add another 500, fix 63 bugs, debug 100s of lines of code, make tiny spelling errors, having Roblox crash, scrap the whole script in favor of a new method, realize that that method is an incompatible way but you lost it and have to start over from scratch. But then when we finish, we get to see our imagination turn into a digital object. Having to go back and "refactor" weeds out the weak minded and makes us better in our craft.
There are some things you can do though. When writing your script, foresee what you later want to add on, make your scripts flexible or ready for additions, write comments on your script for what you want it to do or what it does. I can go on and on, but the point is that there is no perfect process or easy way to make large complex games from scratch in one go. |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2015 03:18 AM |
For me the best way to win a match is knowing the map...So to make complex games,you should know what to do and all of the things you need.Inspirations are helpful, too
I haven't learned all about scripting because I have to time...So enjoy yours
The time you enjoy wasting is not wasted time :P |
|
|
| Report Abuse |
|
|
Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 23 Jan 2015 10:36 PM |
| Yes I understand that but what im asking is are there any examples or documentation about best practices to make a large complex game? I'm ok with refactoring I'd just like to have my code better to start out with instead of finding out that it doesn't scale well later on. Also, sorry, im having trouble working this. |
|
|
| Report Abuse |
|
|
BowtieMod
|
  |
| Joined: 01 Apr 2013 |
| Total Posts: 804 |
|
|
| 23 Jan 2015 10:41 PM |
Split it down to components
Make everything easier by working with higher-level language
InitializePlayer() SpawnCharacter() LoadCharacterItems()
is easier to read than
local stringval = Instance.new("StringValue", player); stringval.Name = "cash"; player:LoadCharacter() repeat wait() until player.Character and player.Character:FindFirstChild("Head"); for _,v in pairs(playerInventory) do ...
You get the point |
|
|
| Report Abuse |
|
|
j1my3p1x
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 978 |
|
|
| 23 Jan 2015 10:47 PM |
| jesus you guys make it sound like its an art just write stuff who cares if your code is ugly wow |
|
|
| Report Abuse |
|
|
|
| 23 Jan 2015 10:51 PM |
Ugly code will result in messy bug fixing. Messy bug fixing can break other things while you try to fix one thing. What I recommend is to try to make your own structure that you think would fit your type of game. One thing that helps me make clean code is, "What if I want to show the scripts to my friend (educational purposes) and I want him to understand these scripts easily?" |
|
|
| Report Abuse |
|
|
BowtieMod
|
  |
| Joined: 01 Apr 2013 |
| Total Posts: 804 |
|
| |
|
Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 23 Jan 2015 11:06 PM |
| Programming is absolutely an art. |
|
|
| Report Abuse |
|
|
vacharya
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 511 |
|
|
| 23 Jan 2015 11:07 PM |
| lol I seperate my art into chunks with "-----" for a whole line.. Also if you forget to indent your art, dont forget.. |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 23 Jan 2015 11:11 PM |
My code is messy
Rather than doing junk like
while wait() do print(#Game.Players:GetPlayers()) if #Game.Players:GetPlayers() > 0 then print('ye dere r players') end end
I do junk like
while wait() do print(#Game.Players:GetPlayers()) if #Game.Players:GetPlayers() > 0 then print('ye dere r players') end end |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 23 Jan 2015 11:17 PM |
That is not efficient either
while (game.Players.NumPlayers < 2) do --[[Meaning you need 2 or more players]] game.Players.PlayerAdded:wait() end print("There are enough players") |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2015 01:45 AM |
Or just assign proper names to functions like what they really do.
The time you enjoy wasting is not wasted time :P |
|
|
| Report Abuse |
|
|
|
| 24 Jan 2015 02:09 AM |
@ j1my3p1x I assume you are referring to my post. If so know that that was what I was going for. The way each person codes is unique, and I believe that it can tell a lot about the person. But I digress, that is for another day. |
|
|
| Report Abuse |
|
|