Monthly Archive for December, 2008

XPhysics 4

This is how XPhysics started (simple project of making stuff out of balls and springs):

Here are some screenshots from the developement:

Simulator is simple – it just simulates balls and spring connections between them. Here are stages:

  • 1. Simulate links. Force is -k*dx, and also small coordinate change is applied to draw links closer to their original locations – this keeps stuff more stable. Also apply deformations if needed (change link length).
  • 2. Process gravity
  • 3. Process collisions
  • 4. Add force of each dot to it’s position
  • 5. Remove links that are overstressed

Continue reading ‘XPhysics 4′

XPhysics 3 (oldpost)

This is a repost from my old blog

Meshes!
That’s right, they are almost here. I did quick “wrap” for G3D model loader (G3D 7.0 and above).
I updated factory classes, now you can load mesh from file in several modes (not all have been done yet):

  • Just load the model data (such models tend to “collapse” inside of themselves, because there is no “interior” of model)
  • Load model data and place “interior” inside (variable resolution of interior, to be done in nearest few days)
  • Full linking (all dots are linked with all other dots in a certain radius you specify, terribly slow, and useful only for small models)
  • Right now factory can create meshes and cubes. Coming soon: spheres and cylinders, ropes, hydraulics (returns new class “XPhysHydraulic” which allows extended control over hydraulic, probably torus, and some other simple geometries.


    Mesh-based object

    XPhysics 2 (oldpost)

    This is repost from my old blog

    I added better API (still to add: bodies and object/material factory), and extended default physics solver (now you can have several solvers, and solve with them). You can simulate materials like glass. This is experimental, and not 100% finished, but in general it behaves like glass (when colliding).
    Also added more control over stress value, now you can specify two critical points (permanent deformation point, and structure loss point), specify maximum deformation (actually how much can you “squash” the object), and added mass multiplier (the more dots structure has, the more mass it has though, gonna do something with that later).

    Here is early version of API, if you want to look (didn’t configure properly yet, didn’t add all information yet): http://forest-tm.com/xphysdocs/

    I have an idea of adding Vertlet-based solver, now that we can add them without problem.

    Also, screenshot:

    (Glass material)

    XPhysics (repost from old blog)

    This is a repost from my old blog

    XPhysics is a physics engine written by me. Along with standard rigid bodies it supports deformation of bodies, breakable bodies, etc.

    Some screenshots:

    Deformed object. Material – hard material, but bends when large force is applied. It will stay bended like that.


    Auto-joined objects (blue one is much heavier than green one).


    Broken and deformed body.


    Soft body, with large plasticity. Fell from a really large height, right on it’s corner.

    GTA2 Sounds (repost from old blog)

    This is a repost from my old blog, so today isn’t really today

    Today I wrote a GTA2 sound extractor – it extracts in-game sounds into separate WAV files, instead of GTA2 .SDT/.RAW formats.

    Here is it: http://users.d2k5.com/Black%20Phoenix/files/soundext2.rar

    GTA2 sound format was easy, to figure it out I just opened .SDT file in hex editor (SDT is the main one), and looked for patterns:

    I selected the repeating pattern, now we just compare the repeating patterns, and use some data inspect (for example, I spotted 22050 value – standart sound rate value). This is the final format (some fields are unknown, but are not vital):
    .sdt file stores array of following 24-byte records:
    [0] Start offset (in bytes)
    [4] Size (in samples!)
    [8] Frequency
    [12] [unkown]
    [16] [unkown]
    [24] End marker (0xFFFFFFFF)
     
    .raw just stores 16-bit signed PCM samples. Data is pointed by start offset and size from .sdt

    Continue reading ‘GTA2 Sounds (repost from old blog)’

    KCPU… this time it’s fully working!

    KCPU works! I added ALU, added second register read data line, reworked opcode format (it’s much neater now, and allows for 32 opcodes). ALU gives access to 16 opcodes, incl MOV, ADD, SUB, MUL, SHL, etc.

    Download: kcpu_revision5.rar (22KB)

    Programming it is pretty hard right now – you have to program it in raw machine code. Here is the stock program I uploaded into ROM by default:

    0x000: 03 1F 	MOV R0,0x1F
    0x002: 43 3F 	MOV R1,0x3F
    0x004: 83 7F 	MOV R2,0x7F
    0x006: C3 FF 	MOV R3,0xFF
    
    0x008: 03 00 	MOV R0,0x00
    0x00A: 43 00 	MOV R1,0x00
    0x00C: 83 00 	MOV R2,0x00
    0x00E: C3 00 	MOV R3,0x00
    
    0x010: 00 08	JMP 0x010
    

    This is how you enter this program:

    More info on programming later!

    KCPU once again

    I replaced old timing block based on logic gates to a simple timing block based on 74193, 74154, 7404 chips. It can output up to 12 clocks/pulses, but I only use 6 right now.
    New timing block is triggered every incoming clock, and doesn’t divide frequency, so it should behave better than old one.

    Also I replaced instruction pointer counters, using 74193 instead of 74191 now. CPU is now fully operative, and I’m going to add more opcodes soon.

    KCPU revised

    Scheme got updated! I made it use a lot less chips, and a lot cleaner wiring. Now it uses only 4 buffer chips for registers, instead of 8 binary counter chips.

    Also it support MOV opcode now (between register and register, and between register and memory).

    Zoom-in to register read area (older screenshot, I fixed the red line):