Jump to content
  • Advertisement

Oggan

Member
  • Content Count

    45
  • Joined

  • Last visited

Community Reputation

146 Neutral

About Oggan

  • Rank
    Member
  1. Quote:Original post by oliii What happens when the players moves diagonally? then you need (33 + 33 - 1) tiles? 32kB / second = 256 kbit/sec. That's roughly the minimum DSL connection instream bandwidth capacity. Of course, you can also compress your data using Huffman compression or some sort. It wont be 32kb per second, a little more than half a kb when scrolling is sending only the needed tiles without using super-tiles. if having 32x32 super-tiles then the packet is around 32kb, but its only sent once like every ~30 seconds or something like that. and multiply that by 1.414 when moving diagonally, yes.. And if I only have a border in the middle of the SuperTile then a player can walk back and forth on those 2 tiles and make the server send ~32kb packets every second. So in that case might have to make the super-tile a little bigger, and make it so that the player has to walk a few tiles back to get it to send the previous supertiles again. oh, and when using supertiles, I could store units and items and such in a hashmap belonging to the supertile instead of having a storage in each and every tile. I haven't looked into any compression-solutions at all.. I assumed compressing and uncompressing the data would take too long to be usable. But maybe it's not?
  2. Hello I'm programming a fully seamless 3D online game, and I'm wondering if anyone here can give me any advice on that... On the client-side, 16x16 tiles are visible at once. But to shade the edge-tiles correctly I need data for 18x18 tiles. Also, the camera can be orbited freely around the player, and 16 tiles in any direction should be able to be seen. Which means that the client needs to be "aware" of a 33x33 tiles area. On the server-side, I'm storing all the tiles in a scalable list data structure. And each tile holds some static data, as well as some dynamic data like items lying on it, and it might hold a reference to a unit standing on it. Whenever the player moves, the "area of awareness" scrolls by 1 tile, which means the server needs to get 33 tiles from the map. And each tile is on average maybe ~16 bytes. A little more than half a KB needs to be sent around once every second when the player moves, which definitely would work. But accessing 33 objects from the scalable list data structure -map is slow... I was thinking of dividing the map into "super-tiles" consisting of maybe 32x32 tiles, and that the client is aware of 4 of these at once. The more I thought that through, the better it seemed, until I realized the big amount of data that needs to be sent to the client whenever he crosses the middle of a super-tile as 2 super-tiles need to be sent, and each tile is on average maybe 16 bytes. 32x32x2x~16=~32KB That sure is a lot of data, and that wouldn't work if I want the game to be seamless. So I was thinking of maybe letting the supertiles be 16x16 instead 16x16x3x~16=~12kb Still sounds like too much 8x8x5x~16=~5kb I don't really have a lot of server and internet-communication experience so I don't really know where the limit is... Any advice on these things would be really appreciated. Thanks in advance
  3. By the way, another reason why I don't want to use interpolated curves is that I also want consistent speed. Quote:Original post by Sneftel Quote:phi = Math.atan(dy / dx);atan isn't a great thing to use here, since you care about the sign of the angle. Use atan2 instead. Actually, that part of the pseudocode looks rather suspect. It looks like you should be negating the phi+theta before calculating Q. I tried using atan2 instead as you suggested, the direction ended up inversed so I negated dy&dx, the result was same as before except that now it worked in all directions, one step in the right direction =) Quote:Original post by bzroom Just looking at the pictures, it looks to me as though your theta is equal to the tutorials theta + phi. Maybe you need to subtract phi from your theta for some reason? It'll matter where you're referencing the angles from. I'm impressed you could see that. I did as you suggested, actually that's the way it's done in the pseudo-code for *left*-turning. It got inversed again, so I removed the negation of phi+theta again and now it's working great =) Thanks for all the help, I really appreciate it!
  4. Thanks for the answer, but the thing is that i need a consistent turning-radius, for tile-based pathfinding
  5. Hello I wasn't sure in which forum to post this, but i figured, since more a matter of converting pseudo-code to real code (AS3 in my case) it would be more appropriate to post it here instead of the Math-forum. I'm programming a game in Flash(AS3) and I'm implemented path-finding to it. Now I want to make the turns in the path smooth. I'm using this tutorial to do that: http://www.gamasutra.com/features/20010314/pinter_02.htm But I'm having problems. The first problem I'm having is to calculate the point Q, I've translated the pseudo-code on the page and looked it over dozens of times but it still seems to be off. At the moment I'm ignoring left-turns, I'm trying to get it work properly with right-turns only instead. Here is the relevant piece of code I've written: angleToP = (initial_direction - 90) / 180 * Math.PI; P.x = Origin.x + r * Math.cos(angleToP); P.y = Origin.y + r * Math.sin(angleToP); dx = Destination.x - P.x; dy = Destination.y - P.y; h = Math.sqrt(dx * dx + dy * dy); if (h < r) return; d = Math.sqrt(h * h - r * r); theta = Math.acos(r / h); phi = Math.atan(dy / dx); Q.x = P.x + r * Math.cos(phi + theta); Q.y = P.y + r * Math.sin(phi + theta); This is the result I'm getting: The top 2 ones are mine, and the bottom one is the one from the tutorial. As you can see, the two bottom ones have nearly identical points and radius, so they *should* produce the same result, but for some reason they don't... In the first line in my code, maybe you noticed that I converted angleToP from degrees to radians (/ 180 * Math.PI), because the sin/cos/atan/acos in flash take angle in radians, but in the pseudo-code they seem to take degrees? Would this maybe mean that I would have to change the code somewhere else too? Or am I wrong somewhere? If someone could help me with this I'd *really* appreciate it. Thanks in advance
  6. Okay, I don't know how to explain this but ill try... I need this to work for a project that im programming in flash I have a line with a specified length, going from a specified base-point this line rotates so that it always points at the mouse-cursor. but if the distance between its base-point and the mouse-cursor is less than the line-length, I want to curve the line, with a specified amount of segments, so that its end-point is equal to the mouse-point. I don't know how to do the curve effect properly though. I tried letting the total curvature of the line be PI*2 radians(360 degrees) if the distance is 0, and 0 if the distance is greater than the length, and have a constant change between that that of course, wouldnt produce the correct result, the line-end-point and the mouse-point are only equal when the distance is zero or equal to the lineLength. The distance from the end point to the initial point shouldn't change at a constant rate. It's a trigonometric issue someone told me. this flash demonstrates it, and you might get a better idea of what I'm after. http://img80.imageshack.us/my.php?image=curvelineie1.swf I heard the entire arc in radians should be the arc cosine of(distance / lineLength) * 2 this produced a better result but thats still not it. you can see that here: http://img157.imageshack.us/my.php?image=cloxcurvetoty2.swf I really hope someone here can help me with this. I would *really* appreciate it. Any comments or small help is welcome, and if there's anything else i need to specify to make it easier for you to help me then just tell me.. Thanks in advance!
  7. thanks, Superpig. I will remember that =) more tips are always welcome though
  8. Quote:Original post by asp_ I would say the real problem with such a solution would be the high likelihood of a false positive. Some players tend to be very repetitive when playing these types of games and I'm sure you'd end up hurting real players. yeah of course, but i mean if the player keeps repeating something and it takes *exactly* the same time between moves all the time.. but yeah, of course it cant be *exact* like i just said because it varies with the lag.. heh, so i guess that sorta kills the whole idea. oh well =þ and i definitely agree with superpig there.. heh, in Runescape its practically impossible to use simple recorded mouse-moves/clicks and keystrokes to macro.. they have implented loads of features for that.. for instance, when fishing, all of a sudden some kinda river-monster pops up from somewhere who would kill a simple-macro'er. and also the 3D camera moves a tiny little bit sometimes, but its enuf so that a recorded mouse-macro would not work.
  9. im *definitely* not an experienced programmer, but wouldnt it help at least a little bit having a server-side script looking for patterns in the players behavior? like if the player always does things the exact same way with the exact same delays and such he could be banned or whatever? iunno.. just an idea
  10. currently i do not comment my code at all.. though i havent written anything big yet.. im looking for a tutorial or tips on how to comment code and organize everything so i get it right from the start... so anyone know any online-tutorial or something that brings up that subject? Thanks
  11. Quote:Original post by Fruny Quote:Original post by Oggan when "Dynamically allocating the object", would a vector be slower than a static array? Allocating a static array is a simple pointer adjustment (on the stack) or size adjustment (if part of another object). On the other hand, a vector holds a chunk of dynamically allocated memory, unless you are using a custom allocator (the second template parameter of the vector class) which happens not to. Whether the vector itself is created on the stack or as part of another dynamically-allocated object is irrelevant. So yes, creating a vector is slower than creating a static array, although in a number of cases, initializing the elements would swamp the cost of initialization. Of course, creating classes which contain large array members causes problems too, as you aren't guaranteed to have sufficient contiguous memory to hold it all. And overflowing your stack with one gignormous array intended to hold the game's map is a common beginner error. Vectors help by dissociating the array from the class (though that can be a problem too in some cases), and deques go even further by slicing up the array itself in smaller chunks. Tradeoffs, tradeoffs, tradeoffs. okay, thanks =) i guess that answers my question then
  12. Quote:Original post by dbzprogrammer "Yes," because you're creating the objects during run time on the heap, where as the array would be on the stack... (I believe so..) but if the static array is in a dynamically created object(allocated from the heap since its created dynamically), doesnt that mean the "static" array is allocated from the heap as well, which means it would be just as "slow" as if it was a vector?
  13. Quote: You are correct. std::vector just wraps the code you would use if you were directly manipulating a pointer to some dynamically-allocated memory into a neat and convenient package. thanks for that :) Quote: Dynamically allocating the object doesn't fundamentally alter the problem. sorry if im dumb but i don't get it =/ when "Dynamically allocating the object", would a vector be slower than a static array?
  14. Oggan

    search for double-linebreak's?

    Quote:Original post by nobodynews You probably need to include the standard header limits in order to use numeric_limits. Otherwise I'm unsure what the problem is. Hope that helps. yea, thanks. that fixed it
  15. Oggan

    Monkey Island 3 Problems

    yea, scummvm isnt needed for Monkey Island 3.. Monkey Island 1 and 2 on the other hand needs it..
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!