|
hi all
i am making a game using C#. a lot of the game variables, i am storing in hash tables. lately whenever i am trying to run the program i am facing outofmemoryexception.
i was not facing this problem before; and has erupted suddenly.
can you suggest a better way to store game information?
please help
vineet
|
|
|
|
|
What kind of data and how much are you talking about?
|
|
|
|
|
I suggest to not use much variables because it become large proccess when u run it and slows ur PC as well..
_____________________
Proud to be Albanian
_____________________
|
|
|
|
|
Besure to dispose of all graphics objects .. eg. Brush / Graphics / Pen etc.
|
|
|
|
|
The key thing I hear is "Hash Tables", i.e. plural. Sounds lke you have a added so much data that you have basiscaly overfilled the sink.
The answer I am about to give may not be easy to deal with but it sounds like you are at the point of fix or scrap. Here is what I would do: First perform a full evaluation of the design to determine how much data really needs to store in a persistent manner, how much is ephemeral in nature, and finally what is the best way to store all this stuff? Remember a hash table is a fair amount of code that comes at the expense of memory. However in a game "speed" is the chief criterion. Thus finding a viable storage mechanism and keeping memory utlization reasonable should guide the solution.
For these reasons I would think about creating a more efficient storage strategy. This takes into account things like graphics, you only need one copy and after that you should only store the deltas. Sure this means GDI programming but your are writing a game afterall. Game design is almost always equated with system code, and in C# that equates to unmanaged code. If you create a memory storage strategy and implement memory allocatio via Marshalled OS calls and pointers, then you are on the right track. For sure, any game write should know exactly how much data needs to be stored, how much needs to be paged in from disk, etc.
Although C# is nice for lots of applications, I personally would use C++ for a game because of the closer fit to the OS. At the same time you can always write DLLs in C++ if you need the performance tweaks.
Good Luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
hi,
i am writing an smart client appl in C# . and once the changes are made in server it is downloaded to client.. what i wanted to know is that is it the entire application being downloaded or only the UPDATED PART. if so ,where can i find some relevent documentation which can proove the point.further , is it necessary to specify in the mainfest file abt the updates . if needed the how do i do it. i know something abt a function checkfor pending updates but am not very clear.
|
|
|
|
|
I (and aparently others too) really don't know what you are talking about.
Please provide more information and write more clearly...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi Dears !
I need a Text Editor dll contains MS Word ToolBars for use directly in my win forms
Thx for your attention
www.behzadi.net
|
|
|
|
|
Hello,
What exactly is your requirement? A rich text editor or Toolbars like MS Word?
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
I want a richText Editor which has a perfect Tool Bar like MS Word ToolBar.
I have a form for typing and saving mails , and need a powerfull text editor . I know some text editors like WordPad but these are OLE... !
www.behzadi.net
|
|
|
|
|
Hello,
You can have this [^]for a start.
HTH. Cheers
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
I have managed to change the colour of tabpages. I also managed to change the fonts of each tab to my own font. Now my application is in my user defined colour EXCEPT for the tabs for the tabcontrol, how do I change that?!
|
|
|
|
|
see http://www.dotnetrix.co.uk/tabcontrols.html
Regards
Hansjörg
|
|
|
|
|
Hi
i want to know that how to use tracing in windows Application , i know there is trace class available in system.diagnostics and the methods in the trace class are static e.g. Trace.Write etc as i have read on books ,but when i try to use it in the windows application it doesn't gives the write or write line method in the trace class ,i have added the nam space too ,plz reply with example s o i can understand and then implement it,plz reply as soon as possible ,thanks in advance.
Hard work is key to success
|
|
|
|
|
Can you show some code of how you are using it?
|
|
|
|
|
There are some excellent articles here on TraceListeners, I recommend starting there. You can create you own trace logging methods like this:
<br />
public class MyTrace <br />
{<br />
private readonly string tracePath;<br />
private StreamWriter writer;<br />
<br />
public MyTrace( string filename )<br />
{<br />
this.tracePath = filename;<br />
}<br />
<br />
public bool Open( )<br />
{<br />
try<br />
{<br />
writer = new StreamWriter( tracePath );<br />
return true;<br />
}<br />
catch<br />
{<br />
return false;<br />
}<br />
}<br />
public void Log( string format, params object[] args )<br />
{ <br />
if ( writer != null )<br />
{<br />
string msg = string.Format( format, args );<br />
writer.WriteLine( msg );
}<br />
else<br />
throw new Exception( "Trace File must be opened" );<br />
}<br />
public void Close( )<br />
{<br />
writer.Flush( );<br />
writer.Close( );<br />
writer = null;<br />
}<br />
}<br />
Good Luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
Hi there!
I try to serialize Unit struct into XML,
<code>XmlSerializer xs = new XmlSerializer(typeof (Unit));
MemoryStream s = new MemoryStream();
xs.Serialize(s, new Unit(100));
Console.WriteLine(Encoding.UTF8.GetString(s.ToArray()));</code>
Then I got following XML:
<code><?xml version="1.0"?>
<Unit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /></code>
There is no data in this XML.
Ummm, need helps, thanks.
-- modified at 23:50 Tuesday 14th March, 2006
|
|
|
|
|
The Xml serializer requires the fields to be public.
|
|
|
|
|
Hi, im using MCI to play wave files.
I need to control the balance of one of this but i havent been able to do it.
Ive tried the command string "set id audio left off" but i get an error message (the device isnt compatible with the specified command).
Any idea or api i could use?
Thanks
|
|
|
|
|
Hi!
You could use the mixer API to control the balance (and to find out whether a device/mixer line supports setting balance).
There are several articles here on this topic, for example this one.[^]
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
It s a great example, thanks, but I need to play a sound through the left speaker and another one through the right one, so that i was thinking about changing the balance of the sounds, not the balance of the whole soundcard output, because of it i was checking the mci.
Ive seen a dll which does it, so i guess it couldnt be very difficult.
|
|
|
|
|
Hello Everyone,
I am new to Programming and I need your help.
I am trying to copy the web application code from our production
server to my local machine, but I am getting the following error when i
do Copy Project from the Project Menu:
"The web does not appear to have the Frontpage server extensions
installed. If the Frontpage Server extensions are installed, this
error may occur because the _vti_bin virtual directory is not marked
executable.To correct this problem, run the Internet Services
Manager, select the Web server having the problem and use the Check Server
Extensions task"
I tried to research on Internet but was not able to find correct answer.
First of all how do I know if Frontpage extensions are installed or not.
If yes then, how do I get to INternet Service Manager. I am not seeing
it in my Administrative Tools. I do have IIS installed on my local machine.
I am able to create new web application but I am not able to do Copy Project.
I thank you for your help in advance.
Thanks
|
|
|
|
|
i have a form containing labels pictures and user controls
how can i print the form containing them just like it appears
through my search i found JUST "How to print a document"
-- modified at 7:28 Wednesday 15th March, 2006
|
|
|
|
|
How can I remove from IE toolbar buttons like:
Favourites
History
Media
I want to restrict user from visiting a new URL location from my browser controller stuff. I tried passing win32 message like TB_ENABLEBUTTON. Doesnt work!!
Please pass the trick if anybody here has some idea ..
Thanks
Sree
|
|
|
|
|
using System;
using System.Threading;
using System.IO;
namespace Threaded
{
public class me
{
public string texto;
public string path;
public string Path { get { return path; } set { path = value; } }
public string Texto { get { return texto; } set { texto = value; } }
public me() { }
public void copia()
{
Stream fix;
for (int i=0 ; i < texto.Length ; i++)
lock (this)
{
fix = new FileStream(path, FileMode.Create);
fix.WriteByte((byte) texto[i]);
fix.Close();
Monitor.Pulse(this);
if (i < texto.Length)
Monitor.Wait(this);
}
}
}
class teste
{
public static void Main()
{
string text;
me eu = new me();
me eu2 = new me();
text= Console.ReadLine();
eu.Path = "1.txt";
eu.Texto = text;
eu2.Path = "2.txt";
eu2.Texto = text;
Thread a = new Thread(new ThreadStart(eu.copia));
a.Start();
eu2.copia();
}
}
}
the objective of this program is to write a texto to 2 files using threads :S the problem is that it stucks after writing the first letter, i believe it's a synchronization bug, but i really can't see where the problem is... please help.
(i didn't know which part of the code that contains the bug so i posted all of it )
_________________________________________________________________________________
"There is no great genius without some touch of madness." - Seneca (5 BC - 65 AD)
|
|
|
|