Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

134 Neutral

About 44cll

  • Rank
  1. I'm working on a scrolling shooter and I'm having a hard time figuring out how to keep the bullet spacing the same whether the player is moving forward, backward, or not at all. Right now I'm just adding an int value to the bullet's x pos in its update call. What would I need to do to get the effect I'm looking for?
  2. 44cll

    Texture2D question

    This was what I was looking for, didn't think it would be so simple. Thanks for the help!
  3. So basically I'm trying to add textures defined in my Game.cs class to a list called scrollingTextures defined in a class called ScrollingBackground. I know this code doesn't work but it's basically what I'm trying to do. In ScrollingBackground.cs public void AddBackground(Texture2D texture) { Texture2D textureDefinedInGame.cs = new Texture2D(); scrollingTextures.Add(textureDefinedInGame.cs); } In Game.cs scrollingBackground.AddBackground(background); What would I need to do to go about this?
  4. Thanks! This approach makes much more since. I've never worked on anything like this before so I'll have to do some messing around with it. Would you happen to know how I would go about using pixel vs pixel comparison in c#? And would I have to use bitmap images? edit What if I used the Region class and the GetBounds method?
  5. I was trying to come up with a way to add collision to the scenery in my game without the use of a level editor. The best thing I could come up with is using an overlay image who's alpha value would be set to 0 and would contain pink pixels outlining the collision on the level - After which, I'd use pointF to draw the collision lines. I'm just not sure how I'd go about telling C# to detect the pink pixels and to put a point on them. Has anyone ever taken this approach? Is it even practical and or possible?
  6. Looks like the data variable doesn't contain any information because alutLoadMemoryFromFile is failing. I tried some other file types but still no luck.
  7. Hey, thanks for the reply. I have minimal programming experience so I get lost in the woods pretty often... After a quick google search to see what Breakpoints do, I added one in at the top of the LoadSound method and everything seems to be working fine until it hits the 3rd assertion. Also, the path variables contain the right sound file name. I'm just not sure where to go from here, but I'll keep tinkering with it tonight. edit Actually, I take that back. The assertion failed error pops up on the line after the 3rd assertion. Al.alBufferData(buffer, format, data, size, (int)frequency); edit Well, now I'm not entirely sure... It doesn't crap out while the 3rd assertion is highlighted, it's when I pass the breakpoint beyond that line. So does that mean the problem is in the next line or the line you're moving the breakpoint from?
  8. I've been trying to figure this out all day/night and I am completely at a loss. Every time I run the code below I get an "Assertion Failed" error. It seems like the problem is with the LoadSound method in the SoundManager class. I've checked the binary directory of my project folder I think 50 times now to make sure the sound files are actually in there as well as the alut.dll, ILU.dll and OpenAL32.dll files... These are all the classes in the engine related to sound as well as what's relevant in the form.cs file. Any sort of help or nudge in the right direction will be greatly appreciated Form1.cs [spoiler] namespace exByte_Test { public partial class Form1 : Form { SoundManager _soundManager = new SoundManager(); public Form1() { InitializeComponent(); InitializeSounds(); } private void InitializeSounds() { _soundManager.LoadSound("effect", "soundeffect1.wav"); _soundManager.LoadSound("effect2", "soundeffect2.wav"); } } } [/spoiler] SoundManager.cs [spoiler] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Tao.OpenAl; using System.IO; namespace exByte { public class SoundManager : IDisposable { struct SoundSource { public SoundSource(int bufferId, string filePath) { _bufferId = bufferId; _filePath = filePath; } public int _bufferId; string _filePath; } Dictionary<string, SoundSource> _soundIdentifier = new Dictionary<string, SoundSource>(); readonly int MaxSoundChannels = 256; List<int> _soundChannels = new List<int>(); float _masterVolume = 1.0f; public SoundManager() { Alut.alutInit(); DicoverSoundChannels(); } private void DicoverSoundChannels() { while (_soundChannels.Count < MaxSoundChannels) { int src; Al.alGenSources(1, out src); if (Al.alGetError() == Al.AL_NO_ERROR) { _soundChannels.Add(src); } else { break; // there's been an error - we've filled all the channels. } } } private bool IsChannelPlaying(int channel) { int value = 0; Al.alGetSourcei(channel, Al.AL_SOURCE_STATE, out value); return (value == Al.AL_PLAYING); } private int FindNextFreeChannel() { foreach (int slot in _soundChannels) { if (!IsChannelPlaying(slot)) { return slot; } } return -1; } public void LoadSound(string soundId, string path) { // Generate a buffer. int buffer = -1; Al.alGenBuffers(1, out buffer); int errorCode = Al.alGetError(); System.Diagnostics.Debug.Assert(errorCode == Al.AL_NO_ERROR); int format; float frequency; int size; System.Diagnostics.Debug.Assert(File.Exists(path), "File not found"); IntPtr data = Alut.alutLoadMemoryFromFile(path, out format, out size, out frequency); System.Diagnostics.Debug.Assert(data != IntPtr.Zero); // Load wav data into the generated buffer. Al.alBufferData(buffer, format, data, size, (int)frequency); // Every seems ok, add it to the library. _soundIdentifier.Add(soundId, new SoundSource(buffer, path)); } public Sound PlaySound(string soundId) { // Default play sound doesn't loop. return PlaySound(soundId, false); } public Sound PlaySound(string soundId, bool loop) { int channel = FindNextFreeChannel(); if (channel != -1) { Al.alSourceStop(channel); Al.alSourcei(channel, Al.AL_BUFFER, _soundIdentifier[soundId]._bufferId); Al.alSourcef(channel, Al.AL_PITCH, 1.0f); Al.alSourcef(channel, Al.AL_GAIN, 1.0f); if (loop) { Al.alSourcei(channel, Al.AL_LOOPING, 1); } else { Al.alSourcei(channel, Al.AL_LOOPING, 0); } // Al.alSourcef(channel, Al.AL_GAIN, _masterVolume); Al.alSourcePlay(channel); return new Sound(channel); } else { // Error sound return new Sound(-1); } } public void ChangeVolume(Sound sound, float value) { Al.alSourcef(sound.Channel, Al.AL_GAIN, _masterVolume * value); } public bool IsSoundPlaying(Sound sound) { return IsChannelPlaying(sound.Channel); } public void StopSound(Sound sound) { if (sound.Channel == -1) { return; } Al.alSourceStop(sound.Channel); } public void MasterVolume(float value) { _masterVolume = value; foreach (int channel in _soundChannels) { Al.alSourcef(channel, Al.AL_GAIN, value); } } #region IDisposable Members public void Dispose() { foreach (SoundSource soundSource in _soundIdentifier.Values) { SoundSource temp = soundSource; Al.alDeleteBuffers(1, ref temp._bufferId); } _soundIdentifier.Clear(); foreach (int slot in _soundChannels) { int target = _soundChannels[slot]; Al.alDeleteSources(1, ref target); } Alut.alutExit(); } #endregion } } [/spoiler] Sound.cs [spoiler] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Tao.OpenAl; namespace exByte { public class Sound { public int Channel { get; set; } public bool FailedToPlay { get { // minus is an error state. return (Channel == -1); } } public Sound(int channel) { Channel = channel; } } } SoundTestState.cs [/spoiler] SoundTestState.cs [spoiler] using System; using System.Collections.Generic; using System.Linq; using System.Text; using exByte; namespace exByte_Test { class SoundTestState : IGameObject { SoundManager _soundManager; double _count = 3; public SoundTestState(SoundManager soundManager) { _soundManager = soundManager; _soundManager.MasterVolume(0.1f); } public void Render() { // The sound test doesn't need to render anything. } public void Update(double elapsedTime) { _count -= elapsedTime; if (_count < 0) { _count = 3; _soundManager.PlaySound("effect"); _soundManager.PlaySound("effect2"); } } } } [/spoiler]
  9. 44cll

    Songs written by pro. musicians

    Yeah, actualy I've decided to just write something myself.
  10. 44cll

    Songs written by pro. musicians

    Thanks for all the help. I'll look into these suggestions.
  11. We're wanting to use a Sufjan Stevens song for the ending credits on a game that we're planning on selling. I'm sure we would, but I'm just woundering if we'd have to get permission from that artist... and how would you go about doing it? [Edited by - 44cll on October 1, 2007 4:13:31 PM]
  12. 44cll

    what do you use to make music?

    If you have experience in music theory use the program called Finale. It will let you write fully orchestrated pieces. Finale 2006 has just recently been released, but it is a bit pricey.
  13. 44cll

    Looking for a mentor.

    Quote:Original post by toXic1337 Um... this is clearly some sort of high school senior project or something. Having had to do one for my senior year, I found my mentor on the forums. Stop leading this guy around in circles, he knows what he needs for his project he hasn't asked for someone to write his game for him. He's merely looking for a mentor at this point so he can move on to the next stage of his project. These projects require documented meetings with a mentor and there is no "faking" it. What I did was to gain a mentor on the helpwanted forums and then exchange information such as name, email, and IM screen names. I got the mentor to send my teacher an email instead of a signature and she was more than understanding. @44cll: The Help Wanted section is where I found my mentor when I was going through this process. I would offer you my expertise but I don't really consider myself qualified outside of 2D Side-scroller / Top-Down type games. Feel free to pop many any questions you might come across though, and I'll do my best to answer. ~toXic Thank you toXic, c'mon guys it is just a school project. Take it easy. I'm not trying to pass a bill or anything. I just need someone to lend some tips and advice when needed. I guess I'll go to the help wanted section. Thank you to those who have been helpful.
  14. 44cll

    Looking for a mentor.

    I need my mentor to sign off that they were my mentor for the project. I only need 6 contacts with my mentor. So it wouln't be so time consuming for Him/Her. I just need to ask 6 questions and then recieve 6 answers at 6 different times. I am already experienced in 3d modeling I just need help putting them into a game. I am wanting to make an rpfps (role playing first person shooter) It's mech based and switches between 3rd and 1st person view. I am planning on running it on quake III. I'll expain more to whoever accepts. I know this isn't a very proffesional way to go about this, but I am desperate.
  15. 44cll

    Looking for a mentor.

    Thanks for the advise, but I need to have an actual mentor for a school project. I know I could get by on my own by doing things like what you suggested,tont, but they insist we have someone that we can have direct question and answer. I looked for someone around where I live, but failed. They said i could use email, so I went to the Internet.
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!