Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Darkbouncer4689

  1. I'm working on a networked flash game using TCP sockets (forced to use TCP b/c of flash). The game is pretty simple as it is mostly a text based game. The only real synchronization that must be enforced is a countdown timer for each client. This timer will start at 60 seconds and countdown to 0 and at 0 some game state change will occur, so it is important that all clients get to 0 at a similar time. I could send the "start countdown" command from my server to all clients and use the clients system clock, but if the packet is dropped or delayed then a client could get out of sync with the others. I could also enforce some client/server protocol where the client must "check in" with the server every second (or less) and the server enforces the sync of all clients. My concern with this is efficiency. My game is a slow paced text game so it is very possible that a client may not have any data to send to the server for up to 30 seconds at a time. It may not be possible to avoid the "constantly checking in" situation, but I'm hoping someone can give me some pointers to an efficient solution for keeping a timer in sync between multiple clients in a flash application. Thanks in advance. P.S. I don't think NTP is possible with flash.
  2. Darkbouncer4689

    TCP - Keeping clients synchronized

    Thanks guys. I'm thinking that rpiller's option may work as long as the server is smart enough to ignore client requests that happen past the end of the timer count down. I'm still not exactly sure what hplus0603 about using time stamps to keep everything in sync. If you wouldn't mind going into a bit more detail on that I would appreciate it! Thanks all!
  3. Hey fellow gamers, I'm working on a new project for my gaming portfolio. It will be a flash game. Although I don't like Farmville, I figured it would be a good idea to use the same technologies that they do. I believe Farmville is written in ActionScript 3.0 and uses CSS for its GUI, right? (Please correct me if I'm wrong). I've started learning AS 3.0 but want to make sure I'm on the right track (especially before I buy the IDE from adobe). Also, is there a specific benefit to implementing the GUI in CSS instead of inside of flash? Thanks in advance!
  4. Darkbouncer4689

    Flash networked web game

    thanks ss, I'm working off the trial version for now!
  5. Hey all, Just starting to get serious about app development. I'm wondering whats the best tool to use for designing a multi-platform app. I know about Flex, but I haven't really worked with it. Downsides are that you have to pay for it and it doesn't work for windows phone. I believe it's possible to use html5 but I don't know much more than that. It's always a bit overwhelming when you don't even know what SDK and toolset to use... hoping a veteran out their can steer me in the right direction. Thanks in advance.
  6. Darkbouncer4689

    What SDK for multi-platform app?

    I've been looking into Rhomobile/Rhodes. It seems like you write your app in HTML5 and then it works some magic to make it look like a native app. I believe this means it has to have internet access and connect to a server. I'm wondering if anyone has used this technology and can report if there are any downfalls as to writing a native app. Thanks
  7. Darkbouncer4689

    What SDK for multi-platform app?

    well ideally iphone, android and tablets at minimum. Then possibly blackberry/windows phone depending on if they have enough marketshare to be worth it.
  8. Here's an interesting question for everyone. Say you have a 2D grid with length X and width Y. You have N points in this grid (existing in some cell of the grid). It is possible for more than one point to be in the same grid position. Moving a point to a neighboring spot in the grid (horizontal and vertical, no diagonal movement) takes 1 unit. Find the spot on the grid that allows you to move all points to one grid cell with the least amount of travel cost. + - + - P - + - + | | | | | P - + - + - + - + | | | | | + - P - + - + - + (the 5 |'s are suppose to be spaced out but I guess the editor doesn't like that) +'s are grid cells, - are horizontal movements | are vertical movements, P is a point in a grid cell. The answer for this example is position (2, 2) requiring 4 moves, 2 from the top middle point, 1 each of the other two points. My brute force solution to this was to check the required distance traveled for each node in the grid. The one (or more than one) with the minimum traveled distance is the solution. This requires O(XY) comparisons. I know there is a better solution to this and I believe that this problem is very similar to finding the center of many points, just forced to fit along a grid. I thought of taking the average of all points but that doesn't work for a lot of cases. Anyone have suggestions on how to solve this with a better time complexity than the brute force method?
  9. Darkbouncer4689

    Finding minimum distance of points along a 2D grid

    Thanks guys. Both are good algorithms that perform better than brute force! Appreciate the help.
  10. Darkbouncer4689

    C++ STL Algorithms

    Hey all, I've been brushing up on my algorithms and data structures lately and today I was messing around with everything in the STL. I had always known about qsort, but it seems like there are some easier functions available if you happen to already be using an STL container such as vector. Namely something like: vector<int> myVector; sort(myVector.begin(), myVector.end()); I'm guessing that sort is implemented as a quicksort, but there is one part that I'm not sure about. The template for sort is void sort(RandomAccessIterator first, RandomAccessIterator last); I know that for the basic quicksort (taking first element as pivot) it's worst case is a sorted or reverse sorted list in which it runs at O(n^2). This can be avoided by choosing a random pivot which makes it's expected run time O(n log n). I'm guessing this is what RandomAccessIterator is about, but I'm not familiar with them. If I simply use vector.begin() and vector.end() is it converted to a RandomAccessIterator or do I need to do something special to insure a O(n log n) run time? Thanks in advance!
  11. Darkbouncer4689

    C++ STL Algorithms

    Okay, this is making sense now. I appreciate the help. I'm having trouble finding any examples that use RandomAccessIterator, for regular iterators I could do vector<int>::iterator itr. How can this be done with a random iterator? Edit: Okay, so the random access is handled for me then? If make a sorted vector and call sort on it, passing in vector.begin and vector.end iterators, the expected run time will still be O(n log n)?
  12. Darkbouncer4689

    C++ STL Algorithms

    I'm a bit confused here, what exactly is an iterator that supports random access? Thanks!
  13. I recently received this as an interview question. The interview is over and I did not get the job (so I'm not trying to cheat on an interview, just trying to further my knowledge of algorithms and data structures for the future). The question is as follows: [font="Times New Roman"]Write a function which will find all the words on ageneralized Boggle™ board. The functionshould take as input the board dimensions, the board, and a dictionary of validwords and it should output the list of all found words to the calling function. You should consider how your approach willperform with a large dictionary and a large board. My solution to this was to perform a quicksort on the dictionary words. Then I would do a depth first search to get all of the permutations of letters along the board and use a binary search to see if the permutation is in the dictionary. Based on the interview I guess this is not the best solution and at the time I could not think of a better one. Assuming the O(n log n) quicksort is a pre computational cost, each binary search is O(log n). The only thing I know of that could be faster than O(log n) would be to hash everything and have constant lookup time. If anyone has some recommendations on better solutions to solving this problem I would love to hear them. Thanks![/font] [font="Times New Roman"][/font]
  14. Darkbouncer4689

    algorithms/data structures with boggle boards!

    Nice answer! I had actually used a trie structure before but didn't think about it until you mentioned it. I think this structure would definitely be more efficient than peforming a binary search each time. Since you would traverse the tree as you form potential words it would be constant time with little overhead for each lookup right? What is the general lookup time for a structure such as this? Most tree structures are log n, but since this tree isn't balanced it makes things a little different.
  15. Darkbouncer4689

    C++ friend

    Trying to solidify the concept of the friend keyword in C++. Seems like there are a few ways to use it. class Cat { friend class Dog; private: int age; }; If the class Dog contains an instance of class Cat it can now access Cat's protected/private data without needing public accessor methods. If instead it were something like friend void Dog::DoSomething() Then only in the method DoSomething would Dog be able to access Cat's protected/private data. And last if it was something like class Cat { friend void PrintAge(Cat& cat) {cout << cat.age << endl;} private: int age; }; This method is like a static method that can be called without an instance of the class and can access the instances private data. I'm not noticing a difference here between a static and friend function other than the friend function is global and the static version needs a full declaration such as Cat::StaticFunction(). Could anyone explain? Thanks!
  16. Darkbouncer4689

    C++ friend

    Okay so in this case friend and static are very similar. I think friend is a bit cleaner since it doesnt require scope resolution operator each time. (Although some may be against it since it could be confusing as to where that method is defined) Thanks guys! P.S. I'm thinking the cleanest use for this is to override the ostream/istream operators. friend ostream& operator<<(ostream&, Cat&); [font="Consolas"] [/font]
  17. Darkbouncer4689

    C++ friend

    Interesting, so the following won't work class Cat { friend void Hello() {cout << "Hello" << endl;} }; int main() { Hello(); } but this does work class Cat { friend void Hello(Cat& cat) {cout << "Hello" << endl;} }; int main() { Cat cat; Hello(cat); } So it somehow uses the parameter passed in to call the method?
  18. Darkbouncer4689

    Game Studio - Profit sharing

    First I'd like to say that I want to be a game programmer because I love games, not money. However, we all have bills to pay and it's nice to know what to expect from working at a game studio. If anyone out there who has worked for a game studio would be kind enough to explain how profit sharing on titles generally works and what to expect, I'd appreciate it.
  19. So a question I see a lot of people post as having gotten in an interview setting is "Write a function to determine if a number is prime" The brute force method would be to of course divide some number N by all numbers from 2 to N-1 (easier to implement by checking if N % i == 0). A slightly smarter approach is to do the same method above but only up to floor(sqrt(N)) which can cut down a good bit. How many people have broken out the method of determining that N is prime by some extremely high probability using Fermat's little theorem and Miller-Rabin test? I only know of it from cryptography, but it's the only reasonable time complexity algorithm for very large values of N. Wonder if that's overkill for an interview question >_>
  20. Wow, these two techniques were never even mentioned in my cryptography class... in which finding large primes is important to multiple cryptography algorithms. Thanks for the name drop, I'm going to check these out =)
  21. So I implemented an algorithm in visual studios 2010 on windows and get one answer, then I sent all of the .cpp and .h over to my linux box and recompiled using gcc and I get a slightly different answer >_< The algorithm involves a lot of floating point numbers, divisions, multiplications, sin and cos calculations. I'm assuming it has to do with floating point rounding? Is this a linux vs windows thing or a VS2010 vs gcc thing? Thanks! Dark
  22. Darkbouncer4689

    Different values on linux vs windows (C++)

    Thanks rip-off. So I'm assuming a game engine will implement it's own floating point precision techniques in software to assure consistency throughout different platforms.
  23. Darkbouncer4689

    Different values on linux vs windows (C++)

    Thanks Apoch. Helpful as always!
  24. Hey all, I'm messing around with Flash and making a little chess game. I need to determine which box on the board the user has clicked on so that I can move pieces around. I've thought of two possible solutions to this. 1) Treat each box on the board as an individual sprite and add a click event listener to each box. 2) Based on the dimensions of the board and the mouse coordinates, use a bit of math to determine what box the mouse is over. I'm thinking number 2 is a better solution then to have 64 (8X8) individual sprites with individual event listeners. The problem I'm facing is that the board is a perspective board, meaning to achieve the illusion of depth the dimensions of the board are warped. It seems like the perspective illusion is accomplished by each column of the board having a unique slope to it, the leftmost column has the steepest negative slope while the center column has a slope of 1 and the rightmost column has the highest positive slope. Anyone have any suggestions on how to tackle this problem? Thanks!
  25. Darkbouncer4689

    Reducing quadratic equation (a=1)

    Hey all, So for the quadratic equation x = (-b +- sqrt(b^2 - 4ac))/2a when a=1, real-time rendering says it reduces to -b +- sqrt(b^2 - c) Embarassingly enough I'm failing at basic algebra to figure out how they got that. Could anyone show me the equalities to get to the fully reduced equation? Thanks!
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!