1. Post #841
    Thanks guys, I think I will make the Nokia Lumia 920 with Windows Phone my next smartphone.
    Vault's Avatar
    May 2012
    1,252 Posts

    Instead of destroying Metal Gear, you will destroy slaughterhouses. The rations are salad as well.
    I have the game running right now at a steady ~30FPS, it's great. Though I would do 60, but it wouldn't work so well on some browsers.

    Now, I don't intend this to be "LMAO Pics: The Game". I really love Metal Gear, as you can probably tell by now, and seeing this image:

    it gave me an idea.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner x 14Funny x 2Programming King x 1Friendly x 1Optimistic x 1 (list)

  2. Post #842
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    Eh. IMO, procedurally generated levels are inherently boring. It's people who make interesting structures.
    That's why it works in Minecraft. The terrain is just a blank canvas for actual people to build interesting and unique things upon.
    The idea isn't to just throw the player into randomly generated terrain because it's the "cool" thing to do now. Before I get into the details of how randomly generated terrain is going to play into our game idea, here's the core idea: wave-based, cooperative, first person shooter with adaptive gameplay. The game will have two "announcers" who provide commentary on what the players are doing but can also mess with the players in various ways - changing everyone's weapons to novelty weapons for a short time, enabling friendly fire, killing a bunch of enemies, spawning a lot more enemies, changing the maximum wallet size, etc. The extent to which this happens is controlled by a setting, the more often the announcers mess with the players, the more difficult a round will be. The game takes place in a "simulation", so it's possible to add new environments later on.

    A level will be set in a certain environment, and those environments will have pre-designed structures and buildings, large and small. Like most other shooters, players will eventually memorize every corner of those buildings and will want to hide in corners of the building and camp on waves of enemies. What we want to do is strike a balance between the comfort of knowing an environment perfectly and always experiencing something new. Ammo and health will only be available in certain buildings once per-wave, per-player. Ammo will be scarce enough that players will have to travel between these buildings during waves. The purpose of the randomly generated terrain is to make the journey between buildings something that keeps players on-edge because they can't memorize the map well enough to always have a foolproof method of going to the next ammo cache without encountering any enemies.

    Of course, this is just what we believe is going to provide a new and fun experience for players. It might not be, so once we get this last bit of core "engine" code done, we're going to make a very quick prototype and get a bunch of our friends to playtest it. If we find that people generally enjoy the prototype then we'll clean up any remaining bugs in the core mechanic, start selling it in alpha, and continue working on it. If it just so happens to be very boring and tweaking settings doesn't change anything, then we have a pretty good base for a multiplayer FPS and can try some other mechanics until we find something really good.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1Winner Winner x 1 (list)

  3. Post #843
    SirCrest is my life, so is yours.
    Goz3rr's Avatar
    October 2009
    7,350 Posts
    I spent most of my day making a Game State manager, and a simple manager for buttons

    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Artistic Artistic x 6Programming King Programming King x 1 (list)

  4. Post #844
    Thanks guys, I think I will make the Nokia Lumia 920 with Windows Phone my next smartphone.
    Vault's Avatar
    May 2012
    1,252 Posts
    Question: What does everyone use to record? (I know what conversion software people use: Miro) I am trying CamStudio and I get 8 FPS using the MS video codec.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  5. Post #845
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    Question: What does everyone use to record? (I know what conversion software people use: Miro) I am trying CamStudio and I get 8 FPS using the MS video codec.
    What are you trying to record? CamStudio is not meant for games.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events

  6. Post #846
    Thanks guys, I think I will make the Nokia Lumia 920 with Windows Phone my next smartphone.
    Vault's Avatar
    May 2012
    1,252 Posts
    What are you trying to record? CamStudio is not meant for games.
    A flash window.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1 (list)

  7. Post #847
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    I want to try some genetic programming thingy, so I'm currently trying to create a small game like world in which tiny pixel creatures can move around and kill each other
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Informative Informative x 1 (list)

  8. Post #848
    I am a moderator.
    Swebonny's Avatar
    August 2006
    13,081 Posts
    I want to try some genetic programming thingy, so I'm currently trying to create a small game like world in which tiny pixel creatures can move around and kill each other
    I was thinking about making something like that a while ago but I didn't really know how to do it. I imagined different colored balls with different attributes like color, speed, energy consumption rate, sex drive and so on. Like balls with high sex drive rate would "mate" outside of some time frame and have orgies with balls with similar sex drive rate.

    Edited:

    Like that game GenePool. Was fun as hell.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events

  9. Post #849
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    I was thinking about making something like that a while ago but I didn't really know how to do it. I imagined different colored balls with different attributes like color, speed, energy consumption rate, sex drive and so on. Like balls with high sex drive rate would "mate" outside of some time frame and have orgies with balls with similar sex drive rate.

    Edited:

    Like that game GenePool. Was fun as hell.
    Well, I'll try implementing some sort of conditional behaviour.
    For example (in pseudocode):
    if temperature > geneticval then drink()

    something really silly like that
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Informative Informative x 1 (list)

  10. Post #850
    Gold Member
    Naelstrom's Avatar
    June 2010
    2,701 Posts
    Question: What does everyone use to record? (I know what conversion software people use: Miro) I am trying CamStudio and I get 8 FPS using the MS video codec.
    I record my screen straight to webm using ffmpeg. Not sure how it fares on windows though.
    Reply With Quote Edit / Delete Linux United States Show Events Optimistic Optimistic x 1 (list)

  11. Post #851
    Gold Member
    Darwin226's Avatar
    January 2009
    4,117 Posts
    I want to try some genetic programming thingy, so I'm currently trying to create a small game like world in which tiny pixel creatures can move around and kill each other
    Here's what I did.
    I made a assembly like language that acted like DNA (if that sounds hard, trust me, it's really simple)
    It had basic operations like jump, conditional jump, add, subtract, increment... all that fancy jazz.
    Then you add in some operations that relate to your sandbox. What I did was a SET command that took an index and a value as operands. When that code interpreted, on each set a function was called that, depending on which index was changed, did something.

    Then you add in mutations by randomly changing the DNA and there you go. Evolution.

    I did a test where the code could draw pixels on a square and the code that drew the most won, if there was a tie, the code that was shorter won and if there still was a tie, the code that executed in less cycles won.

    I let it run through the night and at the end the winner was code that drew a thick diagonal line through the square.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Winner Winner x 1 (list)

  12. Post #852
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    Darwin indeed

    I guess I will try something similar, but with pixel "creatures" that have a list of tasks they try to accomplish.
    My ultimate goal would be to have a world full of animals which are of different race (color) and properties, and can only breed if they're similar to each other.

    Edited:

    You know what, screw that, I'll try to recreate your thing, that sounds like an easy start
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  13. Post #853
    I've always wanted to do something like that as well.
    Reply With Quote Edit / Delete Mac United States Show Events Agree Agree x 1 (list)

  14. Post #854
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    I've always wanted to do something like that as well.
    Then do it
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  15. Post #855
    Gold Member
    Darwin226's Avatar
    January 2009
    4,117 Posts
    Darwin indeed

    I guess I will try something similar, but with pixel "creatures" that have a list of tasks they try to accomplish.
    My ultimate goal would be to have a world full of animals which are of different race (color) and properties, and can only breed if they're similar to each other.

    Edited:

    You know what, screw that, I'll try to recreate your thing, that sounds like an easy start
    I'd give you my code but for some reason, a majority of my old project files got corrupted. Executables don't run and source is filled with nulls... Oh well.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events

  16. Post #856
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    Thanks, but I'll try to write it completely on my own. I already have an idea how I can use python's tuples as asm instructions
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  17. Post #857
    I am a moderator.
    Swebonny's Avatar
    August 2006
    13,081 Posts


    Working better than before. My failure in making a random color generator and placing it in the correct place makes it flash like hell.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Programming King Programming King x 5Artistic Artistic x 3Winner Winner x 1 (list)

  18. Post #858
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    Are you trying to do an orbit thingy?

    Because if so, an object orbiting only one object will always be in an elliptical or perfectly round orbit.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  19. Post #859
    Thanks guys, I think I will make the Nokia Lumia 920 with Windows Phone my next smartphone.
    Vault's Avatar
    May 2012
    1,252 Posts
    Screw it, I will stick to Fraps->WMM->Miro now.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 2Artistic Artistic x 1Agree Agree x 1Winner Winner x 1 (list)

  20. Post #860
    I am a moderator.
    Swebonny's Avatar
    August 2006
    13,081 Posts
    Are you trying to do an orbit thingy?

    Because if so, an object orbiting only one object will always be in an elliptical or perfectly round orbit.
    Yeah, I'm trying to learn how to use vectors and stuff. I posted an earlier version one or two pages back and it was a complete mess. Turned out I multiplied wrong values with each and some other stupid stuff.
    Next I want add the ability to add force to a body by holding and dragging the mouse like in similar programs, should be fun.

    Edited:


    Interesting
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Artistic Artistic x 7 (list)

  21. Post #861
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    I think your physics are wrong

    Edited:

    Code:
    		0 = NOP
    		1 = Ram, Adress, omitted						# Changes the ram pointer to any value
    		2 = Add, Adress, Value							# Adds any value to any Ram adress
    		3 = Sub, Adress, Value							# Subtracts any value from any Ram adress
    		4 = Toggle, X, Y								# Toggles any pixel at X,Y of the surface
    		5 = Mult, Adress, Value 						# Multiply any Ram Adress with any Value
    		6 = Div, Adress, Value							# Divide any Ram Adress by the Value
    		7 = Jump, Adress, omitted						# changes the codepointer to any Adress
    		8 = sib, Adress, value							# skips the next instruction if the value is bigger than the value in the Ram Adress
    		9 = sis, Adress, value							# same, but smaller
    		10 = sie, Adress, value							# same, but equal
    		11 = siu, Adress, value							# same, but unequal
    		12 = Mod, Adress, value							# Moduloes (?) the Ram adress
    My "asm" instructionset. I wonder if this will be enough.
    (The second instruction currently is pretty useless)
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Programming King Programming King x 1 (list)

  22. Post #862
    Sartek's Avatar
    June 2009
    425 Posts
    @robmaister12
    How are you sending your randomly generated maps over? you could just pass the seed and the generation code over and it would probably be smaller in file size and then send over a hash of the map to make sure its the same as the server.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events

  23. Post #863
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts


    Random code executing
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  24. Post #864
    Richy19's Avatar
    May 2010
    5,389 Posts
    IQM parsing is going well. I'm challenging myself to get bone-based animation done by the end of today. (I'm using the model that comes with the IQM development kit)



    Edited:

    Loaded an IQM model without the rig, don't have a physics mesh so I threw it in as a viewmodel:



    Edited:

    ignore the rock texture, C#'s Bitmap class doesn't support .tga, I'm going to write a parser for it eventually.
    Sent you a PM but figured id just ask here, Im trying to do this in C++ but Im not really getting the concept of how to do this? I know its a bit different in C#. I think its mainly because your not parsing the file as such.
    Could you give any information?


    For example this is how im getting the mesh information, not sure if its correct way of doing it tho.
        iqmheader hdr;
        FILE *f = fopen(filen.c_str(), "rb");
        if(!f)
        {
            fclose(f);
            std::cout << "Failed to open: " << filen << std::endl;
            return false;
    
        }
        if(fread(&hdr, 1, sizeof(hdr), f) != sizeof(hdr) || memcmp(hdr.magic, IQM_MAGIC, sizeof(hdr.magic)))
        {
            fclose(f);
            std::cout << "Failed to open: " << filen << std::endl;
            return false;
        }
    
        std::cout << fseek(f , hdr.ofs_meshes, SEEK_SET) << std::endl;
    
        iqmmesh meshar[hdr.num_meshes];
        std::cout << fread(meshar, hdr.num_meshes, sizeof(iqmmesh), f) << std::endl;
        for(int i = 0; i < hdr.num_meshes; i++)
        {
            std::cout << meshar[i].name << " " << meshar[i].material << " " <<
                meshar[i].first_triangle << " " << meshar[i].num_triangles << " " <<
                meshar[i].first_vertex << " " << meshar[i].num_vertexes << " " <<std::endl;
        }
    std::cout << std::endl << "File: " << filen << std::endl;
        std::cout << "Magic: " << hdr.magic[16]<< std::endl; // the string "INTERQUAKEMODEL\0", 0 terminated
        std::cout << "Version: " << hdr.version<< std::endl; // must be version 2
        std::cout << "Filesize: " << hdr.filesize<< std::endl;
        std::cout << "Flags: " << hdr.flags<< std::endl;
        std::cout << "Textures: " << hdr.num_text << " : " << hdr.ofs_text<< std::endl;
        std::cout << "Meshes: " << hdr.num_meshes  << " : " <<  hdr.ofs_meshes<< std::endl;
        std::cout << "Vertex arrays: " << hdr.num_vertexarrays  << " : " <<  hdr.num_vertexes  << " : " <<  hdr.ofs_vertexarrays<< std::endl;
        std::cout << "Triangles: " << hdr.num_triangles  << " : " <<  hdr.ofs_triangles  << " : " <<  hdr.ofs_adjacency<< std::endl;
        std::cout << "Joints: " << hdr.num_joints << " : " <<  hdr.ofs_joints<< std::endl;
        std::cout << "Poses: " << hdr.num_poses << " : " <<  hdr.ofs_poses<< std::endl;
        std::cout << "Animations: " << hdr.num_anims << " : " <<  hdr.ofs_anims<< std::endl;
        std::cout << "Frames: " << hdr.num_frames << " : " <<  hdr.num_framechannels << " : " <<  hdr.ofs_frames << " : " <<  hdr.ofs_bounds<< std::endl;
        std::cout << "Comment: " << hdr.num_comment << " : " <<  hdr.ofs_comment<< std::endl;
        std::cout << "Extensions: " << hdr.num_extensions << " : " <<  hdr.ofs_extensions<< std::endl;
    

    which produces:
    Code:
    0
    24
    1 6 0 2386 0 1476 
    15 20 2386 602 1476 385 
    
    File: ./mrfixit.iqm
    Magic: 
    Version: 2
    Filesize: 257808
    Flags: 0
    Textures: 864 : 124
    Meshes: 2 : 988
    Vertex arrays: 6 : 1861 : 1036
    Triangles: 2988 : 105376 : 141232
    Joints: 75 : 177088
    Poses: 75 : 180688
    Animations: 1 : 187288
    Frames: 101 : 333 : 187308 : 254576
    Comment: 0 : 0
    Extensions: 0 : 0
    Reply With Quote Edit / Delete Linux United Kingdom Show Events Dumb Dumb x 1 (list)

  25. Post #865
    Gold Member
    Jookia's Avatar
    July 2007
    6,768 Posts
    @robmaister12
    How are you sending your randomly generated maps over? you could just pass the seed and the generation code over and it would probably be smaller in file size and then send over a hash of the map to make sure its the same as the server.
    What do you do if the hash is wrong?
    Reply With Quote Edit / Delete Linux Australia Show Events

  26. Post #866
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    What do you do if the hash is wrong?
    cry
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Funny Funny x 18Agree Agree x 3 (list)

  27. Post #867
    Sartek's Avatar
    June 2009
    425 Posts
    What do you do if the hash is wrong?
    Then you could always send the whole map over I guess...
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Funny Funny x 2 (list)

  28. Post #868
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts


    Well, picasso (that's what I call the "lifeform") is fully implemented now.

    Now to implement selection.

    Edited:

    Sorry for the image spam, but finally selection is implemented:



    Had to iron out some bugs first.

    I've never been so productive in my life before...
    But it's 5am, I have no caffeine and I am going to bed now
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Winner Winner x 2Programming King Programming King x 2 (list)

  29. Post #869
    omnomasaur's Avatar
    May 2009
    1,357 Posts
    An electrical engineer friend of mine wanted to make a color LED light controlled via USB.

    I made him this color selection wheel.

    Reply With Quote Edit / Delete Windows 7 United States Show Events Friendly Friendly x 7Programming King Programming King x 2Artistic Artistic x 1 (list)

  30. Post #870
    voodooattack's Avatar
    October 2009
    1,972 Posts
    Here's what I did.
    I made a assembly like language that acted like DNA (if that sounds hard, trust me, it's really simple)
    It had basic operations like jump, conditional jump, add, subtract, increment... all that fancy jazz.
    Then you add in some operations that relate to your sandbox. What I did was a SET command that took an index and a value as operands. When that code interpreted, on each set a function was called that, depending on which index was changed, did something.

    Then you add in mutations by randomly changing the DNA and there you go. Evolution.

    I did a test where the code could draw pixels on a square and the code that drew the most won, if there was a tie, the code that was shorter won and if there still was a tie, the code that executed in less cycles won.

    I let it run through the night and at the end the winner was code that drew a thick diagonal line through the square.
    I'm currently working on one:

    * Soft body physics (GPU accelerated via Bullet)
    * Cells have multiple modes to move: Flagella, pseudo-podding, and Brownian-motion.
    * DNA is physically stored inside a nucleus, and can be stolen, recycled, and/or infected with a different strain (Some strains of bacteria can do that, and some can trade RNA naturally)
    * Every cell starts out with a basic nucleus and some random RNA strands.
    * All actions require energy, ATP is the "currency", photosynthesis is allowed but dangerous (it produces lethal levels of free-radicals) unless the cell can dispose of free-radicals safely, its lifetime will deteriorate slowly. Free-radicals are akin to poison at the molecular level; they're quite unstable and always seek other molecules to forcibly bind with.
    * protein production is allowed, the cell must meet some minimal requirements to be able to synthesize some parts of the protein correctly though, if it doesn't there's a great chance of fatty acids and/or free radicals ruining the folding process and a prion is built instead, which could be lethal in and out of itself. Not only to the cell, but to the whole strain.
    * A cell can recycle nucleic acids and reclaim the molecules/energy if it knows how to and has a special organelle. A cell can turn into amoeba if it does it right.
    * A cell can "assimilate" other cells and capture them whole. (think mitochondrian magic)
    * Cells can store molecules in special containers (vesicles) to be released later, think of landmines. For example, a vesicle containing free radicals can be used as a weapon to poison other cells if connected to flagella. (effectively becoming a cellular scorpion ) Another strategy is to build a thin outer membrane and fill that with waste/poisonous stuff, but that can bite it in the ass later if it attempts mitosis without dealing with it first.
    * Materials for everything must exist within the outer membrane; molecules, atoms, and proteins will home to binding sites like real ones do.
    * Proteins can leave the cell through the membrane and enter other cells, thus making multi-cellular organisms a possibility. (If mitosis occurs and the cells stop it at the telophase)

    That's about it for now.

    Edited:

    Here's what I'm trying to simulate:
    http://upload.wikimedia.org/wikipedi...ba_proteus.ogg

    That's a huge amoeba pseudo-podding like a boss.
    Reply With Quote Edit / Delete Windows 7 Egypt Show Events Winner Winner x 2 (list)

  31. Post #871
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    @robmaister12
    How are you sending your randomly generated maps over? you could just pass the seed and the generation code over and it would probably be smaller in file size and then send over a hash of the map to make sure its the same as the server.
    The server generates a seed. When a client connects, the server sends it a packet that contains the seed. Each packet contains a small 1-byte CRC checksum to make sure the contents of the packet arrive correctly. This is done over UDP, I don't know too much about it, but I'm pretty sure there's a very thin reliability layer set up to make sure the client actually receives the packet. So the seed should arrive, and correctly.

    Given a seed, world generation is deterministic. If, with testing, we see that sometimes the wrong world gets generated incorrectly, we can have the client send a verification packet back to the server not with a hash of world data (since floating point numbers act slightly differently on different machines), but the next randomly generated number after the generation has been done. If everything went properly, that number should match with the server.

    I would be more worried about floating-point precision across machines. Different computers (even different compile settings) will produce slightly different values. The server may generate a value of 4.9999999f but the client may generate a value of 5.0000001f, and when I check for < 5f, the server will include the point, but the client won't. This is really just an edge case since terrain values are rarely going to be exactly on a border I'm checking for, and the result is that a client may see one or two vertices in the world differently than on the server, and they'll just glitch around it when the server corrects their position.

    Buildings and other objects that are treated as entities in the game will not actually be placed as part of the terrain generation process on the client, they'll receive the entities from the server.

    Edited:

    actually, buildings will be placed on the client anyways, the server will technically just correct their positions when the entity data is sent over.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  32. Post #872
    Sartek's Avatar
    June 2009
    425 Posts
    Yep sounds like a good way to do it.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events

  33. Post #873
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    I'm looking into it now, and .NET guarantees IEEE754. Values may still be slightly different on separate CPUs. If it's an issue at all I'll mess around with float.Epsilon to see if there's a way I can statistically minimize the occurrence of discontinuities. If float.Epsilon has the same skewing on different CPUs, I might be able to send the server's bits for float.Epsilon and calculate a delta with the client's float.Epsilon and instead of checking for <= 5.0f, I'd check for <= 5.0f + delta.

    But I'm getting ahead of myself. There are a lot more important things to get done first...

    Edited:

    someone on the internet was lying! Only Java uses strictfp, .NET uses the system's FPU...
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  34. Post #874
    laylay's Avatar
    November 2007
    599 Posts
    For example this is how im getting the mesh information, not sure if its correct way of doing it tho.
    You're just reading a file, there's not many ways of doing it.

    I'm not sure exactly what you're asking but here's my working loader, it's messy code but it does the job.

    bool Model::ReadIQM(const std::string& path)
    {
        std::ifstream stream(path.c_str(), std::ios::binary);
    
        if (!stream.good())
        {
            return false;
        }
    
        IQM::Header header;
        stream.read((char*)&header, sizeof(IQM::Header));
    
        if (memcmp(header.magic, IQM::MAGIC, sizeof(IQM::MAGIC)) != 0)
        {
            stream.close();
    
            return false;
        }
    
        if (header.version != IQM::VERSION)
        {
            stream.close();
    
            return false;
        }
    
        std::vector<Vector3f> vertexPositions(header.num_vertexes);
        std::vector<Vector2f> vertexTexCoords(header.num_vertexes);
        std::vector<Vector3f> vertexNormals(header.num_vertexes);
        std::vector<unsigned char> vertexBoneWeights(header.num_vertexes * 4);
        std::vector<unsigned char> vertexBoneIndices(header.num_vertexes * 4);
    
        for (unsigned int i = 0; i < header.num_vertexarrays; ++i)
        {
            IQM::VertexArray vertexArray;
            stream.seekg(header.ofs_vertexarrays + (i * sizeof(IQM::VertexArray)));
            stream.read((char*)&vertexArray, sizeof(IQM::VertexArray));
    
            if (vertexArray.type == IQM::ATTRIBUTE_POSITION)
            {
                if (vertexArray.format != IQM::VALUE_FLOAT || vertexArray.size != 3)
                {
                    stream.close();
    
                    return false;
                }
    
                stream.seekg(vertexArray.offset);
                stream.read((char*)&vertexPositions[0], header.num_vertexes * sizeof(Vector3f));
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_TEXCOORD)
            {
                if (vertexArray.format != IQM::VALUE_FLOAT || vertexArray.size != 2)
                {
                    stream.close();
    
                    return false;
                }
    
                stream.seekg(vertexArray.offset);
                stream.read((char*)&vertexTexCoords[0], header.num_vertexes * sizeof(Vector2f));
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_NORMAL)
            {
                if (vertexArray.format != IQM::VALUE_FLOAT || vertexArray.size != 3)
                {
                    stream.close();
    
                    return false;
                }
    
                stream.seekg(vertexArray.offset);
                stream.read((char*)&vertexNormals[0], header.num_vertexes * sizeof(Vector3f));
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_TANGENT)
            {
                
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_BLENDINDEXES)
            {
                if (vertexArray.format != IQM::VALUE_UBYTE || vertexArray.size != 4)
                {
                    stream.close();
    
                    return false;
                }
    
                stream.seekg(vertexArray.offset);
                stream.read((char*)&vertexBoneIndices[0], header.num_vertexes * (sizeof(unsigned char) * 4));
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_BLENDWEIGHTS)
            {
                if (vertexArray.format != IQM::VALUE_UBYTE || vertexArray.size != 4)
                {
                    stream.close();
    
                    return false;
                }
    
                stream.seekg(vertexArray.offset);
                stream.read((char*)&vertexBoneWeights[0], header.num_vertexes * (sizeof(unsigned char) * 4));
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_COLOR)
            {
                
            }
            else if (vertexArray.type == IQM::ATTRIBUTE_CUSTOM)
            {
                
            }
        }
    
        char* text = new char[header.num_text];
        stream.seekg(header.ofs_text);
        stream.read(text, header.num_text);
    
        std::vector<IQM::Triangle> triangles(header.num_triangles);
        stream.seekg(header.ofs_triangles);
        stream.read((char*)&triangles[0], header.num_triangles * sizeof(IQM::Triangle));
    
        stream.seekg(header.ofs_meshes);
    
        for (unsigned int i = 0; i < header.num_meshes; ++i)
        {
            IQM::Mesh m;
            stream.read((char*)&m, sizeof(IQM::Mesh));
    
            std::vector<Vertex> vertices;
            std::vector<IQM::Triangle> meshTriangles;
    
            for (unsigned int j = m.first_vertex; j < m.first_vertex + m.num_vertexes; ++j)
            {
                Vertex vertex;
                vertex.position = vertexPositions[j];
                vertex.texCoord = Vector2f(vertexTexCoords[j].x, 1.0f - vertexTexCoords[j].y);
                vertex.normal = vertexNormals[j];
                vertex.boneIndices[0] = (unsigned int)vertexBoneIndices[(j * 4) + 0];
                vertex.boneIndices[1] = (unsigned int)vertexBoneIndices[(j * 4) + 1];
                vertex.boneIndices[2] = (unsigned int)vertexBoneIndices[(j * 4) + 2];
                vertex.boneIndices[3] = (unsigned int)vertexBoneIndices[(j * 4) + 3];
                vertex.boneWeights[0] = (float)vertexBoneWeights[(j * 4) + 0] / 255.0f;
                vertex.boneWeights[1] = (float)vertexBoneWeights[(j * 4) + 1] / 255.0f;
                vertex.boneWeights[2] = (float)vertexBoneWeights[(j * 4) + 2] / 255.0f;
                vertex.boneWeights[3] = (float)vertexBoneWeights[(j * 4) + 3] / 255.0f;
                vertices.push_back(vertex);
            }
    
            // this is kind of lame.. Because mesh has their own index/vertex set, have to copy the indices
            // for this mesh and offset it back to index the vertex data for this mesh
            for (unsigned int j = 0; j < m.num_triangles; ++j)
            {
                meshTriangles.push_back(triangles[m.first_triangle + j]);
    
                unsigned int tempIndex1 = meshTriangles[j].vertex[0] - m.first_vertex;
                unsigned int tempIndex2 = meshTriangles[j].vertex[1] - m.first_vertex;
                unsigned int tempIndex3 = meshTriangles[j].vertex[2] - m.first_vertex;
    
                meshTriangles[j].vertex[0] = tempIndex3;
                meshTriangles[j].vertex[1] = tempIndex2;
                meshTriangles[j].vertex[2] = tempIndex1;
            }
    
            int vertexFormat = Mesh::VERTEX_POSITION | Mesh::VERTEX_UV | Mesh::VERTEX_NORMAL | Mesh::VERTEX_WEIGHT;
            Mesh* mesh = new Mesh(vertexFormat, std::string(&text[m.name]));
            mesh->SetIndices(&meshTriangles[0].vertex[0], m.num_triangles * sizeof(IQM::Triangle));
            mesh->SetVertices(&vertices[0], m.num_vertexes * sizeof(Vertex));
            m_meshes.push_back(mesh);
        }
    
        delete []text;
    
        stream.seekg(header.ofs_joints);
    
        for (unsigned int i = 0; i < header.num_joints; ++i)
        {
            IQM::Joint joint;
            stream.read((char*)&joint, sizeof(IQM::Joint));
    
            Vector3f jointTranslate(joint.translate[0], joint.translate[1], joint.translate[2]);
            Quaternion jointRotate(joint.rotate[0], joint.rotate[1], joint.rotate[2], joint.rotate[3]);
            jointRotate.Normalise();
    
            Matrix4x4 b = Matrix4x4::Translation(jointTranslate) * jointRotate.ToMatrix4x4();
            Matrix4x4 ib = jointRotate.Conjugate().ToMatrix4x4() * Matrix4x4::Translation(-jointTranslate);
    
            if (joint.parent >= 0) 
            {
                b = m_baseFrame[joint.parent] * b;
                ib *= m_inverseBaseFrame[joint.parent];
            }
    
            m_baseFrame.push_back(b);
            m_inverseBaseFrame.push_back(ib);
        }
    
        stream.close();
    
        return true;
    }



    I can help with anims if needed.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Useful Useful x 1Informative Informative x 1 (list)

  35. Post #875
    Follow me on github!
    benjojo's Avatar
    January 2009
    2,620 Posts
    The server generates a seed. When a client connects, the server sends it a packet that contains the seed. Each packet contains a small 1-byte CRC checksum to make sure the contents of the packet arrive correctly. This is done over UDP, I don't know too much about it.
    UDP has CRC checksums inside the packets them selfs. If the packet is corrupt them the OS will drop or send back a ICMP message.

    http://en.m.wikipedia.org/wiki/User_...ocol#section_2
    Reply With Quote Edit / Delete United Kingdom Show Events Agree Agree x 2 (list)

  36. Post #876
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    UDP has CRC checksums inside the packets them selfs. If the packet is corrupt them the OS will drop or send back a ICMP message.

    http://en.m.wikipedia.org/wiki/User_...ocol#section_2
    UDP checksums are optional
    Reply With Quote Edit / Delete Mac Australia Show Events Informative Informative x 2 (list)

  37. Post #877
    Gold Member

    March 2005
    3,028 Posts
    UDP checksums are optional
    Are there any major platforms that don't use the CRC?
    Also, this appears to be changing in IPv6.
    Reply With Quote Edit / Delete Windows 7 Show Events

  38. Post #878
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    UDP has CRC checksums inside the packets them selfs. If the packet is corrupt them the OS will drop or send back a ICMP message.

    http://en.m.wikipedia.org/wiki/User_...ocol#section_2
    Alright, then my friend who's working on networking is probably using that. I don't know exactly how our networking code works, but the beauty of working in a team - I don't have to. Just from what I've heard and seen in the commit logs, there's a checksum somewhere. Whether that's part of UDP or his own checksum and he disabled the built-in checksums, I don't know.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Funny Funny x 2 (list)

  39. Post #879
    Programming King and Most Patient Member 2013
    r0b0tsquid's Avatar
    December 2008
    1,223 Posts
    Added lexical closures:

    I was running through the lis.py unit tests, found that I needed closure support in order for lambdas to capture variables and stuff. All seems to be working now, turned out less complex than I'd thought :)
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Programming King Programming King x 1 (list)

  40. Post #880
    I have not made a lot of progress.

    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Winner Winner x 1Disagree Disagree x 1 (list)