my fps network game

Return to Showcase

my fps network game

Postby adr » Mon Feb 01, 2010 12:20 am

Hey everyone ^^ I know I'm not really fast at making games or anything, or that my code is good in anyway if you haven't notice all my questions, but I bring you what I have done in my free/spare time. It isn't much, but maybe you'll have fun playing with it here and there. Its a fps style game for atm that I want to maybe turn into a fps mmo later on.

I know there are a few bugs. Collision has always been my weak point... I just can't get it to work right ever with my maps. If you see my error and can fix it, do share lol. Collision code and be found at line 2418 (or some place close to that, should notice a collision def).

Anyways here you go. I added both a .7z and a .exe for you so you dont have to down load a big .exe.

http://www.sendspace.com/file/hwky0d - zip
http://www.sendspace.com/file/j514xd - exe
http://www.sendspace.com/file/k09e9z - patch

The game may need to download a patch on start up, so if the game crashes on you the first time, you just have to restart the game.

wasd keys are to move
space to jump
shift to run faster
c to crouch
scroll or numbers to switch guns (sniper and mrifle)

You'll also need to make an account. Just click "Creat A New Account". Dont worry about all thos arta things, just type in a name and password using letters and numbers, no spaces, then click creat new account. You'll return back to the log in screen, then just relogin using your new account.

To Do List:
-1. Fix collision with smaller walls.
-2. Fix os.calls to work under linux.(May stop patch from working on linux os, download the patch from above and unzip it right in the main folder where main.py should be.)
-3. Setup final editing screens.
-/-5. Fix downloading patch to download all the patches instead of w/e next in the line. (read fixs for Build02xx2010)
-6. Need to fix crash after downloading the patch. Not sure how to fix. sys.exit() doesn't work.
-7. Add more shaders/looks, water and sun light.


Fixs: (Build02xx2010)
^1. Fix compression code.
^2. Fix other little bugs/problems that I saw in unworking code.
^3. Fix downloading patch to download all the patches instead of w/e next in the line.
----(Work around: Cus users are downloading the "patch", user will only need the newest one, but this does increase download time.)
^4. Added Speed startup/loadup time. Threading/task chain to spread the work.
^5. Fix bullits flying over head or below user.


Fixs: (Build02032010)
^1. Fix error with scroll list arrows still showing after entering text in the feild box.
^2. Fix some compability issues with linux os.
^3. Fix invter mouse invtering the x axis.
^4. Fix some issues with clients going down/lossing connection.
^5. Added another collision system.
^6. Fix some networking code to lessin a little more lag.
^7. Fix other little bugs/problems that I saw in unworking code yet.
^8. Fix sound bug -music not looping-.
^9. Fix and added a little more speed boost to server.
^10.Fix bug where gun wont line up the right way.

Have comments, or want to share ideas, please do so below. I would love to hear them or help if I can.
Last edited by adr on Sat Feb 06, 2010 8:40 am, edited 10 times in total.
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby Eraslt » Mon Feb 01, 2010 2:17 am

wow, really nice :)

did u put all the code in one file? :D
Eraslt
 
Posts: 47
Joined: Tue Dec 08, 2009 2:29 pm
Location: Lithuania

Postby astelix » Mon Feb 01, 2010 5:32 am

Sending Version data-> Build07052009
Version Check Number-> 0
Downloading UpDate
Couldn't read Build01312010.zip.
0/2 = 0%
1/2 = 50%
2/2 = 100%
Writing the zip file.
Reading the zip file.
Couldn't read Build01312010.zip.
Done
Error 901


the patch arrives here (linux realm) as a broken zip - do you got a workaround, maybe a web location where to download it?
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby radu » Mon Feb 01, 2010 6:37 am

update went fine on win32, but after login crashes with out of memory message.
will get back to you.
Adopt a Panda (thread)
and get your funky Panda avatar here
User avatar
radu
 
Posts: 150
Joined: Fri Nov 06, 2009 11:09 am
Location: Bucharest

Postby Eraslt » Mon Feb 01, 2010 6:52 am

for me works fine on xp 32

quite buggy with stairs
Eraslt
 
Posts: 47
Joined: Tue Dec 08, 2009 2:29 pm
Location: Lithuania

Postby adr » Mon Feb 01, 2010 9:32 am

Eraslt wrote:wow, really nice :)

did u put all the code in one file? :D


Yes I did. I been wanting to strip all the code out and place it in many files, but everytime I get around to do it I get to saying it's to much work for one user lol.

astelix wrote:the patch arrives here (linux realm) as a broken zip - do you got a workaround, maybe a web location where to download it?


I do, but could you help me figure out why it's broken on linux? Could you send me the patch that was sent to you so I can read it's binary data for starters and thats werid... It tried to read the .zip right off the bat when it should've waited to till the end to read it.
http://www.sendspace.com/file/3w1xo4 -patch. Just unzip it right in the main folder; it should replace main.py and savedata.bin.
Code: Select all
Checking Version
Sending Version data-> Bu
Version Check Number-> 0
Downloading UpDate
0/2 = 0%
1/2 = 50%
2/2 = 100%
Writing the zip file.
Reading the zip file.
Done
Error 901


radu wrote:update went fine on win32, but after login crashes with out of memory message.
will get back to you.

Not sure on this one. How much ram do you have on your system? Also, how much video ram do you have if you know.



Yea the buggyness you see for the stairs is caused by my weak collision sadly. Atm theres a collision ramp to help go up them, but at the same time it pushes you back down. Shooting collision works fine, so if you can find some people to play with, you'll have a blast shooting each other lol. I keep server up all the time, so no worrys about it being down (I hope).
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby astelix » Mon Feb 01, 2010 9:41 am

adr wrote:I do, but could you help me figure out why it's broken on linux? Could you send me the patch that was sent to you so I can read it's binary data for starters and thats werid... It tried to read the .zip right off the bat when it should've waited to till the end to read it.


sure - there you go
and this is the traceback output:
Code: Select all
['Traceback (most recent call last):\n', '  File "main.py", line 3801, in <module>\n    Game()\n', '  File "main.py", line 111, in __init__\n    self.VersionCheck()\n', '  File "main.py", line 247, in VersionCheck\n    self.LogOut()\n', '  File "main.py", line 1283, in LogOut\n    sys.exit()\n', 'SystemExit\n']           

Major bug, sending data to server to be look at in 60 seconds.
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby adr » Mon Feb 01, 2010 9:45 am

Oh ok, yea like I said at the top. You'll get that error, just reload the game and it should work fine. For w/e reason, sys.exit() mess the game up when you call it there at the start. Everplace else sys.exit() works fine.
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby astelix » Mon Feb 01, 2010 10:00 am

by the way you should test the msvcrt import cos in linux there isn't something like that - to go on I'd to comment it
keep up the nice job
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby adr » Mon Feb 01, 2010 10:08 am

astelix wrote:by the way you should test the msvcrt import cos in linux there isn't something like that - to go on I'd to comment it
keep up the nice job


Alright, it's check and fixs for the next patch, thanks for the heads up on that and playing/testing it. :)

I'll take a look at the handler you said to see if it'll work for my needs.

I'll also look into linux to see what up in there. I'll have to download a virualbox, is there anything spical I'll need for linux?
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby astelix » Mon Feb 01, 2010 10:11 am

as I said in chat I'm going to write a tutorial on that topic, hopefully tomorrow will be ready

about linux I suggest you to burn ubuntu and install it in a partition so you got a solid environment - I don't like very much 'virtual boxes' anyhow I tested other virtual machines but they got always hardware problems with games and I try to avoid 'em if I can.
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
User avatar
astelix
 
Posts: 866
Joined: Mon Mar 27, 2006 4:36 pm
Location: Milano, ITA

Postby radu » Mon Feb 01, 2010 11:37 am

Also, would you care to post some information (if not the code itself) on what is happening server side? At least some details on technology and such.
Adopt a Panda (thread)
and get your funky Panda avatar here
User avatar
radu
 
Posts: 150
Joined: Fri Nov 06, 2009 11:09 am
Location: Bucharest

Postby adr » Mon Feb 01, 2010 12:34 pm

radu wrote:Also, would you care to post some information (if not the code itself) on what is happening server side? At least some details on technology and such.


Not yet. Wanting to finish two more things on server side before I release the code. Almost done, but I'll take me a few weeks I think (commenting and testing to make sure everything works). Atm, it is using a ram disk system to load and off load user profiles to help speed up both writing and reading with another thread backing up the files off to another disk (HDD). I found this to be super faster with little risk to user data. Atm should support up to 5-10 people I think. I really would like to test that thory out if maybe you want to inv some friends to play at once with you as you test it.

(not 100% done)
I'm also supporting what I call frames. User sends frames of either compress or uncompress data to server at .1 intervals. Server threads tho the requested information and then recomplies them back into a frame to be sent to other users or back to client.

Frames are sent as either compress or uncompress depanding on their size. aka as long as the compress version is smaller than the uncompress one.

(Haven't started yet, but will soon; it still need more thought. (Do this as number 2))
Another will be what I call boosting. One of the problems of running a home made server is that your upload speed is not as fast as your download speed. To get around this, server will send a spical packet to the fastest client running the booster code to send to another client that has to wait for the sever to be able to free it self to send more data. The client that is waiting will get the data instead from the fastest person running the boostr code and then send a checksum to server to make sure its the right data before trying to run the code. This results into less data having to go out from the server to client resulting in turning your download into your upload. Cus the check sum is bigger than your resulting "ok" from the server.

(Something I would like to do later (or do this as number 2))
Find a way to "guess" where users are going and then only update when they stop instead of just sending their position every few sec. This would cut down banwith by a lot too. Aka, if user is moving then keep moving that user in that diraction untill server sends a change in speed or diraction.
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby enc » Mon Feb 01, 2010 4:35 pm

Im crumbling my head over similar problems(home server upload speed)

Your booster system:
It can work as long a the client you use for boosting does not go evil.

Yet another way if you are already trusting clients that much is to isolate smaller groups into p2p solution, and once in a while do a checking with the server and the "master" of the p2p group(the best bandwidth pl).
Works only if the groups dont interact with each other.

Yet what im really intrested is:
How often do you send info to server?
I do not send more frequently than 0.1 sec.(UDP package that contains:move direction,pl look angles, and position)

How often does the server send info to players?
For me its same 0.1 sec.

How big are your packages?
The package the client sends to server
And the package the server sends to clients

And last not least how do cheack the pos difference of client and server? and how do you sync it?

Thank you
Know your self and you shall know everything you need to know.
My games: http://moba.ee/
My doodles: http://hendrikkangro.deviantart.com/gallery/
enc
 
Posts: 166
Joined: Wed May 27, 2009 3:35 am
Location: Estonia, Tartu

Postby adr » Mon Feb 01, 2010 5:01 pm

enc wrote:Im crumbling my head over similar problems(home server upload speed)

Your booster system:
It can work as long a the client you use for boosting does not go evil.

Yet another way if you are already trusting clients that much is to isolate smaller groups into p2p solution, and once in a while do a checking with the server and the "master" of the p2p group(the best bandwidth pl).
Works only if the groups dont interact with each other.

Yet what im really intrested is:
How often do you send info to server?
I do not send more frequently than 0.1 sec.(UDP package that contains:move direction ,pl look angles, and position)

How often does the server send info to players?
For me its same 0.1 sec.

How big are your packages?
The package the client sends to server
And the package the server sends to clients

And last not least how do cheack the pos difference of client and server? and how do you sync it?

Thank you


Thats why there is a checksum to make sure the client doesn't go evil. If the checksum doesn't report what the server sent, then that data is discared (zero out).Nothing is writen. Mines more of a p2ps, the server is the one that still says what works and what doesn't.

Client send info every .1 sec (event driven), Server sends data as needed (event driven and banwith driven).

Tcp Packages rang from 4 bits to 64 bits.

I let client and server do both moving. Client tells server I'm moving (client moves), server checks to see if he can move (if not, server tells client no), then data is updated on the ram then is later saved in the HDD (usally all done in .001s). I haven't done any really sync yet. I have done it for the bullits but sync position seems like a waste sorta. Yea the user can cheat and "move" to some other place, but the server still knows where he is, so it doesn't really matter. (but then again, I haven't tried cheating my own game yet, so idk if that is actully working atm lol.)
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby enc » Mon Feb 01, 2010 6:55 pm

I haven't done any really sync yet


Ok but how do you overcome something like this.
Lets say clients average ping is ~250.
Client starts to move forward at speed of 1.
Info arrives at server lets say after 0.2 seconds.
Server starts to move player forward at speed 1.
After 1 sec of moving you stop the movement.
Info arrives at server lets say 0.3 seconds later.

Now on your machine you moved for exactly 1 sec at speed of 1. While on the server your player moved for 1.1 seconds at the speed of 1.

Real quickly strange stuff starts to happen, unless of course you are doing, setPos and move direction+speed, but then the server loses the saying.

One more Q:
Do you have player vs player collisions?
Know your self and you shall know everything you need to know.
My games: http://moba.ee/
My doodles: http://hendrikkangro.deviantart.com/gallery/
enc
 
Posts: 166
Joined: Wed May 27, 2009 3:35 am
Location: Estonia, Tartu

Postby adr » Mon Feb 01, 2010 7:48 pm

enc wrote:
I haven't done any really sync yet


Ok but how do you overcome something like this.
Lets say clients average ping is ~250.
Client starts to move forward at speed of 1.
Info arrives at server lets say after 0.2 seconds.
Server starts to move player forward at speed 1.
After 1 sec of moving you stop the movement.
Info arrives at server lets say 0.3 seconds later.

Now on your machine you moved for exactly 1 sec at speed of 1. While on the server your player moved for 1.1 seconds at the speed of 1.

Real quickly strange stuff starts to happen, unless of course you are doing, setPos and move direction+speed, but then the server loses the saying.

One more Q:
Do you have player vs player collisions?



I guess you can hit it at it two ways. One would be to just except there will be lag and go on (lol). The other is find out how bad the lag was. To do this, the client will have to send a time stamp when the client has requested to move. The problem with that idea is that a user could hack by changing his or her time clock a few time resulting in the system speeding up or slowing down the time stamp msg. This happens to a lot of online game that try this. The other way around this is to just figure out the users ping/speed at whitch the client sends data and then take that off the lag between calls.

So, taking your example. The user moved for 1 sec at the speed of one, but the lag caused the server to think the client ran for 1.1. To get around this, server ping client a few times for a base data speed, then except new data -ing the data rate lag, so server now thinks the client ran for 1 -+.1 sec.


That build does (good luck trying to find it lol), but I did some collision rebuilding, so not sure if'll work with the new patch I'm about to put up. (maybe)
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby adr » Wed Feb 03, 2010 12:52 pm

kk I just wanted to say I updated to the new build. Hope its more stable than last one.
adr
 
Posts: 532
Joined: Wed Oct 12, 2005 8:26 pm
Location: USA

Postby EdBighead » Thu Feb 03, 2011 2:04 pm

Links are broken. Realize this thread is a year old. Any chance we can get a look at the server stuff?
EdBighead
 
Posts: 109
Joined: Tue Jan 18, 2011 12:14 pm
Location: U.S.


Return to Showcase

Who is online

Users browsing this forum: No registered users and 1 guest

cron