Author Topic: Turok ATR viewer/exporter  (Read 68212 times)

Offline Stinkee2

  • Raptor
  • ***
  • Posts: 56
  • T:REP 255
    • View Profile
Turok ATR viewer/exporter
« on: August 28, 2015, 09:30:11 AM »

    ^Above image created by Duke64^

    NOTICE:
    The original contents of this post have been removed to make room for a more informationally comprehensive view of this project's status.

    Overview
    Summary
    The Turok: Evolution ATR editor project aims to create an interface for modding existing levels and creating new ones as well as creating new and modding existing menus and menu hierarchies.

    Current feature list (new features in bold)
    • Loads animated meshes
    • Loads static meshes
    • Loads pickups
    • Loads AI objects (waypoints, cover positions)
    • Loads textures
    • Loads lights
    • Loads cameras
    • Loads skybox
    • Loads invisible collision boxes
    • Loads invisible "ladder planes"
    • Loads invisible "water planes"
    • Saves actor transformations
    • Primitive level editing
    • Optional antialiasing
    • Ability to save levels to be used in game

    Future feature list
    • Clean user interface
    • Ability to import/export models
    • Ability to import/export textures
    • Ability to import/export animations
    • Ability to import/export sounds
    • Ability to import/export materials
    • Ability to create/modify causes and events
    • Ability to create/modify scene lights
    • Ability to create/modify enemy cover locations
    • Ability to create/modify enemy waypoint locations
    • Ability to create/modify enemy/ally spawn locations
    • Ability to create/modify invisible "collision cubes"
    • Ability to create/modify invisible "ladder planes"
    • Ability to create/modify node pathways
    • Ability to create/modify level lightmaps
    • Ability to create/modify water planes
    • Ability to import sky-sphere texture
    • Ability to view actor animations
    • Ability to edit/save menus to be used in game
    • Ability to view level from a camera's point of view
    • Use lights included in level and mimic Turok's lighting model
    • Apply descriptive custom texture to invisible objects
    • Load and use lightmaps if available
    • Load and use scene node pathways (such as paths that cameras follow during in-game cutscenes)

    Source Code: Github
    Screenshots: Imgur

    Downloads
    Revision B (Latest):
    http://www.mediafire.com/download/rdy7fc0wpej9l7c/T4Viewer%283%29.zip
    Revision B Details:
    http://www.turokforums.com/turok-evolution/turok-level-viewerexporter/msg2323/#msg2323

    Revision A:
    http://www.mediafire.com/download/mecepmud5357r9c/T4Viewer.zip

    [/list]
    « Last Edit: May 04, 2016, 08:51:31 PM by Stinkee2 »

    Offline Adon

    • Protector
    • ****
    • Posts: 346
    • T:REP 1052
    • Mystical
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #1 on: August 28, 2015, 03:53:59 PM »
    Wow that sounds confusing. Wish I could help but I just don't know how to do this stuff. I wish you best of luck I bet a few members here would absolutely love a sole Turok level editor!
    I AM ADON

    Offline Froglegs

    • Iguana
    • *
    • Posts: 23
    • T:REP 62
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #2 on: August 28, 2015, 06:02:32 PM »
    This is some really promising work you've got here, Stinkee2! I agree with Adon; some people, including myself, would love to see a possible level editor in the future. I've been hoping for the day that we would be able to mod Turok Evolution! Please keep us informed of your progress with your program. :D

    Offline Duke64

    • Administrator
    • *****
    • Posts: 2048
    • T:REP 7041
    • Sixty Four
      • View Profile
      • Duke64Nukem.com
    Re: Turok level viewer/exporter
    « Reply #3 on: August 28, 2015, 06:47:17 PM »
    Welcome I did not know you were the one I tried to get a hold of at the assembler forums pretty cool that you found here before checking your assembler to. True Turok fan then. I would love to make a level for any Turok game. This ensures possibility and life for the games long after there time plus more reason to play it to when there's always something new.
    Dinosaur Hunter
    "Its time to make tracks"
    "You are tiny grasshopper"
    "Suck it down"
    "Boo, No soup for you"
    "Arrrgghhhh"
    "I live again"

    Offline Stinkee2

    • Raptor
    • ***
    • Posts: 56
    • T:REP 255
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #4 on: August 28, 2015, 07:08:15 PM »
    This is some really promising work you've got here, Stinkee2! I agree with Adon; some people, including myself, would love to see a possible level editor in the future. I've been hoping for the day that we would be able to mod Turok Evolution! Please keep us informed of your progress with your program. :D

    When I was but a young naive 13 year old playing this game, it was a big driving factor for me to learn programming just so that I could modify this game. Of course after a while I realized the world that I had opened up and my interest for Turok did not stand up to the excitement of learning new things and building my own engines and things. But I totally understand the desire for more content for Turok.

    Welcome I did not know you were the one I tried to get a hold of at the assembler forums pretty cool that you found here before checking your assembler to. True Turok fan then.

    I actually went back to those forums earlier today to look for a post I remembered involving Turok 2 when I noticed the PM. I tend to float around until I find a place that feels like home, and Assembler just wasn't doing it for me. Perhaps I didn't give it a long enough chance and perhaps I didn't put enough work into integrating myself into the community. Oh well, I'm here and working on this now.

    I imagine the hardest part of this whole process is going to be learning exactly what the different file types contain.

    I'll post another update when I get some models loaded and on screen.
    « Last Edit: August 28, 2015, 07:15:07 PM by Stinkee2 »

    Offline Rok

    • Global Moderator
    • *****
    • Posts: 772
    • T:REP 2338
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #5 on: August 30, 2015, 01:17:29 PM »
    Well hope you feel welcome here you certainly have a good presence here already with this type of post I am excited to. I can't make levels but it would be really cool to play some user made content for once. So really good luck with this!
    Raptor Rok is metal.

    Offline Stinkee2

    • Raptor
    • ***
    • Posts: 56
    • T:REP 255
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #6 on: August 30, 2015, 03:08:49 PM »
    I don't have any screenshots yet, but I've made quite a bit of progress.

    I've deconstructed the .ATI files almost completely by analyzing the patterns in the data and I now understand the rules necessary for loading and saving data into the format. This is a big step for modding and level creation.

    As a bonus, I think the other formats are very similar, if not exactly the same. If they are the same, then that means that I can create a single library for loading/saving the one type of file and just send it the necessary data. This won't make much of an impact on a final product, it just means that things might be a little easier on any programmers working with this code.

    Here's a brief summary of how the format works:
    -In the beginning of the file, there are 4 bytes of data that are used for identifying the file format. This is nothing new, a lot of different types of files have something like this. In this particular format, the 4 bytes are 0x01 0x61 0x74 0x69, that translates to ati, which makes sense (the 0x01 is not an alphanumeric character).

    After this, there is a hierarchy of data blocks. At the start of each block there is some information about the block, the "header". These block headers stumped me for a while because they weren't always the same size, and sometimes the block size was one byte and sometimes it was two bytes.. After a while I figured out that in those special cases, before the block header there was one byte that describes the header type. A header header... Anyway, I identified which bytes corresponded to which types of block headers and got that sorted out.

    I'm not sure what all of the data in the block headers mean but here's an overview of the types of block headers I found

    -Block header type 0 (Normal block header, no "header header")
    --Byte 0: Unknown
    --Byte 1: Unknown
    --Byte 2: Size of block (in bytes)
    --Byte 3: Length of block ID string

    -Block header type 1 (header header byte: 0x82 or 0x81)
    --Byte 0: Unknown
    --Byte 1&2: (16-bit integer): Size of block (in bytes)
    --Byte 3: Length of block ID string

    -Block header type 2 (header header byte: 0x61)
    --Byte 0: Unknown
    --Byte 1: Size of block (in bytes)
    --Byte 2: Unknown
    --Byte 3: Unknown
    --Byte 4: Length of block ID string

    -Block header type 3 (header header byte: 0xA1)
    --Byte 0: Unknown
    --Byte 1&2: (16-bit integer): Size of block (in bytes)
    --Byte 3: Unknown
    --Byte 4: Unknown
    --Byte 5: Length of block ID string

    Immediately following this information is the block ID string ("ACTOR", "NAVNODE", "ACTOR_VARIABLES", ...), followed by 0x00, or "null".
    Immediately following the 0x00 is a block of data with the size stated in the block header.
    This block of data can contain more blocks of data like I just described, or a value or values. It could be anything really.

    Here's a small example of what an ATI file contains:
    +data/levels/u_jcowlishaw/screens/Attract/attract.ati
    |+ACTOR Y:\Data\Actors\Widgets\Widget.atr.
    | |-ID: 1
    | |+Name
    | | |-PressStartWidget
    | |
    | |+POS (x,y,z) (12 bytes, 3 floats)
    | | |- 0.0, -15.1498, 0.0
    | |
    | |+ROT (Euler angles probably) (12 bytes, 3 floats)
    | | |- 0.000061, 0.0, 0.0
    | |
    | |+Scale (x,y,z) (12 bytes, 3 floats)
    | | |- 16.0, 2.0, 1.0
    | |
    | |+ACTOR_VARIABLES
    | | |+W_FC
    | | | |-0xFF (255)
    | | |
    | | |+W_TMN
    | | | |-0x01 (1)
    | | |
    | | |+W_YLAY
    | | | |-0x01 (1)
    | | |
    | | |+W_XLAY
    | | | |-0x01 (1)
    | |
    | |+ etc,etc

    You get the picture, it's a hierarchy of data.
    If you want to see more, here's a partial deconstruction of a couple files:
    attract.atr: http://pastebin.com/rwg9CdK9
    pod01_03_ttjungle.atr: http://codepad.org/cinaicfZ


    If you don't get turned on by information such as this, then just wait for some screenshots to emerge once I integrate my rendering engine and have whole levels to explore. Just a few more days.
    « Last Edit: August 30, 2015, 08:29:58 PM by Stinkee2 »

    Offline Stinkee2

    • Raptor
    • ***
    • Posts: 56
    • T:REP 255
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #7 on: August 30, 2015, 09:18:57 PM »
    Well, I've got some screenshots. There are no textures yet, I still have to implement a .DDS loader, but that should be easy as pie. Also it's only the static meshes.

    Have a look:

    Here's a perspective which I'm sure we are all familiar with:


    It's hard to tell because of the lack of textures, but this is when you first walk out into the open after killing the first sleg:


    From above:


    The rock on which the key-holding sleg is placed:


    Another view:


    The end of the first level:


    I'll post some more screenshots when I have the meshes textured.

    EDIT:

    Not quite, but almost. It turns out that DDS loading is not as easy as I thought... It's either the image library I'm using or the way I transfer the pixels to OpenGL.

    EDIT AGAIN:
    I GOT IT. I GOT IT.


    Ah ha!


    Remember this?


    Clearly there are some problems for levels other than the first. I'll figure it out tomorrow.
    « Last Edit: August 31, 2015, 01:37:54 AM by Stinkee2 »

    Offline operative lm

    • Raptor
    • ***
    • Posts: 137
    • T:REP 468
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #8 on: August 30, 2015, 09:51:54 PM »
    I don't pretend to understand most of the code, but I am definitely impressed. To clarify: will your viewer load static props and character models (both .atr and .mtf) as well? Your first post leads me to believe the answer is "yes," but I want to make sure. :P

    Offline Stinkee2

    • Raptor
    • ***
    • Posts: 56
    • T:REP 255
      • View Profile
    Re: Turok level viewer/exporter
    « Reply #9 on: August 30, 2015, 10:15:09 PM »
    will your viewer load static props and character models (both .atr and .mtf) as well?

    Indeed, I plan to support static and dynamic/animated meshes. There is some other information in the files as well regarding events, and if what I'm thinking is correct, then that stuff can be modified to affect the gameplay. If that's the case then I will have to do a lot of experimenting in order to find out what a lot of things mean. I'm afraid it will be a painstaking process when it comes to it. At the very least I plan to implement the following features:
    -Windows and OS X executables (also Linux if anyone desires)
    -Import 3D meshes from other formats
    -Import textures for the meshes
    -Export all data to common formats
    -Move/scale/rotate objects
    -Build lightmaps (a feature I think the Turok 4 engine has support for, judging from the presence of a "lightmaps" folder for some levels)
    -Particle system creation/modification (if possible, it may very well be)

    There are some limitations regarding the meshes though. Every mesh uses an index list for object rendering, and the index data type they use is a 16 bit integer, which means that there can only be up to 65,535 vertices per mesh.

    I'm HOPING that there is no limitation on texture sizes, because that would mean that we couldn't improve the quality of the current textures in the game very much.
    « Last Edit: August 31, 2015, 03:30:46 AM by Stinkee2 »