I am creating a game [C#], my first couple of versions worked perfectly fine on my many computers and my friends ...
Then I went and made it larger by added objects (more on the map) and loading more pictures when I draw, running more bots concurrently, etc - pretty much made it more massive and complex (newer version of the game)...
Great for me and all my computers (still works fine) but oddly enough my friend can no longer player it (I must admit his computer is far less powerful with much less ram)...
Still I would have expected the game to run "slower" on other PCs (mind you this is a real wimpy GDI+ game) but when he loads the game (doesn't even get to play for 1 second) in the phase where I generate my map by creating objects in each cell of the level it fails/crashes with the following error:
************** Exception Text **************
System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at BattleGrounds.BaseObject.get_ImgExtWall()
at BattleGrounds.BaseObject.GetObjectImage()
at BattleGrounds.BaseObject..ctor(ObjectType _objectType, Int32 xStart,
Int32 yStart)
at BattleGrounds.BaseLevel.GenerateLevel()
at BattleGrounds.frmBoard.frmBoard_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
As stated, a slow down would have been expected 'maybe" but an all out out-of-memory failure was unexpected - how am I supposed to manage such a situation?
I want him to be able to play (and all others) - it should be able to run on most PCs (again simple GDI+ game based on cells that load images)....
I am totally at a lost on how to deal with memory management issues, wouldn't even know where to start ... I ran it on my PC and there doesn't seem to be a noticable memory leak... and I am only loading more Objects...
Any ideas, hints, and help would be greatly appreciated, thanks
Then I went and made it larger by added objects (more on the map) and loading more pictures when I draw, running more bots concurrently, etc - pretty much made it more massive and complex (newer version of the game)...
Great for me and all my computers (still works fine) but oddly enough my friend can no longer player it (I must admit his computer is far less powerful with much less ram)...
Still I would have expected the game to run "slower" on other PCs (mind you this is a real wimpy GDI+ game) but when he loads the game (doesn't even get to play for 1 second) in the phase where I generate my map by creating objects in each cell of the level it fails/crashes with the following error:
************** Exception Text **************
System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at BattleGrounds.BaseObject.get_ImgExtWall()
at BattleGrounds.BaseObject.GetObjectImage()
at BattleGrounds.BaseObject..ctor(ObjectType _objectType, Int32 xStart,
Int32 yStart)
at BattleGrounds.BaseLevel.GenerateLevel()
at BattleGrounds.frmBoard.frmBoard_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
As stated, a slow down would have been expected 'maybe" but an all out out-of-memory failure was unexpected - how am I supposed to manage such a situation?
I want him to be able to play (and all others) - it should be able to run on most PCs (again simple GDI+ game based on cells that load images)....
I am totally at a lost on how to deal with memory management issues, wouldn't even know where to start ... I ran it on my PC and there doesn't seem to be a noticable memory leak... and I am only loading more Objects...
Any ideas, hints, and help would be greatly appreciated, thanks