• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


This topic is now archived and is closed to further replies.


Load .3ds missing something?

5 posts in this topic

Hi, I'm trying to work out some code to load a .3ds file. From the file spec, the following code seems like it should work, it confirms that it found the specific chunks I'm looking for but returns some nonsense value as the number of vertices in the file. Is there something I am missing?
#include <iostream.h>
#include <fstream.h>

#define MAIN3DS 0x4D4D
#define TRI_VERTEXL 0x4110

void main() {
   ifstream infile;

   char *buffer;
   int length;
   short chunkid;

   infile.open("Doc1.3ds", ios::binary);
   infile.seekg(0, ios::end);

   length = infile.tellg();
   buffer = new char[length];

   infile.seekg(0, ios::beg);
   infile.read(buffer, length);


   int vCounter = 0;

   for (int i = 0; i < length; i++) {
      chunkid = *(short *)(buffer+i);
      switch (chunkid) {
      case MAIN3DS:
         cout << "Found chunk MAIN3DS at byte:" << i << endl;
      case TRI_VERTEXL:
         cout << "Found chunk TRI_VERTEXL at byte:" << i << endl;
         vCounter = *(short *)(buffer+i);
         cout << vCounter << endl;
Edited by - bdrewes on February 16, 2002 7:15:32 PM

Share this post

Link to post
Share on other sites
Hav''nt got any .3ds code on me but are you sure that the number of vertices can be read into a Short ?

Short = 2 bytes from -32K to 32K

try Unsigned Short or Unsigned Int (or others)


Share this post

Link to post
Share on other sites
Well, the specifications for a .3ds described here: http://www.dcs.ed.ac.uk/home/mxr/gfx/3d/3DS.spec says that the ''number of vertices'' is stored as an unsigned int. They describe an unsigned int (unless I''m reading it wrong) as 2 bytes. Here is what it says:

* Subchunks of 4100 - Triangular Polygon List

id Description
4110 Vertex List
4111 Vertex Options
4120 Face List
4130 Face Material
4140 Mapping Coordinates
4150 Face smoothing group
4160 Translation Matrix
4165 Object visible/invisble
4170 Standard Mapping

* 4110 - Vertex List

start end size type name
0 1 2 unsigned int Total vertices in object
2 5 4 float X-value
6 9 4 float Y-value
10 13 4 float Z-value

bytes 2..13 are repeated times the total amount of vertices in the object

so...Im guessing that at the time this was written, or for the computer the 3d studio code was written on, an unsigned int was 2 bytes. So I think type casting as short is needed.

Also, I tested it and on my system unsigned int is the same size as int (4), and unsigned short is that same as short (2). What really is the difference?

Share this post

Link to post
Share on other sites
where can I find the full reference about .3ds format or tutorials about load .3ds file?

goddess just one...

Share this post

Link to post
Share on other sites