• Content count

  • Joined

  • Last visited

Community Reputation

159 Neutral

About Octav

  • Rank
  1. How to pack game resources?

    [quote name='Goran Milovanovic' timestamp='1348946737' post='4985125'] Why is it necessary to pack everything into a single file? You could simply organize your resources into their appropriate directories. Sounds should be in sounds, images in images, fonts in fonts, etc. [/quote] Well first of all I'd have to put the executable where the images are, second of all in an archive they are compressed & organized (fonts in fonts, images in images, etc) second of all because I haven't seen any games except LDW games that leave their resources to the open eye in 10 years of gaming and I simply consider it unprofessional to do so, but then again it's simply my oppinion, a zip file is like a folder structure, it's very organised but instead is cleaner, and the game can be modded just as easy.
  2. How can I use PhysFS?

    [quote name='Cornstalks' timestamp='1348942451' post='4985113'] [quote name='Octav' timestamp='1348933107' post='4985085'] EDIT: after researching I found out what you meant by shell, You meant using the run feature. But the rest of the steps are still unknown to me [/quote] Actually, on Windows it's the "Command Prompt" (not "Run...", though you can start the Command Prompt by typing "cmd" into "Run..."). (I'm assuming you are on Windows) If you're on Windows, just use the CMake GUI (run CMakeSetup.exe, which should be in your Start menu). [url="http://www.cmake.org/cmake/help/runningcmake.html"]Here's a nifty tutorial on running CMake[/url]. Using CMake through the GUI is easiest. If you have specific questions from that link I just posted, feel free to ask. [/quote] Alright what I did was: Set the source code in Cmake GUI to "F:/CodeBlocks/physfs-2.0.2" and build the binaries at "F:/CodeBlocks/physfs-2.0.2/build" However when running it's giving me "The application has failed to start because libgmp-10.dll was not found." 5 times, after which it starts to configure, but before it ends it gives me this error: "Error in configuration process. Project files may be invalid". What to do? [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] EDIT: I do have the environmental variables set correctly Error code: CMake Error at C:/Documents and Settings/Stefan.MONA-H6H4KPUJNF/Desktop/cmake-2.8.9-win32-x86/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): The C compiler "c:/mingw/bin/gcc.exe" is not able to compile a simple test program.
  3. How to pack game resources?

    [quote name='SiCrane' timestamp='1348939109' post='4985106'] For this kind of thing I use [url="http://icculus.org/physfs/"]PhysFS[/url]. Basically everything goes in a zip file that I rename with a different extension. [/quote] I wanted to use PhysFS too initially, but I've been struggling forever to install it. could you check out [url="http://www.gamedev.net/topic/632008-how-can-i-use-physfs/"]this question[/url]? It would help a lot if an actual PhysFS user would pop a good answer for me. Thanks in advance [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  4. I've only recently gotten into game programming, but one thing is bothering me a lot. The way I'm packaging my games is desgusting to say the least, everything is in 1 folder, it's like a file soup. I want to get this question out there, with hope that a very experienced game developer will supply me with a sollution. What I want to do is, pack all the game assets in 1 file which I can very easily read from and add to. I was thinking of using a ZIP archive for this, or ideally use a .PAK archive where I simply add all my assets and map files there. How can I do this? If you will suggest a framework/API please also tell me how to use it, I'm a total beginner with library linking and library building, I've never done it.
  5. You could have a small starting point for the particles, and have those coordinates in memory, after that you could generate a new sprite every 0.5 seconds or 1 second which rotates right or left randomly and maybe re-sizes itself on a random basis. Particles have random behavior so you will need to experiment with them, but if I'd want to do particles I'd create a class for them, write a couple of methods, apply some physical properties for them and implement them to a map editor. Another option is to use "Fake" particles which are sprites animated by hand for example a fire, a rocket blast, etc.
  6. How can I use PhysFS?

    [quote name='renega_666' timestamp='1348921585' post='4985022'] CMake is a cross platform build system. The link you gave is a link to a tutorial that explains how to use cmake to create a simple project. You do not need to know that to build a cmake project. I've never used PhysFS but I'm used to build cmake projects. Usually the build process is the following: 1. open a[b] shell[/b] an navigate to the root of the project. 2. there, create a build directory ([i][b]mkdir build[/b][/i]) and navigate to it ([i][b]cd build[/b][/i]) 3. configure the project: [b][i]cmake ..[/i][/b] (before the .. you may add config options to specify the compiler and other options) 3.build the project: [b]make[/b] (or nmake or mingw32-make depending on the compiler used) 4.install the project: [b][i]make install[/i][/b] [/quote] Thanks a lot for the reply, but as I said it's my first time, I'm a total beginner so I don't know how to open a shell or create a build directory, could you tell me how to open a shell? EDIT: after researching I found out what you meant by shell, You meant using the run feature. But the rest of the steps are still unknown to me
  7. Hi. While developing my game I figured I wanted to pack all my game resources in a .zip file or a .pak file so it looks a bit cleaner and organized, and I wanted to use PhysFS for that purpose. Well, truth is I'm a total beginner at this, I downloaded PhysFS, all I got was a bunch of headers and source files and I have to apparently build it to get a .lib or a .a file which I can link to in my code::Blocks project, but I am CLUELESS as to how to do that. I've never even used cmake or anything similar, can anyone guide me step-by-step as to building PhysFS for using it in my project? Please, I've been looking for an answer everwhere, all I got was [url="http://www.cmake.org/cmake/help/examples.html"]this link[/url] which is not even slightly helpful [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]
  8. [quote name='kd7tck' timestamp='1346923526' post='4977128'] specifical? ALLEGRO_EVENT_KEY_UP [/quote] Oh how didn't I see that. Thanks!
  9. Hello, I tried to make my first space invaders clone, I have this code, which basically so far is supposed to handle ship movement: [source lang="cpp"]#include <allegro5/allegro.h> #include <allegro5/allegro_image.h> #include <allegro5/allegro_primitives.h> #include <allegro5/allegro_font.h> #include <allegro5/allegro_ttf.h> #include "Entity.h" // GLOBALS ========================================== const int width = 500; const int height = 500; const int imgsize = 3; bool key[5] = {false, false, false, false, false}; bool running = true; bool draw = true; // FUNCTIONS ======================================== void initSpaceship(Spaceship &ship); void moveSpaceshipRight(Spaceship &ship); void moveSpaceshipLeft(Spaceship &ship); void initInvader(Invader &invader); void moveInvaderRight(Invader &invader); void moveInvaderLeft(Invader &invader); void initBullet(Bullet &bullet); void fireBullet(); void doCollision(); void updateInvaders(); void drawText(); enum key_t { UP, DOWN, LEFT, RIGHT, SPACE }; enum source_t { INVADER, DEFENDER }; int main(void) { if(!al_init()) { return -1; } Spaceship ship; Invader invader; Bullet bullet; al_init_image_addon(); al_install_keyboard(); al_init_font_addon(); al_init_ttf_addon(); ALLEGRO_DISPLAY *display = al_create_display(width, height); ALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue(); ALLEGRO_TIMER *timer = al_create_timer(1.0 / 60); ALLEGRO_BITMAP *images[imgsize]; ALLEGRO_FONT *font1 = al_load_font("arial.ttf", 20, 0); al_register_event_source(event_queue, al_get_keyboard_event_source()); al_register_event_source(event_queue, al_get_display_event_source(display)); al_register_event_source(event_queue, al_get_timer_event_source(timer)); images[0] = al_load_bitmap("defender.bmp"); images[1] = al_load_bitmap("invader.bmp"); images[2] = al_load_bitmap("explosion.bmp"); al_convert_mask_to_alpha(images[0], al_map_rgb(0, 0, 0)); al_convert_mask_to_alpha(images[1], al_map_rgb(0, 0, 0)); al_convert_mask_to_alpha(images[2], al_map_rgb(0, 0, 0)); initSpaceship(ship); initBullet(bullet); initInvader(invader); al_start_timer(timer); while(running) { ALLEGRO_EVENT ev; al_wait_for_event(event_queue, &ev); if(ev.type == ALLEGRO_EVENT_TIMER) { draw = true; if(key[RIGHT] == true) moveSpaceshipRight(ship); if(key[LEFT] == true) moveSpaceshipLeft(ship); } else if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) running = false; else if(ev.type == ALLEGRO_EVENT_KEY_DOWN) { switch(ev.keyboard.keycode) { case ALLEGRO_KEY_ESCAPE: running = false; break; case ALLEGRO_KEY_LEFT: key[LEFT] = true; break; case ALLEGRO_KEY_RIGHT: key[RIGHT] = true; break; case ALLEGRO_KEY_SPACE: key[SPACE] = true; break; } } else if(ev.type == ALLEGRO_KEY_UP) { switch(ev.keyboard.keycode) { case ALLEGRO_KEY_LEFT: key[LEFT] = false; break; case ALLEGRO_KEY_RIGHT: key[RIGHT] = false; break; case ALLEGRO_KEY_SPACE: key[SPACE] = false; break; } } if(draw && al_is_event_queue_empty(event_queue)) { draw = false; al_draw_bitmap(images[0], ship.pos_x, ship.pos_y, 0); al_flip_display(); al_clear_to_color(al_map_rgb(0, 0, 0)); } } al_destroy_font(font1); al_destroy_event_queue(event_queue); al_destroy_timer(timer); for(int i = 0; i < imgsize; i++) al_destroy_bitmap(images[i]); al_destroy_display(display); } // FUNCTION LOGIC ====================================== void initSpaceship(Spaceship &ship) { ship.lives = 3; ship.speed = 2; ship.pos_x = width / 2; ship.pos_y = height - 20; } void initInvader(Invader &invader) { invader.health = 100; invader.count = 40; invader.speed = 0.5; invader.pos_x = 300; invader.pos_y = 300; } void initBullet(Bullet &bullet) { bullet.speed = 10; } void moveSpaceshipRight(Spaceship &ship) { ship.pos_x += ship.speed; if(ship.pos_x >= width) ship.pos_x = width-30; } void moveSpaceshipLeft(Spaceship &ship) { ship.pos_x -= ship.speed; if(ship.pos_x <= 0) ship.pos_x = 0+30; }[/source] It works mostly good except the ship continues to move even if the left/right keys are up. If I press the opposite key of the direction he is moving the ship stops and no matter what I do it won't move. This is some very very very weird behavior, when a key is down it checks for that key, it says it's down, then it's only supposed to move the ship IF the key is down, but I also specified in the code that when a key is up moving should stop. This game is damaging my brain, why does it do that when my code is extremely specifical?
  10. OpenGL My first C++ game

    [quote name='Rectangle' timestamp='1345995540' post='4973491'] If you are exclusively targetting Windows, I'd actually start out by learning DirectX 9. OpenGL is cross-platform and pretty standard for most OS's and devices, but even with the utility libraries it has a lot of manual labor and gets quite intricate early on for a beginner. Many concepts between them are quite similar, and I do recommend eventually learning both, but DirectX is a better starting point IMO and AFAIK is the only way that you can port your games onto the Xbox360 platform (via the XNA Framework). [b][i]However[/i][/b], if you haven't familiarized yourself with the basic Win32 API concepts of window creation and GDI graphics, then yes I would definitely recommend starting with OpenGL + utility libs. Alternatively, there are 3rd-party libraries such as SDL which are both cross-platform and fairly high-level, making everything easier, so there's something to think about as well. Google is your friend. Type in the name of the framework you wish to use + "tutorial" or "example" and you will have nearly everything you will ever need right there. Matrices are a mathematical structure primarily used in 3D graphics programming, and are a college-level concept derived from linear algebra. For graphics, they aid in the position, scale, rotation and translation of an object in 3D world-space. Before getting involved in them, I would definitely recommend sticking to a 2D environment where simple high-school algebra and trigonometry come into play using 2-dimensional Vectors. To learn the syntax, just keep checking the API reference docs, samples/demos, and online tutorials. Bookmark the ones you are learning along the way if you need to. As stated by the previous poster, the same applies for any API you are learning. For Win32 API stuff, check the MSDN. As suggested above, a good place to start is a simple game of Tic-Tac-Toe or Minesweeper, or a card game like Solitaire. Once you've done that, I'd move on to something that uses 2D sprites, such as Pong, Asteroids or Tetris, and then move up to Tile-based games such as Mario, Zelda or virtually any 2D side-scroller or top-down RPG. By then, you should be prepared to implement 3D effects in a 2D environment (using 3D vectors), and perhaps you could even try a 2.5D isometric game like Starcraft or Diablo. Then, it's finally time to move forward into a fully 3D environment. A good place to start there would be a 3D space-shooter. It's a long path but if you stick with it and don't skip any steps, you won't regret it later on. Personally, I've had to go back and forth over the years, learning everything out of order, and it's complicated my 3D programming skills to say the least. Good luck! [/quote] This is extremely useful and I appreciate everyone's repplies, especially this one. I thank you kindly for your advice and I'll make sure to follow it! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  11. Hi. Before I address my questions I'd like to give a small background of my experience. I'm 16 years old, I began programming a year ago and I've been studying C++ every day since then. I have not written anything big, except a tic tac toe game in ASCII which is probably my biggest achievement. I know I'm not so experienced with the language after a year, but I feel like I can move on from console programs into something better, so I thought "Why not make a game?" so I've been documenting what it involves, and what I need. I figured I need to learn OpenGL but after trying it I just couldn't understand what matrixes are and how it works overall (I do know the language features however) So I'm going to address a few questions which I hope to get some answers for, in order to make my first game. [b]1. What framework should I learn to make my first game? 2. Where can I find an easy to follow tutorial? (This includes videos, articles, etc) 3. How can I learn the syntax? When I tried learning OpenGL I found myself forgetting the syntax very easily, even after re-writing it several times, I just kept forgetting it.[/b] [b]4. Is it best to start with a 2D game rather than a complex 3D game?[/b] Thanks in advance for all the replies, and I'm not going to give up the idea of making a game, but I hope some experienced game makers/programmers can get me on the right path.