• 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.

Henri Korpela

  • Content count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About Henri Korpela

  • Rank
  1. Thanks, [b]Kyall[/b], for such a useful post! Now I see what are the benefits of using plain coordinates instead of angles to represent direction of where to go to. There's no need to recalculate direction when you can just sum it up to already existing coordinates in order to move requested entity. Simple yet satisfying. Anyway, could somebody still prove why this is true to deepen my understanding (and possibly the other's following this topic): [source lang="c++"]result.x = cos( direction.x ) * magnitude - sin( direction.y ) * magnitude result.y = sin( direction.x ) * magnitude + cos( direction.y ) * magnitude[/source]
  2. Hi, folks and welcome to the topic! First of all, I'd like to point out that I'm no math genius, but I really got hooked on vectors seeing their benefits in programming entity movement in virtual 2D and 3D environments. There are several vector classes written in C/C++ to be found on the Internet. However, as I'm willing to learn more about vectors all the time, I dediced to create my own class template in C++ called [b]Vector3[/b]. As far as I know, vector consists of a direction and a magnitude. Direction can be represents with the help of other vectors or by an angle. Magnitude on the hand, is simply the line segment from one point to another. Sounds reasonably simple. Now, I'm also willing to create a class called [b]Entity[/b]. In this class I'd like to have a [b]Vector3[/b]-class instance as a member. Via member function called "move" I'd like to use the vector to move some entity, like this: [CODE] Entity bob("Bob"); bob.move(30, 0, 1); // '30' and '0' are both angles, '1' represents velocity, which is in meters per second. [/CODE] Now, if I know both the direction given in angles and the magnitude, not to mention the vector start point in 3D space, how is it possible to calculate the vector end point or do I need to calculate the vector end point in order to move the entity? For me, it makes sense that the movement of an entity happens from one point to another, but how is this movement usually implemented by vectors?
  3. I'm just wondering why my static member function [b]_load_ogg[/b] does not work correctly... Could somebody explain me why?
  4. Hello, [i]game developers[/i]! I have been wandering around the Internet & managed to find a nifty little [i].c source file[/i] called [b]stb_vorbis[/b]. I ended up using it due to it's easy integration to my game engine & because [b]libvorbis[/b]' libraries didn't link themselves properly using [b]MinGW[/b]. After I had set up the[b] stb_vorbis[/b] by turning it into a header file & fixing some warnings in that file the compiler helpfully informed me about, I started to look for tutorials. Well, eventually, I found some, sort of: http://code.google.com/p/irrlamb/source/browse/trunk/source/engine/audio.cpp?r=726 https://gist.github.com/965399 Especially the last link turned out to be great, because it offered me a way to [i]stream [/i]an .ogg file. I wanted to have an object-oriented approach to handle .ogg files, both by buffers and streams, but couldn't get it to work. Now, I still have the same problem. By browsing the forums, I concluded that [b]stb_vorbis[/b] is a good solution. However, there are no actual tutorials to help you to set it up. That's sad. So, the question is, has anybody ever managed to get [b]stb_vorbis[/b] to load and play [i].ogg files[/i] via [b]OpenAL[/b]? It'd be very good thing to have a good solution for all other people to solve this similiar problem. Here's my buffer class: audio_buffer.hpp [CODE]/// ----------- /// @author God /// ----------- #ifndef __TIM_AUDIO_BUFFER_HPP__ #define __TIM_AUDIO_BUFFER_HPP__ namespace Tim{ namespace Audio{ /// ------------------------------------------------------------------------- /// @class Buffer /// @brief Represents an audio buffer, where audio files can be loaded into. /// ------------------------------------------------------------------------- class Buffer{ /// Friends: friend class Source; public: /// Enumerations: enum Formats{FORMAT_AUTODETECT, FORMAT_MP3, FORMAT_OGG, FORMAT_VOC, FORMAT_WAV}; /// Constructors & destructors: explicit Buffer(char const* file, Audio::Buffer::Formats const file_format = Audio::Buffer::FORMAT_AUTODETECT); ~Buffer(void); private: /// Static member functions: static void _check_file(Audio::Buffer& buffer); static void _load_ogg(Audio::Buffer& buffer); static void _load_wav(Audio::Buffer& buffer); /// Member data: Audio::Buffer::Formats const _m_iFormat; char const* _m_cpFile; int mutable _m_iChannels; unsigned int _m_uiBuffer; }; } } #endif // __TIM_AUDIO_BUFFER_HPP__[/CODE] audio_buffer.cpp [CODE]#include <cstdio> #include <cstring> #include <vector> #include <tim/al/al.h> #include <tim/al/alc.h> #include <tim/stb_vorbis/stb_vorbis.h> #include <tim/audio_buffer.hpp> using namespace Tim; /// ------------------------------------------------------------------------- /// @class Buffer /// @brief Represents an audio buffer, where audio files can be loaded into. /// ------------------------------------------------------------------------- /// Constructors & destructors: Audio::Buffer::Buffer(char const* file, Audio::Buffer::Formats const file_format) : _m_iFormat(file_format), _m_cpFile(file){ ::alGenBuffers(1, &_m_uiBuffer); _check_file(*this); } Audio::Buffer::~Buffer(void){ ::alDeleteBuffers(1, &_m_uiBuffer); } /// Static member functions: void Audio::Buffer::_check_file(Audio::Buffer& buffer){ switch(buffer._m_iFormat){ case FORMAT_MP3: break; case FORMAT_OGG: _load_ogg(buffer); break; case FORMAT_VOC: break; case FORMAT_WAV: _load_wav(buffer); break; default: switch(buffer._m_cpFile[::strlen(buffer._m_cpFile) - 3]){ case 79: // case 'O': case 111: // case 'o': _load_ogg(buffer); break; case 87: // case 'W': case 119: // case 'w': _load_wav(buffer); break; } break; } } void Audio::Buffer::_load_ogg(Audio::Buffer& buffer){ ::stb_vorbis* __file = ::stb_vorbis_open_filename(const_cast<char*>(buffer._m_cpFile), NULL, NULL); ::stb_vorbis_info __info = ::stb_vorbis_get_info(__file); int const __length_samples = (::stb_vorbis_stream_length_in_samples(__file) * __info.channels); ::ALshort* __buffer = new ::ALshort[__length_samples]; ::alGenBuffers(1, &buffer._m_uiBuffer); ::stb_vorbis_get_samples_short_interleaved(__file, __info.channels, __buffer, __length_samples); ::alBufferData(buffer._m_uiBuffer, ((__info.channels == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16), __buffer, (__length_samples * sizeof(::ALshort)), __info.sample_rate); delete[] __buffer; ::stb_vorbis_close(__file); } void Audio::Buffer::_load_wav(Audio::Buffer& buffer){ ::FILE* __file = ::fopen(buffer._m_cpFile, "rb"); short __bits_psample, __bytes_psample, __channels, __type_format; long __bytes_psec_avg, __rate_sample, __size, __size_chunk, __size_data; for(__size_data = 0; __size_data < 4; ++__size_data) // __size_data-variable represents a temporary iterator. ::getc(__file); ::fread(&__size, sizeof(long), 1, __file); for(__size_data = 0; __size_data < 8; ++__size_data) // __size_data-variable represents a temporary iterator. ::getc(__file); ::fread(&__size_chunk, sizeof(long), 1, __file); ::fread(&__type_format, sizeof(short), 1, __file); ::fread(&__channels, sizeof(short), 1, __file); ::fread(&__rate_sample, sizeof(long), 1, __file); ::fread(&__bytes_psec_avg, sizeof(long), 1, __file); ::fread(&__bytes_psample, sizeof(short), 1, __file); ::fread(&__bits_psample, sizeof(short), 1, __file); for(__size_data = 0; __size_data < 4; ++__size_data) // __size_data-variable represents a temporary iterator. ::getc(__file); ::fread(&__size_data, sizeof(long), 1, __file); unsigned char* __buffer = new unsigned char[__size_data]; ::fread(__buffer, sizeof(unsigned char), __size_data, __file); ::fclose(__file); // Opened file no longer needed, so it will be closed. ::alGenBuffers(1, &buffer._m_uiBuffer); ::alBufferData(buffer._m_uiBuffer, (__bits_psample == 8) ? ((__channels == 1) ? AL_FORMAT_MONO8 : AL_FORMAT_STEREO8) : ((__channels == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16), __buffer, __size_data, __rate_sample); delete[] __buffer; // A TEMPORARY BUFFER MUST DIE! } #undef __TIM_TEMPORARY_SIZE_BUFFER[/CODE]
  5. Hello, I created a very primitive application which is both [b]DirectX[/b] & [b]OpenGL[/b] compatible. As I already mentioned, it's primitive, but it works... almost. There is a slight problem and it's about the callback, which handles the window closure in [b]GLFW API[/b]. So, the question is: what kind of function definition will handle the callback properly? I know that the callback in [b]GLFW [/b]is this: int glfwSetWindowCloseCallback(void); I'm looking for proper implementation of the callback function. [b][u]PLEASE NOTE[/u]: WinAPI[/b] is out of the question, because the goal of my [b]OpenGL [/b]implementation of my application is to be compatible with [i]non-Microsoft[/i] systems. This is why I have two different APIS: [b]DirectX [/b]& [b]OpenGL[/b].