my fps network game

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. - zip - exe - 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 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.

wow, really nice :slight_smile:

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

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

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

for me works fine on xp 32

quite buggy with stairs

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.

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. -patch. Just unzip it right in the main folder; it should replace and savedata.bin.

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.
Error 901

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).

sure - there you go
and this is the traceback output:

['Traceback (most recent call last):\n', '  File "", line 3801, in <module>\n    Game()\n', '  File "", line 111, in __init__\n    self.VersionCheck()\n', '  File "", line 247, in VersionCheck\n    self.LogOut()\n', '  File "", line 1283, in LogOut\n    sys.exit()\n', 'SystemExit\n']            

Major bug, sending data to server to be look at in 60 seconds.

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.

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. :slight_smile:

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?

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.

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.

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.)

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)

kk I just wanted to say I updated to the new build. Hope its more stable than last one.

Links are broken. Realize this thread is a year old. Any chance we can get a look at the server stuff?