Posted by SillyCow
on 28 September 2013 - 03:18 PM
1. Yes identify your clients. Usually a server has more than one game at a time. So besides "not mirroring client 1 back to itself", it's also about "not sending client 3 which is in another game" back to clients 1 and 2.
2. You can use asynchronous io. Look up TCP IO selector on google. It can handle many connections on a single thread. The problem is that It is more difficult then using threads, so if you only have less then 10 connections at a time, don't think about it and keep using threads.
3. Some people like to use UDP instead of TCP for multiplayer. It is much faster than TCP, and you can also broadcast to more than one player at a time. The problem is UDP packets can arrive out of order, so you need to re-order them. If you are using TCP, don't worry about it. TCP is basically a high level protocol over UDP that includes ordering and error handling. If you are making a realtime game, I would turn on TCP_NODELAY to prevent TCP from delaying transmission of your data. These delays can reach several 100s of milliseconds.
Posted by SillyCow
on 19 September 2013 - 04:22 PM
limit your speed to a sliding window:
1. Keep a sliding window (queue) of your last 50 frames' times (or any other number)
2. If your current frame is too far ahead of it's time: You want 50 FPS, but a second has not passed since the last 50 frames, then sleep a little bit.
3. You will also want to check the last 2 frames, to set an upper bound for speed: It is ok for the game to accelerate to compensate for missed frames, but there should be a limit on the maximum rate. If you do not do this, and you have some long frames, then your game will jitter.
Regardless of these points, you should separate your logic code from your render code. Your logic should never fall behind as a result of frame drawing speed. If you use a single thread it should look something like this.
calculateStuff();//put all your logic code here
//limit and stabalize your FPS:
drawStuff();//Draw everything here
sleep(1ms);//give the CPU time to rest to avoid busy waiting.
Basically, this loop makes sure:
1. Your frame rate doesn't explode
2. If your drawing rate goes down, your game rate stays the same (car still takes 60 seconds to drive from A to B regardless of frame rate)
3. You don't draw redundant frames (frames where nothing has changed)
4. If available, you give the CPU some time to rest. (Very important for desktop CPU temperature, and laptop/phone battery life).
You can get better performance if you do this on two threads, but that's a whole other story.
'images' like in real life pictures or just other peoples' drawings?
Doesn't matter. It's sort of like tracing over another picture. So it can be a photo, a sketch or anything else. The obvious advantage of drawing by yourself, is that you can get any picture you like. The obvious disatvantage is that it takes way more time then searching on google.
well if it takes just takes couple months to learn how to draw comic-book/cartoon art(assuming that I draw 2-3 hours a day and reach these results), I see no harm in learning how.
Make sure you take a course, or read a book. What a lot of people who do not draw fail to realise is that drawing is methodical. Just like you learn Loops, Methods, Data-Structures and Algorithms before you can program, you need to study drawing techniques. Just sketching on a piece of paper for a couple of months will not yield good results. It would be the same as opening an editor and writing random code .
I took a short course and practiced at home and it did wonders for me.
Then again, some don't draw pleasure from drawing I wish you luck however, it is a skill that will elude me forver, due to a lack of passion and patience for it.
Agreed, no amateur game-dev should draw unless it fascinates him or brings him some enjoyment. You can make excellent games without knowing how to draw.
No. At the higher levels, you nead to model over a sketch. But you can download an image from the internet, and model over that.
should I learn how to draw too? like what if I want to test out some games, do I need artwork for it?
I mean im not trying to be michelangelo or anything, I just want to be competent enough to draw figures for game testing.
No, For testing purposes, you can use ugly art (stick figures/ 8 bit).
Regardless, learning how to draw is fun.
Alot of people don't try to learn it, and assume you are only born with it.
Learning how to draw decent comic-book level takes around 1-2 months, art if you have no prior knowledge .
And you need a scanner to use your drawings in a game.
A game I played had a defend mechansim where a character could defend instead of attacking. This would skip your chance to attack, but would reduce the damage done to said character. This was especially interesting when battling ranged units.
Technically this isn't evasion, but it's a similar concept.
I voted you down, but in retrospect, your post was a good one (helpful, polite, and informative), it was just that I think the information is inaccurate - at least, within the meager limitations of my own knowledge!
Unfortunately I can't undo the downvote, so I upvoted one of your posts in another thread - feel free to correspondingly downvote mine if you think my post is inaccurate or unhelpful.
Sir , I have never been so politely down-voted. Kudos to you, I shall regard this noblest of down-votes as an ode to your chivalrous nature.
RPGs are like Dungeons and Dragons. Mostly medieval fantasy (some are futuristic cyber-punk games). You mostly play wizards and warriors battling monsters and save the kingdom.
Alternate Reality games (never heard them called ARGs before) are like Second-Life. They usually don't have an objective, but are like building an alternate version of your life. You buy a house, decorate it, open a buisness, etc... There is no real objective to the game, except interacting with other people. Alot of the time it is also more realistic. You live in a regular city (or a cruise ship as I recently saw in one game).
Some RPGs imitate some Alternate reality games and allow you to buy a house. But that is usually not the object of the game. You still have to go battle dragons (or robots) in order to have fun.
ARGs tend to be targeted at a more grown up crowd. An ARG is like a 3D fake Facebook where everyone has an alter-ego.
RPGs, while also played by grown-ups, also cater to younger audiences. (I'm no child, and I'd play an RPG over an ARG any day)