Page 1 of 1
Practising with SFS. First attempt: Car Race
Posted: 10 Jun 2008, 11:42
by Muwampa
Hi, there!
I'm taking my first steps using SFS and I'm developing a simple Car Race Game with SFS Pro Free (20 connections). I've made a working beta but I have two questions:
1) I'm sending a PublicMessage in order to compute the position of every car in every moment. Each car receive this message and compute the positions of others. Will it better if I wrote that code as AS Server Extension and only send the computed positions to every car instead of receiving a PublicMessage?
2) I've noticed that running an .EXE compiled Flash Window runs better (less lagged) than loading the SWF application in a web browser as usually on Internet (so IE and FireFox). How can I reduce or fix this "lag" on web browser? Any Server configuration issue?
Thank very much.

Re: Practising with SFS. First attempt: Car Race
Posted: 11 Jun 2008, 07:10
by patso
Muwampa wrote:
1) I'm sending a PublicMessage in order to compute the position of every car in every moment. Each car receive this message and compute the positions of others. Will it better if I wrote that code as AS Server Extension and only send the computed positions to every car instead of receiving a PublicMessage?
Yes. First it's more secure - because you can add some validation code and synchronization code(almost mandatory if the cars can collide).
Muwampa wrote:
2) I've noticed that running an .EXE compiled Flash Window runs better (less lagged) than loading the SWF application in a web browser as usually on Internet (so IE and FireFox). How can I reduce or fix this "lag" on web browser? Any Server configuration issue?
If you mean that flash runs slower in browsers than in stand alone player this is issue related to flash. In fact the flash plug-in performs different on the different browsers.
Posted: 11 Jun 2008, 07:36
by Muwampa
Thanks a lot for your fast answer!
By now, collisions are not a problem beacause I know it'd be difficult to manage for lag. This is meant to be a simple car race when piloting and time it's more important than collisions.
Well, I've been reading and reading tutos docs and SFS Pro documentation and I'll test it using an extension. Every car will send a raw code with its position and server will reply to the other cars in order to update this position. I hope it will work. I would appreciate you warn me if you see a design error in my schema.

Posted: 11 Jun 2008, 14:42
by Muwampa
Dunno... Well, which browser is the best for Flash performance?

Well, using an AS extension works better by far! It's a pitty I've had to get rid of a special script to implement a GTA 1 zoom-system. It seems that moving and rescaling stress the plug-in and it felt much laggy (and I didn't want to give up so stunning graphics -I'll post a screenshot soon-).

Though, testing in our LAN, and using the SFS Web Server, it seems to be a little lagged (rather than in stand alone player, course). Do you know if it's realistic with the performance in Internet, will be better, worse?

And an architecture question -if you'd be so kind, please-: By now, every client, when car acelerates, brakes, turns, etc. calculates his own movement and send new coordenates to server to broadcast other players. Would it be better to send server only the state of the keyboard (boolean array) so the server calculate new position and then broadcast?
Thank you very much for your support. I expect SFS to be our server software and the one.

Posted: 16 Jun 2008, 12:27
by patso
Muwampa wrote:Dunno... Well, which browser is the best for Flash performance?
I don't know. Anyway it should be fast enough to run on all browsers. Actually the problem is not much about the exact browser but the client configuration - keep in mind that not all users have fast computers.
Muwampa wrote:

Though, testing in our LAN, and using the SFS Web Server, it seems to be a little lagged (rather than in stand alone player, course). Do you know if it's realistic with the performance in Internet, will be better, worse?
The difference between the LAN and internet is the bandwidth and the ping and of course with internet is worse.
Muwampa wrote:

And an architecture question -if you'd be so kind, please-: By now, every client, when car acelerates, brakes, turns, etc. calculates his own movement and send new coordenates to server to broadcast other players. Would it be better to send server only the state of the keyboard (boolean array) so the server calculate new position and then broadcast?
In general is better the clients to send to the server only commands(for example accelerate, brake, turn left and so on) at given interval and the server to calculate the positions. This will increase the server load of course. You said your game is simple so I suppose the calculations are not complex so this load should not be so big(if it is big at all). Anyway I don't know what is the performance of the AS extensions(I understood that you use AS for the server-side extensions or I'm wrong?)
Posted: 17 Jun 2008, 05:22
by Muwampa
Yes, we do. But reading this forum we're keeping in mind to translate it to Java, for a better and fast management.
And now it comes the time for us to test different ways: I understand what you're telling me, but we prefer that client's car animation is smooth and clean. We'll test first how it works simulating at client and sending to server to check collisions and broadcasting new positions.
Thank you for your answer.
