ID:269570
 
Logging in,

To do your logging in from a savefile in client/New()?
client/New()
if(usr) return ..() //reconnecting to existing mob
else
var/player_sav = "players/[ckey].sav"
if(length(file(player_sav))) //if player savefile exists
var/savefile/F = new(player_sav) //open it
F >> usr //create saved mob
return ..() //creates a new mob if necessary

(Code from Reference, see"client/New()")

Or doing it from mob/Login()?


Title screen,
Is it better to create a object prototype for your title screen and place an instance of it on your map.

Or

Add it to your client.screen list? Oh would sending your mob to null have any effect on efficiancy?


Can you add a Title screen to your client.screen list in client/New()? If you can is it more or less efficiant?


Thank you for your answers and time.
bump
These posts are getting silly.

Loading from savefiles or doing title screens itself is no more efficient wherever you put it. However, all these posts about efficiency on such a small scale that it will affect the game one time and only for a fraction of a millisecond are useless, as it doesn't matter anyway.

Getting that 3 nanoseconds of time shaved off is not going to do you any good. Look at the way some of those accepted as good programmers do their work. Heck, LummoxJR's examples are super-redundant sometimes, checking the same info to make sure it is valid two or three times even when it should be sound and probably doesn't even really need to be checked at all. You do not have to look for every fraction of a second you can remove.

As a general rule, if it doesn't affect the game to the point where the players can see a difference, then there is no problem. Of course, you have to take into account the fact that slower computers will see differences in some things that faster computers will not; but what you and others have been asking about isn't quite valid even then.

If you truelly want to get efficient and make things run smoother, there are some culprits you should check out first.

Firstly is loops; for-loops, while-loops, and even goto-loops if you are actually using them for some odd reason. Especially loops which iterate a lot of times. If it loops 1,000 times without stopping, even something that takes a few tenths of a millisecond will start becoming noticable when put inside the loop. For this reason, make sure you do not put any unnecessary code inside a loop; if it can go outside the loop than put it outside.

Next is functions that get called a lot. If a function is called 100 times per second or more, then you might want to optimize it. To go a step further, you can also stagger the function calls so that they are not all called at once. It helps if they are called ten times per tick instead of 100 times all at once heaped onto the same tick.

Those are going to be your two biggest culprits.

Now, there is another thing that can help you. Byond is nice enough to be able to run functions in the background. This means that they sleep until the next server tick if the workload gets too high, therefor not bogging the system down. Do this in any functions that do a lot of work and/or get called a lot if it is not vital that they finish immediately. Remember though, this can cause the same types of bugs that input and alert can, as certain data might not be valid anymore by the time the function picks back up where it left off. That is why you need to be picky about what you use it in.

To wrap it up, there is no reason to worry about the differences between client/New and mob/Login efficiency wise, unless just for curiosity's sake. It is so extremely slight and insignificant that you should do the programming how you want.