Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

288 Neutral

About stonemetal

  • Rank
  1. stonemetal

    C++ Vector of structs

    The idea is to describe what is going on. Your app is failing but there are multiple ways your app could be failing. You say all connections cease working. Are you getting memory errors? Do your sockets close? Do you start sending wrong data? Does your app just shutdown with no explanation? What is the variance from expected behavior. "Failed" and "not working" are not good descriptions of the problem. "All messages start going to the wrong player", "I segfault the next time I try to send a message" are good descriptions of the problem.
  2. stonemetal

    C++ Vector of structs

    Looking at the posts I am going to hazard the guess that you have something like this going on: for(int i = 0; i < players.size(); ++i) { if(players.IsBadThing() { players.erase(players.begin() + i); return true; } } return false; Then some other loop that calls the function the above for loop is in until it returns false. What you should probably be doing is something along the lines of: playerVector::iterator i = players.begin(); while(i != players.end()) { if(i->isBadThing()) { i = players.erase(i); } else { ++i; } } This way you loop over the players list once and don't get indexing errors. note:playerVector::iterator is the iterator associated with the player vector weather that is vector<players> or a typedef to something more readable. Further it sounds as if you are using indexes into a list of players. Are you forgetting to update these indexes after you erase a player from the vector?(everyone after the erase point's new index is one less than it was before the erase. )
  3. stonemetal

    Granularity and Good OOD

    As edd[sup]2[/sup] pointed out SOLID is a good set of design principles. The primary one that applies in this situation is the "Single Responsibility Principle". To paraphrase each object should be responsible for one thing and one thing only. The design race isn't to have as many or few classes as possible. It is to have code that expresses itself well. Trust me there is no class well that runs dry.
  4. stonemetal

    Snap To Alignment Algorithm?

    After they are close enough to snap look to see what direction they are moving if it is toward the snap do the snap. If the element has snapped, make them move some distance(say 5 pixels) away from the snap before you break the snap. If you are doing it non interactively then all you have to do to break the snap is move the element outside of the snap range before snapping.
  5. stonemetal

    Game networking basics

    Any program that utilizes the internet or a local lan uses all of those layers. The first layer your application will even have any hint of is the transport layer. In your typical app this will either be TCP or UDP. The session layer is how your program decides that two packets are from the same individual(This is hidden from you in tcp.) The presentation layer is how your app turns bits on the wire into actual information. At the most basic this is calling a byte ordering function like htnol(host to network order long) and ntohl(network to host long.) At a higher level this is your message protocol. The application layer is the high level protocol used by your app say HTTP or FTP. This builds on the presentation layer by defining and giving meaning to the messages it has assembled. If you are new to networking swing by beej's tutorial start playing around with TCP and work on figuring out the last two layers(presentation and application.) Then after you get the hang of that move over to UDP and figure out the session layer.
  6. stonemetal

    Where should AI be implemented?

    How does your view interact with the logic? If the view is issuing update scene and play animation events then you haven't separated view from logic. Your view should be issuing events like move left, and leave the logic to actually kick off the move left, decide what animations should be running(and note it should specify a general walk\run\skip\whatever left animation id. It should be up to the view to figure out what that means in terms of actual display content) etc. if this were the case then issuing an AI walk left event would be simple, just specify who it is for.
  7. stonemetal

    "Create/Init functions" or a Constructor?

    I prefer factories for complex initialization. With an init function, I might forget to call it and end up with garbage. With the factory you either get the object or an error, no half measures. The factory is more flexible: if I say give me an A the factory can give me anything that is A like, if I create an A directly then I am stuck with an A.
  8. If you want to do it dynamically you end up writing something like an array of pointers to arrays. If I needed something like that I would go with boost. They provide multi-array for just such an occasion.
  9. stonemetal

    Super beginner

    Start what? If you want to start programming I would suggest downloading python and "python the hard way" from there move on to panda3d. On the art side of things getting started would mean something like GIMP and\or Blender, can't say I know of any good resources for learning how to use them though. If you just want to make a game(as a posed to learning the low level stuff needed to make games professionally ), grab a copy of Gamemaker or GameSalad and go to town.
  10. stonemetal

    So, is this a violation of First Amendment rights?

    Interestingly enough "under God" wasn't added until after world war 2.(1954 according to wikipedia)
  11. stonemetal


    He could have spent all the time in the world with it. For some people it rather just works, and others hit some weird edge case and it all falls apart. In that way it works just like every other os on the market. Just because you ran into a situation that was weird and didn't work doesn't mean everyone does(my parents successfully ran Ubuntu for about year until they bought a new computer with Win7 on it, and liked it well enough to not ask for Ubuntu). I have been using Ubuntu since about 06 and never had any trouble until I bought a new computer this past year, after I got the config sorted out it hasn't caused problems since. Running into weird edge cases can happen on any OS out there. Everyone talks about how Macs just work. Well my mac got into weird state were it would reboot itself every three minutes(until I reinstalled the OS), it was impossible to use the network config panel because it continuously popped a dialog saying an outside app had modified settings(note to fix that one you have to drop to the command line and ...) Every OS has its issues some you can get used to, some annoy you until you try a new OS. Right now I find Windows to be the best at Entertainment (games and pretty much anything targeted at consumers aims for windows first.), most of the interesting libraries, servers etc. target Linux, and Macs are somewhere in between, libraries and servers tend to work because of the shared unix heritage but not always, and Entertainment companies make a half hearted attempt at supporting the platform (hey they even have steam now, how many years late?).
  12. If you need to keep pointers into the data structure data oriented design probably isn't the right way to go. Data oriented design is more for situations where you don't really care which element is which. like in a particle system each particle doesn't have a unique identity so you should not keep references to individual particles, all you do is loop over the particle collection and update each particle.
  13. stonemetal

    Profiling == Valgrind ?

    Their profiler only comes on the premium edition of VS(aka $5500 )
  14. stonemetal

    Profiling == Valgrind ?

    Amd's Code Analyst (works on Intel processors but doesn't have as many features. When I tried it in the past it had an issue with making Intel processor systems unstable though it is easy to work around by turning off its service when you aren't using it.) There is very sleepy though I am not as familiar with it.
  15. stonemetal


    I use Ubuntu for development and Win7 for entertainment. As for hardware support it can be hit or miss. 10.10 didn't recognize wireless in my new desktop, it took editing a config file to fix(as in it already had the driver but kept loading some other driver instead.) I use linux for development because it is the best tool for the job, more interesting libs, and programs either just support Linux better or don't support windows at all. Try getting redis or hadoop working on windows as an example, especially if you don't wish to run cygwin.
  • 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!