New players and saving.


So I had a few hour this weekend and last couple days to put some work on this project. So with my time I have finished up the new player system. I haven’t put a limit on characters you can make per account, I was thinking of limiting it to 5 but haven’t really decided.

On the choosing of stats I decided to go with a base line based on race, and have a pool of cps to place how you like. I really did want to go with the random roll, but I feel that gave some characters a better chance in the game and really could skew the game. So with a pool you can add more to health if your worried about hps, or str if would want to hit harder. And not stuck with what you rolled. Maybe someday I will go back to it, but maybe a hybrid with some random numbers with a smaller pool. Who knows.

So far I had kept everything text but I actually made a dialog on the client side to allow you to choose your stats. I thought it would be easier then doing it with some sort of command line style. It pops a small dialog that allows you to choose what to raise. It will only allow you to choose between your max or what the it was when it was opened or to the max cps you can place in there. And then once done it sends it back to the server to verify that it’s possible to come up with the stats you send back. I also keep all the creation on the server side to stop any client side hacking. Since this is java and parts can be read/edited don’t want anyone hacking in some lvl 1000 with 6bil for stats.

Then of course I worked on the player saving to the sql server. It saves your player when you exit the realm and every 5 min on the heartbeat timer. Also with this I re-wrote the heartbeat of the game. Before it was a continuous while look makes a ping check then sleeping for 2 seconds. But this is bad cause it will do all the saving work and other stuff later like combat checking. Well this would result in the timer being way off. So instead the Heartbeat does 2 things, it sleeps 2 seconds and starts a tick thread. That tread does all the work, so the heartbeat can keep going, and the tick thread can go about it’s business and do it’s work and not worry too much about timing. Since I think saving will do most the time eating, I have that as the last process so it can do what ever it wants. If it becomes a problem later maybe I will have to build in a check first before it starts or make it’s own thread that just does saving. Future problems.

So the next step is to work on the client so it looks decent better then just a straight box with a big ass connect button. And release a real early alpha. Then onto combat since I think everything should be out the of way so I can work on that.

Till next time…

Share