Jump to content
SSForum.net is back!

Bak

★ VIP
  • Posts

    1064
  • Joined

  • Last visited

Everything posted by Bak

  1. Continuum does black magic when it draws other player's ships on your screen. The timers for all the players are not synchronized very well, so if you just draw the ship with your best prediction, it jumps back and forth as either of the players' latency jumps back and forth (which happens often). So how does the drawing continue to look smooth? Continuum cheats. The way I did it in Discretion, and the way I think it's done in Continuum, is that it adjusts each player's velocity so that their ship will work it's way to the correct position over time, rather that instantly resetting the position to the best prediction (which would make it jump on your screen). Want proof? Fly next to a player in Continuum that's drifting through space. Match his speed. If you look at him he'll be drifting faster and slower as Continuum adjusts his velocity for you. Black magic! Anyways the code to do it in Discretion is below. There's two settings you can adjust, which are During my tests it actually looks better in Discretion than in Continuum, but I'm not 100% this is always the case since when I run both side by side the fps on the non-selected one drops to ~10fps. I'll need to get another computer to test it if still looks good at high fps. I suspect that by modifying the settings it can look reasonable. s->vel.x = xvel; s->vel.y = yvel; s->display = true; s->rot = sm->frameToRot(frame, s); // look at the timestamp and compute the predicted "correct" position for the player int millDif = 10 * (((net->getServerMilliseconds()/10) & 0x0FFFF) - pi->getValue("timestamp")); // millDif is positive, how much later it is than when the event occured // predicted correct positions int newx = xpos * 10000 + (xvel * millDif); int newy = ypos * 10000 + (yvel * millDif); // these are how much we are "off" by int dx = (newx - s->loc.x)/10000; int dy = (newy - s->loc.y)/10000; // resetDist is in pixels u32 maxDistSq = resetDist * resetDist; u32 distSq = dx * dx + dy * dy; // if we're drawing too far away from the predicted position, jump the player to the correct spot if (distSq > maxDistSq) { s->loc.x = xpos * 10000; s->loc.y = ypos * 10000; } else { // otherwise cheat with the velocities to fix the player position smoothly // s->vel = pixels/10sec, velAdTime = ms, newx/s->loc.x = 10000*pixels if (s->loc.x / 10000 != newx / 10000) s->vel.x += ((newx - s->loc.x)) / (velAdjustTime); if (s->loc.y / 10000 != newy / 10000) s->vel.y += ((newy - s->loc.y)) / (velAdjustTime); }
  2. also calling a non-static method from a static context class declaration syntax incorrect()
  3. jeez, they made 2000 of those nuclear rifles...
  4. what about this: you're in the middle east surrounded by 10,000 terrorists who are going to rape your daughter... legalize personal nuclear weapons!
  5. It's "treat others as you want to be treated" not "treat others as they would treat you"... big difference because with the first one you're nice to everyone, with the second one you're nice to the nice people and an !@#$%^&*hole to the !@#$%^&*holes. the original story I was responding to was that a stranger is merely on your property and you wouldn't "think twice" about shooting at him. You could make a case for defending yourself if he's in your house har!@#$%^&*ing your family with clear malintent. As for the story from when you were a kid, it's obviously much better that you are here today. However, just because guns have the power to help out in one situation doesn't mean they are an overall good thing for society. If it were the case that, in general, they caused more innocent people to die than would otherwise, certainly you would think they're worth banning? The debate is still one worth having to figure out if this is the case.
  6. the usa isn't occupying the native American lands because we've been here for more than 20 years
  7. I vigorously object to this notion. What happened to love your neighbor as yourself or treat others as you want to be treated? I know they're not supposed to be on your land, but that in no way, ever, deserves a death sentence. gangs don't go after banks. They sell drugs and extort store owners. They offer protection to people on their turf for a fee. gangs do operate in one area for long times and the police do know about it. However, the police are unlikely to go after the leadership of gangs as it creates a power vacuum which results in more violence. I recently read "Gang Leader for a Day" where a sociologist hung out with a gang for several years to see what it was really like. It's an amazing book; I couldn't put the thing down.
  8. explain
  9. guns are the easiest way to kill people, others or yourself. If I want to commit suicide, a gun is the easiest way. If I want to go on a shooting rampage, a gun is the easiest way. I can't drive an SUV into my school and kill 20 people (incidentally, http://news.xinhuanet.com/english/2008-03/...ent_7823467.htm ). She doesn't know if I have a gun until she's made up her mind to rob me. It only works if everyone is carrying a gun.
  10. "The Kill Seen Around the World"
  11. Well yeah, two days of straight debugging and I finally found this one. I think it surp!@#$%^&*es my previous favorite en!@#$%^&*led "pragma pack is the devil": http://forums.minegoboom.com/viewtopic.php?t=6508 anyways I was using an STL vector to store the ships which should be drawn on the screen. I then passed around pointers to these Ships to other modules so they could modify them as they see fit. The problem is, a vector reallocates memory as it grows... so when I had the pointer to the first element and then inserted another ship, the pointer to the first ship no longer pointed to valid memory. Rather than crashing, the program continued to run, until something else allocated some memory in the same spot (which happened to be an image that I wanted to draw), and then whenever I modified the ship I was also modifying the image. SDL then complained that images should be unlocked when drawing them to the screen (apparently the ships's y pixel location mapped to the locked field of the SDL_Surface structure)... so basically I had to work backwards from SDL's complaints to find the real problem. anyways yeah just rambling... that's about 20 hours of my life I'll never get back!
  12. yes, my life is in danger if I don't cooperate. If I do cooperate I lose my wallet and can except to live. With a gun in the picture, I get to keep my wallet but the criminal loses his life. The trade off is my wallet vs the life of the criminal. The study I posted was concerned with raw suicides. Where do they say they only looked at gun-related suicides?
  13. they DID use pipebombs and propane bombs in columbine. The guns were what did the killing (probably because the bombs they had to make themselves whereas the guns are professionally manufactured and don't malfunction as much). If you really cared about your family you'd be concerned that keeping at gun in the home increases the chance of your kids committing suicide by 500% (http://content.nejm.org/cgi/content/abstract/327/7/467) Still, he's not going to shoot me after he takes my wallet. The trade off is my wallet or his life (and pulling a gun on someone with a lethal weapon may risk my life as well). I don't know who you think these pedophile rapists are, but they're certainly not going to come into your home and go through you to kidnap your 6 year old. If I were to do it I'd wait till she's alone like at a bus stop and try to entice her with candy or something. Unless your suggesting 6 year olds should carry guns? Or do you shoot anyone on sight that talks to your kid?
  14. HIXEzj08MwEhttp://www.youtube.com/watch?v=HIXEzj08MwE
  15. Is it better for me to get mugged or me to kill the mugger? Is a human life, however misguided, more important than the $40 I have in my wallet?
  16. 27 million people in iraq. An decent Ak-47 is about $800, throw in a few cases of ammo and we're up to $1000. so here's my get-out-of-iraq strategy. We give each man, woman, and child an ak-47 and a few cases of ammo and then leave. Obviously no one will attack anyone else since they all know everyone has a gun. Total cost: 27 billion dollars... man and we're spending billion every few months on iraq... obviously the people in charge are idiots if they haven't considered this cheap, flawless plan. edit: good news, apparently before we invaded iraq most households already owned a gun: ("Most Iraqi households own at least one gun, so there has been no particular run on armaments." http://query.nytimes.com/gst/fullpage.html...750C0A9659C8B63 ) we only have to arm the minority that isn't already safe because they own a firearm!
  17. it's like $3.30 where I live... anyways the only reason we complain is that a year ago it was a dollar less... so like 33% increase over the course of a year, people would be mad anywhere with that sort of hike
  18. countries don't get invaded anymore? hmm obviously if everyone in iraq had a gun it would be a much safer place. In fact we should try just giving away guns on the street to civilians. That way al quita will think twice before they attack anyone. flawless logic there.
  19. you can only overturn an amendment with another amendment, for which you need a 2/3 majority :/ plus I'd hate to be the country that invades the united states, almost one gun for every person
  20. yeah that's similar to what I was thinking, but you may want to replace an image entirely rather than just adding to it (a damaged terrier may be missing a wing, not just have brown smudges on it). also instead of xml i'll probably just use the .conf format like for everything else.
  21. yeah but there's already lots of restrictions on that, most of which are reasonable. If you're a convicted criminal, you can't carry a firearm. If you're in a bar drinking alcohol, you can't carry a firearm. The question is where to draw the line.
  22. I'd say double-check anything you get in a spam email before you base decisions off it.
  23. I lol'd. Yeah the performance looks good. Slightly better than before even.
  24. you can sue anyone for anything. That doesn't mean you're going to win. Show me a case where someone won for a violation of civil liberties caused only by what someone else said (and not any discriminatory actions). "What if I take extreme offense to the word !@#$%^&*, does that make you an idiot for using it?" It doesn't make me an idiot, but you certainly can call me one if you want. Just like people can call Don Imus a racist. Is he actually a racist? Who knows. "I'm sorry that I was posting many issues that went beyond the realm of my original statement about freedom of speech in an effort to exemplify what the so called "liberals" have done to our society." Stay on topic please. If I wanted to argue against you for affirmative action, I wouldn't bring up that there were no WMDs found in Iraq to prove my point that conservatives are bad for America. That line of reasoning doesn't make sense! Similarly bringing up that someone sued McDonalds for spilling hot coffee on herself is unrelated to anything free speech. We seem to draw these rigid boundaries of conservative or liberal but honestly we should look at it on an issue by issue basis. On some issues I agree with the conservatives and on others I think the liberals are right. I think most people are like this too.
  25. I looked over the current way ship settings are handled, and I don't think it's ideal. I'll start with describing the current system, and then my proposed one before I implement it. You guys will have a few days to tell me why the proposed method is not good enough, not general enough, and what it can't do that it should (as well as a chance to propose a better one). Currently each ship has settings. Some example settings are ship graphic index, number of frames in the graphic, ship radius, max speed, ect. Most of these settings are inside the shipman module, from which you can get Ship* from a template name (the template names are like "warbird" and are defined in the settings). There are also default settings that are used if the settings don't define all of them for a specific ship (thus eight copies of the same settings one for each ship are not necessary in the .conf file. struct Ship { bool display; // should this ship be displayed? int imageNum; // don't change this (instead free the ship and make a new template ship via the interface) int frameOffset; // for the image, don't change this (instead free the ship and make a new template ship via the interface) int numFrames; // for the image, don't change this (instead free the ship and make a new template ship via the interface) Vector bounceFactorX; // the percentage of speed retained in both directions off a bounce Vector bounceFactorY; // the percentage of speed retained in both directions off a bounce int radius; // radius of the ship for bounces int rot; // 0-359(degrees) * 10000, so 0-3599999, clockwise from straight up do not use this when computing // velocity changes, instead use getRadians which will get the proper radians based on the number // of frames in the image Point loc; // pixel * 10000 int rotvel; // rotational velocity, degrees / 10 seconds, or deg / 10000 milliseconds Vector vel; // positional velocity, pixels / 10 seconds ,or pixels / 10000 milliseconds ... }; Some settings, however, are not in the Ship structure. Max speed, for example is handled in the SelfShip module. Since we only care about the maximum speed of our own ship (what a client really do if others are going faster than their max speed?), we don't need to store this for each ship. Other settings in SelfShip include the settings for the ship exhaust, acceleration and other movement-related settings. struct ExhaustSettings { Point offset; Vector vel; }; struct ShipSettings { int rotVel; // degrees / 10 seconds int maxVel; // pixels / 10 seconds int accel; // pixels / (10 (seconds^2)) string exhaustName; // the name of the exhaust animation int exhaustPercentShipSpeed; // the percent of the ship's speed to add to the exhaust int exhaustRedrawMilliseconds; // the number of milliseconds that p!@#$%^&* between exhaust bursts vector <ExhaustSettings> exhaustShipOffsets; }; So what's the problem you ask? This system is not general enough! Settings should be handled on a per-player basis. This means that my spider should be able to have different settings than your spider. There's a few reasons for this, but it's not just hyperspace-style buying and selling of components (although that is one reason). Imagine there's a map-region where you can move faster than normal. Rather than hack this into SelfShip before it computes your new speed, we could modify the setting from a central location and selfship would keep a pointer to its max speed which it would automatically use. Then we could imagine a system where there's an unlimited number of modifiers that can take place without modifications to SelfShip (ship is at location X which lets him go faster, has modifier "damaged engines", player owns "super-thrusters", "player used rockets 2 seconds ago", "player is in spider", ect). another problem with the current system is that every time I want to add a setting I either have to change the struct Shipman uses, or store it locally in my own module. The problem with the second approach is it discourages sharing. So currently SelfShip stores the exhaust data locally. Why shouldn't we be able to draw the exhaust of other ships? We can't right now since that data is not exposed. We could expose it in the SelfShip interface, but then every time this happens you have to write your own initialization code, use it locally, and then expose it through your interface. That's a lot of work. Also, if you want to use one of these settings you have to figure out which one of the ten modules that has private ship data it's contained in. A centralized place is a better idea. So looking at this, the player's ship is just another mask on top of the settings. Other masks are like those mentioned above, the player's location, damaged parts perhaps, items he's used, ect. so the settings are no longer to be stored on the shipmanager. Instead I propose we store them use the PerPlayerData module, which manages a data on a per-player basis and allows global sharing of data using names like "position". It gives you a pointer to the data, so any updates will instantly be used by other modules using that data (they should store the pointers for this, obviously). Previously this module was used to store things like the names of players or the freqs they are on. Then, whenever a player changes ship, the ship manager will just apply the settings to the per-player data. One issue I see with this is composability. If we have one setting for ship image, and the shipman sets it whenever we change ships, we need to take care when applying changes. For example, one module may want to change the ship image to a damaged one after the player sustains some damage. Another one may want to change the image to a modified ship that include a giant booster the player has bought. If they both don't know about each other it seems like only one of them will get their way. Perhaps we should be drawing a series of images for each player rather than just a single image... hmm I'm getting off topic here though... But yeah, in general, settings are not as easy as simply being additive. Here's a better example: there is a region where a ships max speed is 2000 no matter what, regardless of any items he's using or such. So if a player uses a rocket and goes into this region his speed drops to 2000. Now the question is when he leaves the region what should the MapRegionSlowdown module reset his max speed to? His previous speed wouldn't be good since the rocket may have run out. Should the region module be forced to communicate with the rocket module (that doesn't scale very well as any future additions may have to modify all the previous functionality)? I'm sure I could think of something to solve this problem but I'll see what you guys can do. Also, do you think this system is general enough or am I missing something?
×
×
  • Create New...