Jump to content
  • Advertisement

strychnine.213

Member
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

156 Neutral

About strychnine.213

  • Rank
    Member
  1. strychnine.213

    (C++ & D3D9) Sprites and Scrolling Map Problem

    Hello Vorel, thank you for the reply! Below I have attached code snippets for scrolling movements and player movement. I hope this is enough, but if not let me know and I can post some more. Thanks for the reply by the way, I appreicate it. Tile Scrolling void AppFramework::ScrollScreen() { //Update horizonal scolling. ScrollX += SpeedX; if(ScrollX < 0) { ScrollX = 0; SpeedX = 0; }//End if. else if(ScrollX > GAMEWORLD_WIDTH - WINDOW_WIDTH) { ScrollX = GAMEWORLD_WIDTH - WINDOW_WIDTH; SpeedX = 0; }//End else if. //Update vertical scrolling. ScrollY += SpeedY; if(ScrollY < 0) { ScrollY = 0; SpeedY = 0; }//End if. else if(ScrollY > GAMEWORLD_HEIGHT - WINDOW_HEIGHT) { ScrollY = GAMEWORLD_HEIGHT - WINDOW_HEIGHT; SpeedY = 0; }//End else if. //Set dimensions of the source image. RECT r1 = {ScrollX, ScrollY, ScrollX + WINDOW_WIDTH - 1, //We want to stop 1 tile before window border. ScrollY + WINDOW_HEIGHT - 1}; //Dest rect. RECT r2 = {0, 0, WINDOW_WIDTH - 1, WINDOW_HEIGHT - 1}; //Draw the current game world view. //d3ddev->StretchRect(gameworld, &r1, backbuffer, &r2, D3DTEXF_NONE); //if(FAILED(_Graphics.DemxStrechRect(gameworld, &r2, backbuffer, &r2, D3DTEXF_NONE))) //MessageBox(NULL, "I am broken!", "Erorr", MB_OK); _Graphics.DemxStrechRect(gameworld, &r1, _Graphics.backbuffer, &r2, D3DTEXF_NONE); } Sprite movement void CSprite::MoveSprites() { //Make sure d3ddevice is still valid. if(lpd3ddev == NULL) return; //Hold for short delay, and see //if we are ready for a new frame. if(GetTickCount() - spriteTimer >= 30) { //Reset timer. spriteTimer = GetTickCount(); //Move player sprite. // spritePlayer.x += spritePlayer.movex; //- spritePlayer.y += spritePlayer.movey; // if(localinput->KeyDown(DIK_UP)) // spritePlayer.y += spritePlayer.movey; // else if(localinput->KeyDown(DIK_DOWN)) // spritePlayer.y -= spritePlayer.movey; //@TODO: Convert this to input system, instead of using macros. //@NOTE: Screen coordinates work in reverse were the top left corner is 0, 0. if(KEY_DOWN(VK_NUMPAD8)) spritePlayer.y -= spritePlayer.movey; else if(KEY_DOWN(VK_NUMPAD2)) spritePlayer.y += spritePlayer.movey; else if(KEY_DOWN(VK_NUMPAD4)) spritePlayer.x -= spritePlayer.movex; else if(KEY_DOWN(VK_NUMPAD6)) spritePlayer.x += spritePlayer.movex; //Wrap the sprites at screen edges. if(spritePlayer.x > WINDOW_WIDTH - spritePlayer.width) spritePlayer.x = 0; if(spritePlayer.x < 0) spritePlayer.x = WINDOW_WIDTH - spritePlayer.width; //Check if animation delay has reached threshold. if(++spritePlayer.animcount > spritePlayer.animdelay) { //Reset sprite animation count. spritePlayer.animcount = 0; //Animate the sprite. if(++spritePlayer.curframe > spritePlayer.lastframe) { spritePlayer.curframe = 1; }//End if. }//End if. }//End if. }
  2. strychnine.213

    Guidance requested!

    Arcand, I recommend downloading and taking a look at either Ogre3D or Irrlicht. Both of the rendering engines are open source, are written in C++, and use OpenGL, and or DirectX for rendering. I have worked extensively with Ogre3D, and highly recommend it (if you decided to use Ogre3D make sure that you download the source release instead of the SDK). ~ Strych. EDIT: I forgot to answer your second question. There are many great engines for RPG's, but alot of them cost money, and those that don't only give you headers and compiled libraries. My advice, again, is download a rendering engine like Ogre3D, learn how to implement stuff like physics (Ogre3D uses a plugin system and has plugins for linking with with stuff like Nvidia PhysX -- with full source code), and build your own little engine. If you go this route you will have all of the source code for everything, and you can see indepth how this stuff works. If you have any more questions, or need some help pm me.
  3. Hey guys, I am working on a project, and have hit a snag. The project is a 2D based RPG, that uses sprites and a tile based scrolling map. I have the map set to scroll when you move the mouse, but moving the mouse also moves the the player sprite with it (the player sprite stays in the middle of the screen, and the map scrolls behind it). I was wondering if anyone knows a way to "detach" the sprite so that I can scroll the map, but leave the player sprite were it is (I am sorry if that does not make sense ) I am not sure what code to post, so if code is needed let me know, and I can get some. Also note: I love code examples, but it's really the logic behind it! ~ Nathan
  4. strychnine.213

    Writing a game engine

    I understand that you like to take some risks, as that is how most programmers learn, but I am going to tell you what everyone else has said; you can not do it. I do not mean to be rude, or discourage you in anyway, but building a game engine takes an unbelievable amount of development time to get anything usable. I recommend that you bite your pride and use the schools engine, as it is more than likely tried and true. It has more than likely been recoded and added to many times, and is probably stable. I'll be able to write an engine in a month[/quote] The first game engine I wrote took me 3 years of development, and this was while I was building the game that used it. At that point I had 6+ years of C++ and 3 years of Assembly based programming. As I said before; I am not trying to be rude, but you can not write one in a month. EDIT: If you are really mind set on building your own game engine, I can offer some advice. First off know what the engine has to do specifically. This requires that you build the engine with your game. Because of your time deadline, I would not recommend using anything fancy (by fancy I mean techniques such as Singleton patterns (which are great, but can cause hurt)). Only implement what is required for by the game. A quick glance at your design looks like it will work for a small project. math when my game is finished[/quote] Depending on what kind of game you are building, this is going to be needed first. I do not recommend writing your own math library with your time constraint. Use open-source, or pull from the DirectX libraries. A level editor is can be a massive undertaking and a huge drain on your resources[/quote] As someone else stated; do not even try it. Game engine tools are a massive undertaking, in part because they require a working game engine. I have heard of people using a modeling package such as Blender or 3DS MAX for level design. This is the route you should take. As far as your video problem goes, I am not sure what you are using, but I can take a stab based on the error message. It is saying that it can not find the decompresser. This usually means that your code is wrong, or something is missing such as a (.dll) file, or an extension that the code is trying to call.
  5. strychnine.213

    Your most memorable childhood game?

    Hands down; Baulder's Gate (and anything else from BlackIsle)!
  6. strychnine.213

    [DX11] Battlefield 3 GBuffer Question

    I remember asking my self the same questions when I looked through the whitepapers. My guess is this: I think that the smoothness buffers are used for buffering tessellation in DirectX11 and OpenGL. I am still not sure why you would need to buffer such, but they use a lot of it. I figured the Sky buffering was for the jets. I noticed ingame that the jets can fly outside the bounds of the set points on the map. My guess is that the sky buffers render sky and landscape past the set distance for the jets. I however might be wrong.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!