Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

118 Neutral

About highowl

  • Rank
  1. Okay so I'm working on a 2-D platform game. I want to use the bounding box collision detection method, as it is quick and suits my game just fine. I'm just having a bit of difficulty with implementing it into my game. Right now I have it so 'detect_collisions()' is in the main game loop and checks for collisions on the 4 sides of the box and sets a boolean value to true if there's a collision and false if there's not. I then limit movement based on these variables. (ex. if theres a left side collision character.collided_left = true and the walk(left) function will not move the character left anymore. The problem with this is that when the character collides with something, depending on the way he's moving and how big or small the object is in comparison, it sometimes triggers multiple collisions and behaves incorrectly. I was thinking maybe it would be smarter to re-write my collision detection function to be something along the lines of this: enum DIRECTIONS { right, left, down, up, none }; ... bool detect_collisions(int direction) { switch(direction) { case left: //check for left-side collision and return true upon collision. break; case right: //same for right break; case up: //same for up break; case down: //same for down break; //hopefully never happens. default: return false; break; } } and then instead of having check_collisions() in the main game loop, put it in certain functions.... eg. the function that handles walking will run check_collisions(left) or check_collisions(right) based on which direction he's walking and not allow him to move if it returns true. Jumping would check_collisions(up) and gravity() would check_collisions(down)....etc. This way only one direction is getting checked and only if it needs to be. This would eliminate my problem of having multiple conflicting collisions detected simultaneously and would execute quicker...since it wouldn't have to run the entire collision checking code each cycle of the loop. Is this a good way of going about this? Or am I about to tackle this problem the wrong way and end up spending hours fixing it later? I've been trying to get this working right for a while but whenever I get one part of it working another part fails....this is my next idea but it involves a lot of change to the code so I figured I'd ask people with more experience before I go and change a bunch of code. Any input appreciated.
  2. I know I've read about that before but I decided to just do it simple. Pretty much the same concept though. The way I do it is if the left side of the character enters the right side of a solid object he is ejected to the right by the same distance that he moves and the opposite for the other side. Same goes for when the character is falling except when the character lands on a solid surface it sets his position to put his feet on the solid object......which I just realized is somewhat problematic and explains the bug where when my character hits a left or right collision he teleports to the top of it....DOH Maybe I should move the downward collision detection to be after the left/right collision detection. On the other hand I still have no f*cking clue why he floats right when he lands. Anyone have any idea? I think I'm done coding for right now....time to vent my frustrations in COD4...so on a side-note if anyone has a PS3 and a copy of COD4 lying around add me...PSN ID: HighOwl and we can kick some ass and chew bubblegum lol
  3. Okay here's the deal, I've been working on this 2-D platform game in my spare time for about the past month. I've just implemented 'gravity' and attempted to polish up the collision detection in the past day. I'm running primarily on caffeine and as I'm sure a lot of you know you lose quite a bit of your clarity of thought when you hit the 35 hour mark with no sleep. :P I'm sure this isn't a difficult problem I think I've just been staring at my own code for so long that I can't seem to find the problem. I've got a few theories about where the problem is but I just can't put it together in my sleep deprived brain. The exact issue is hard to describe as there's quite a few bugs I've noticed. 1) The if statement that checks to see if the left side of the main character has collided with a solid object seems to always evaluate to true when the character is standing on an object. (eg. Currently the character starts off well above the floor of the screen (I was testing gravity) and so he falls off the start until he hits the floor....as soon as he hits the floor my character starts sliding right). He's supposed to move right 5 pixels upon colliding with an object to his left (to push him out of the object). However, he just keeps going right until he hits another solid object....at which point he teleports to the top of the solid object....which is far from desirable. Left and right collision detection worked fine until I implemented gravity and top and bottom collision detection. Okay...it's going to be difficult to describe these...it'd be easier to just show you. Here's a link to the Windows executable: http://highowl.freetzi.com/rje/bin/rje_win.zip and it's source code: http://highowl.freetzi.com/rje/src/rje_src.zip I'm fairly sure the problem lies in 'game.cpp' in the function 'check_collisions()'. (This function is near the bottom [3rd from bottom I'm pretty sure]). If someone could take a look at it I'd be very grateful. I warn you though - I'm not very experienced in either C++ or programming games, so If you look at my code and you think "Why the f*ck did he do that this way" or "Wow, way to over-complicate things dipsh*t" the answer is going to be ignorance. I am very open to criticism and I fully welcome you to be as brutal as you'd like - Hell tell me I approached the entire game the wrong way or whatever you'd like, as long as you tell me why lol. This game is more or less a learning experience for me so anything I could've done better will only help future projects. NOTE: In 'game.cpp' in the function 'check_collisions()' under the section commented "LEFT" - comment out the line that says rastamon.pos_x = rastamon.pos_x + 5; to prevent the character from sliding right after he hits the ground. If it's not already commented out....if it is, uncomment it and re-compile and see what I'm talking about. Oh and one more thing, this program uses the allegro game library with jpgalleg and alfont - so you're going to need those libraries if you want to compile.
  4. I just noticed that all of the Gamasutra hosted post mortem links are somewhat broken. The links suggest they should send you to the actual article, but instead they send you to a page with a list of the most recent articles. Not sure if you guys are aware of this or not so I thought I'd point it out.
  5. I know this, I repair a lot of computers. I ran memtest for about an hour and 15 minutes before the tropical temperatures of my room combined with the heat from the CD drive spinning wildly caused it to over-heat and shut-off. I happened to actually be watching it when it over-heated so I can assure you that up to the 1h-15m mark there were 0 failed tests. Still haven't managed to get it to BSOD again, though development has slowed to a stand-still recently with holidays and the fact that the code for gravity / vertical collision detection was implemented and broke the jump function and I've been procrastinating working on it as this will require a complete re-write of the jump function. It is about time I get back to working on it though so hopefully it'll BSOD again and the mini/kernel-dump will be more helpful in getting to the bottom of this.
  6. Thanks guys for the quick and helpful responses, I'll look into it. This forum really is a great asset to programmers and aspiring game developers.
  7. Not sure if this is the right place to post this, if not, by all means move it to the appropriate place. My question are: 1.) Is it legal to include an instrumental cover of a song in my game? eg. Theres a beach level in my game. Would it be legal to have the background music be the steel drum instrumental of Bob Marley's song "Jammin'", providing that I myself played and recorded it. 2.) Is there any difference in legality if the original artist is dead or alive? 3.) If it's not legal, would it be legal if I changed the song slightly? (say by adding something original to it or slightly modifying each measure) 4.) If none of that is legal, how would I go about doing it anyway (legally)? (who would I have to get permissions from, what are the proper paths to take, etc.) I'm asking this question so as not to infringe upon any copyright or IP laws....not to get around them. I have no problem asking for permissions or giving credit where credit is due. Although I would like to avoid asking permissions if possible - by modifying the song slightly or whatever it takes...so any information on that would be appreciated. (Simply because I feel it would be difficult to get permissions from a dead man, whoever was in charge would probably not allow it for an indie game, and this would basically be just to add background ambient music until I have time to compose my own, not to mention I'm not selling this game; It's strictly going to be for my portfolio) This question is being asked simply because I'm extremely ignorant when it comes to copyright / IP laws. I have seen and read either a forum post or an article on GD about copyrights but I can't seem to find it right now. So don't go bashing me about trying to avoid the laws or get around them. That's not my purpose. I'm not even to the point of adding the sounds into the game yet, nor do I have anything specific picked out. This is strictly for future reference so I know what directions I can go in when I get to that point. I was thinking when I get to that point I would add some reggae tunes (my game takes place in Jamaica) for the earlier release and then after all the kinks are ironed out and the game is seemingly bug free I would work on composing completely original tracks for the game for the official release. But before that I'm going to want to release the game to certain people for testing and such and I don't want to hand out a game with no background music. In my opinion, the lack of any background music would take away from the game's experience. Basically, I'm looking for any answers you guys could give me, or any guidance in what laws I should research. Again, my goal is to avoid breaking the law, not to get around it. Just seeing what my options are so when I get to that point I know which directions I can go in. ANY help, ANY at all would be appreciated as I've been having difficulty finding anything seemingly relevant to this situation. Thanks
  8. highowl

    Never cut and paste important files!!

    I'm pretty sure cut/paste works like _Sauce_ said when cutting / pasting from separate disks. Eg. You have a computer with 2 HDD's, HDA and HDB. You cut a file from HDA and paste to HDB - but it actually copies rather than cutting and deletes the source when it's finished. I can remember a handful of times I've been moving large amounts of files from one HDD to another and when the disk fills up it throws up an error message and any file that didn't successfully copy still remained intact where it was. Then again maybe Windows handles things differently if it gets a "no more space left" error rather than a "hey I feel like being an ass and ruining your day by screwing up this simple task for no good reason" error. :P I'd go the data recovery route. Run a low-level disk recovery software to get it back....though if you've used the source disk (in this case the field recorder i believe) there's a chance you've overwritten the portion of the disk that contained the files you're looking for. I think UBCD (Ultimate Boot CD) has a program or 2 on it for recovering data, if not I'm sure some other multi-purpose boot CD has one. I can't think of any specific names at the moment, as I haven't had to do that in a long time. But I assure you there are plenty of free and easy programs out there that will do it.
  9. highowl

    Royalty Free Instrumental Notes?

    Well you could always go the MIDI route. Of course MIDI doesn't sound realistic. I would recommend the software 'Guitar Pro 5' though. It's a program mainly used for tabbing out stringed instruments, though it does have an on-screen keyboard (musical kind) and if you shell out the $60 (well worth it IMO) for the full version you get the RSE (Realistic Sound Engine) Which basically replaces the corny MIDI sounds that comes standard with Guitar Pro 5 demo and GP4 and below, with 'realistic' versions. The program also allows you to export to a variety of different formats such as WAV, MIDI, MP3 etc. So, if you were looking to get a certain note and have it sound real for your game....you could easily open GP5 w/RSE, tab that single note out on the fretboard (or use the keyboard tool if you're not familiar with where the notes are on the guitar) and export it to MP3. Anyway here's a link to the GP5 site. http://www.guitar-pro.com/en/index.php And heres a link to some details about the RSE complete with MIDI examples and their RSE versions. http://www.guitar-pro.com/en/index.php?pg=product-sound-examples Oh and by the way, the RSE covers keyboard/piano, guitar (electric and acoustic), and drums/percussion. I think it may cover a few other variations also like banjos and ukuleles but I'm not really sure. I generally use it for guitar, piano, and drum arrangements. Hope this helps. Edit: Oh yeah, and it's also allows you to choose things like clean or distorted guitar and all that. Plus it has the added benefit of allowing you to choose the note duration which a 'library of instrumental sounds' wouldn't. I mean...you could take a clip out of said library and cut it down to the proper length but then it's gonna sound half-assed, as the note wont strike, ring out, and fade away. Just my 2-cents. I know you were looking for something free. But this is somewhat cheap and if you play any instruments, like to work with MIDI, or just like composing in general its definitely a worthy buy.
  10. Yeah that's what I'm guessing it is, though I'm not sure why my game seems to be the only program that causes it to crash. Hopefully it will crash again so I can figure out exactly what's causing it.....Weird, I think that's the first time I ever hoped my computer would crash lol. Until then, I'm just gonna assume it's a faulty driver.
  11. Nah mon, the RAM is good, first thing I did after getting that BSOD was to boot up UBCD and run memtest. It passed which is why I've been saying since the beginning that I doubt it's a hardware issue. There are other causes for that BSOD error, other than dying RAM.
  12. @Promit - Not sure if my drivers are current or not. This laptop was shipped with Vista - which I hate with a passion. In my opinion it's a resource hog and has absolutely no noticeable improvements. So, I installed XP 64-bit, which I soon found out is about the shittiest OS when it comes to drivers. Just about all the hardware in this machine only has Vista drivers so I either had to manually install the drivers, or, for the stubborn drivers that didn't want to install that way, searched the net endlessly for drivers modded to work in XP 64-bit. @Kylotan - I'll start off by saying I don't have any code that I've written that is that low-level. I've been using the Allegro Game Library and that handles all of that stuff. Aside from having a really shitty function for displaying the mouse cursor, which I wrote my own work-around for, everything else works great. I've also searched for problems with Allegro that would cause a BSOD - but there don't seem to be any. As stated above, my drivers aren't exactly meant to be ran in XP 64-bit...atleast not most of them. Though everything else seems to be working correctly, I'm gonna assume that the drivers are the source of the problem until I have reason to think otherwise. I've left the game running on my 32-bit XP computer for about 4 or 5 hours the other day and when I came back it was still running and responsive. I left it running on this machine for over an hour and no BSOD. The only thing I've really changed was disabling the profiling option when compiling to get rid of an unnecessary gmon.out file from being created during execution. Unfortunately this BSOD seems completely random and since I can't reproduce it at will, and since it's decided to be completely cooperative since, I have no mini dumps or kernel dumps to check to find the source of the problem. Thanks everyone for your input and suggestions. :)
  13. highowl

    How to manage level data

    I've been working on a 2-D platformer. For levels I simply made a *.dat file that contains all the background images for each screen of the world. Directory structure is: . game.exe ./lvl/#/world.dat ./lvl/#/world.cfg Where '#' is the level number. world.dat, as I said earlier is a datafile containing just images. world.cfg is a text file that holds the data for each screen in the world. Example: world.w 5 world.h 1 [0][0][0].solid 0,0,20,600 [0][0][1].solid 500,300,600,800 [3][0][0].npc cop 400,500 [5][1][0].obj grapple 500,100 Then I just wrote some code to parse the file and perform actions based on it. the '[#][#][#]' portion of it corresponds to [X][Y][n] where X and Y are the x,y coordinates of the screen in the map, and 'n' is the number of the array the object is in. (The first two ".solid" lines make 2 solid objects on screen(0,0)) It's not the simplest approach, it's not the easiest, and most likely not the most efficient way of accomplishing this. But it does mean your limited only by your imagination and ability to parse text files. :P
  14. Well, I know how it responds in high-heat situations....it shuts down - no bluescreen just the mobo safeguards kicking in. Which is why I don't play games on this machine. I've already set it up to not automatically restart during a crash - as I'm hoping to catch the rest of the details next time. If i'm lucky....or unlucky enough to get it to crash again I'll post the mini dump....it would be awesome if someone else could read it though. If memory serves right you need the debugging symbols from MS to read the minidumps and they're around 200-300 megs....and I live in a town with possibly the worlds slowest "cable" internet. So if I can avoid downloading those for this one rare bluescreen incident it'd be great.
  15. I'm aware of this however I don't beleive it is a hardware fault. XP 64-bit drivers are sketchy but I assume anything to do with RAM or the virtual memory manager would work correctly. I've had my game running on my 32-bit XP SP3 system for about 15-20 minutes now and although it runs a hell of a lot slower since ive implemented the collision detection routine, it hasn't crashed. Both machines have 1 GB of RAM and the 32-bit machine is 1.6 GHz CPU slightly overclocked to 1.8 GHz and it seems to be running slow but stable. I guess my real question is. Is there anyway a memory leak or coding error could cause this?....as I'm no C/C++ expert (far from it) I assume not though as I don't use anything extremely low-level and I'd assume Windows XP would have some safeguards for things like that. or Since I'm coding on both 32 and 64-bit machines....is there anything special I have to do when coding for x86-64? Some special compiler options? etc. I'm fairly sure this isn't a hardware problem....as this computer is on constantly (i think it's been off twice this month due to power outages lol). I wouldn't be surprised if it were a driver problem tho as XP 64 is a bit half-assed in my opinion....Not to mention I don't think there are any official drivers for any of the hardware on here for anything before vista....hell I even had to make a custom XP-64 install discs to get it to detect the HDD during install. Not to mention the nightmare of getting all the drivers installed - which involved some workarounds for some and hacked versions of the drivers for others. But everything else seems to work right...just my game. Which is why I'm fairly sure it's either a coding error on my part, a problem with the compiler making 64-bit compatible programs, or a problem with Windows XP 64-bit. I'm leaning towards it being a problem located somewhere between my coding skills and the compiler not loving the 64-bit OS.
  • 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!