FireNet 64 Posting Whiz in Training

Dont have any code atm .... But you could look to catch the window's minimize message and skip your render & update parts of your game. Then catch the restore message, reset/reload any resources you need (images, timmer, models ect).

... that's how I used to do it. I use OpenGL now .... really clean & simple code and no resource losses....

FireNet 64 Posting Whiz in Training

Well if you are going to use C++ and OGL/DX then there is going to be a bit of code to write. OpenGL would be easier as it's less confusing and has a cleaner api.


If you just want to show off molecules and not really interested in making a program ..... you could try Luxinia ..... which uses a scripting lanuage called lua to do everything...

as a user you do not need any compilers but purely work with the high-level language Lua to code your projects. The engines design goals were:

Check it out

FireNet 64 Posting Whiz in Training

Also it you are going to be a 3D artist show off high res models when ever you can. Also have a portfolio site or something which shows image previews first before linking to the full images. Looks a whole lot more professional.

It is also a good idea to show screen shots of games you have worked on too.

FireNet 64 Posting Whiz in Training

http://www.ea.com/official/moh/pacificassault/us/diary.jsp
http://www.gamesmodding.com/?game=42&type=2


The SDK
http://www.3dgamers.com/news/more/1096480363/

If you really want to mod a game try HL2.... there's a lot more info and tutorials available on the net for it

FireNet 64 Posting Whiz in Training

Code::Blocks would be good if you want an nice to look at interface.

But if you are planning to develop only win32 programs then I suggest you get Visual C++ 2005. That's a really good IDE and is very easy to use once you get the basics.

FireNet 64 Posting Whiz in Training

Found a simple solution: Just overload the darn << operator with a function template, like in the stl headers and then pipe it to ostream.

Works like a charm ;)

class UTIL_Console:public CONSOLE_TYPE, public ostringstream
{
public:
    template<class __input> inline
    CC_UTIL_Console& operator<<(
        const __input Val)
    {
        //Cast the current class to ostringstream to avoid a recursion
        *((ostringstream*)this)<<Val;
        
        DumpTextToExternalSource( str().c_str() );
        return *this;
    }

};

Man it's cool, and looking at the stl headers really helped. Use you debbugger to see what code get's executed and in what order. That's how I found the specific location in the jungle that is the standard template library.

--see ya around--

FireNet 64 Posting Whiz in Training

K,

It's fairly easy to use a ostringstream object or a derived class to output text like a normal stream class like cout.

Eg.

class console: public ostringstream
{
public:
  void Render()
  {
     std::string buff = ostringstream::str(); 
    //Some code to put it to screen

   //Write it to a file
  }
}


//Example of useage
console con;

con<<"Asasds"<<213;

This works as long as I keep calling Render().


Now if I want the text to be put into a file, I could ofcourse write buff but the output will have to wait till a render is performed.


I would like to have the text written as soon as the << operator is used. And I dont want to have to write a definition each and every data type :P.

What can be done to overload << so that an internal function can be called to write it to a file without having to wait till Render() is called.

FireNet 64 Posting Whiz in Training

Yes you can.

There are multiple ways to do that. The easiest way to use some 3d engine, but that will require you to know a few basic stuff, a bet beyound begginer level.

You could learn the Win32API and use DirectX for you gfx,sound,input but that involves more work.

If you are interested, have a look around http://www.gamedev.net

FireNet 64 Posting Whiz in Training

P.S if you only want a bing, then try

cout<<"\a";

FireNet 64 Posting Whiz in Training

Use the Package Dowload utility to get FMod.

Goto Tools->Check for Updates/Packages..

You can find a package for FMOD on one of the download sites. Look under the Audio category.


You can the goto File->New->Project
Choose the Multimedia and select the FMod sample project.

Look at the code, it's pretty simple. And you will be able to play various formats like MP3,WAV etc.

And there are tuts on the need, look on google ;)

Best of Luck


And very nice of you to use an opensource compiler, much better for you ;)

FireNet 64 Posting Whiz in Training

Game programming requires you to have nice base in whatever language you choose. Even if you dont know everything, if you know the basic concepts and a working knowlwdge of various APIs then things will be much easier for you.

If you are just beggining to program, you will soon be frustrated as you will not be able to understand loads of info you might find and the work you do wont be very effiicent and you may end up reinventing the wheel and unessearly doing code, which might have been done in a much better way if you knew the language properly.


If are going for C++, you should know the basic concepts like, functions, structs, classes, templates, STL. Operator overloading,dynamic mem management, then Win32 api, basics of using OpenGL or DX or SDL, OpenAL or FMOD.

Take my advice, learn C++ properly. If you have a book, finish it from start to finish. Do a few simple projects (in console) which involve concepts like file handling, link lists, vectors.This will give you a feeling of designing a program.

Then move on to using the Win32 API. You will have a few headaches to start with, but you should get along fine.

Then you are ready, helps if you have a little knowledge of STL, to start looking for game programming info.

Then you have just taken a step into a new dimension, where your way for thinking will change so …

FireNet 64 Posting Whiz in Training

Try using the std::vector template class.

std::vector<int> my_int_array;
 
//Add elements
my_int_array.push_back(10):
my_int_array.push_back(2):
 
//Display all the numbers
for(int i=0;i<my_int_array.size();i++)
{
   cout<<my_int_array[i];
}
 
//Deletion of position i :P
my_int_array.erase(&my_int_array[i-1],&my_int_array[i]);

If you can only use pure arrays, then you will have to learn about dynamic memory allocation to modify the size of the array at run-time.

Or were you just asking if you want to put a new value into an array of a fixed size?

FireNet 64 Posting Whiz in Training

hmm..

if the date is in the month of Jan or before/on Feb 29 it will not matter whether the year is leap or not.

Now we know that Jan,March,May,July,Aug,Oct,Dec has 31 days and the rest 30 days with the exception of Feb which can have 28 or 29 days.

On way is to generate a table with the days within a month. How you do this is not important, you can hard code it or use a for loop to generate it.

Hint: If you want to find out if a month has 30 or 31 days there's a simple method which is taught to children. They are asked to make a fist and are asked to say the names of the month, touching their knuckles (starting usually from the knuckle of the little finger) and the shallows between the knuckles. So it starts with Jan on the little finger knuckle, feb on the next shallow, March on the next knuckle etc etc. All the months which land on a knuckle have 31 days. When the last knuckle, i.e the index finger knuckle is reached, you go back to the first (i.e the little finger knuckle)

So anyways you make a table of months with the adjustment neccessary for feb. Then you add all the days of the months before the required date's month.Then you add the date to the sum you got. And you have the day of the year in which the …

FireNet 64 Posting Whiz in Training

Hi. I'm writing a pong game which loads and saves a playlist and a configuration file. Both files load properly, but the playlist wont save properly. I think the problem may have to do with the fact that it uses either Win32, openGL, or fmod, but im not sure which. When I write a console application, it runs fine. I use the visual c++ 6.0 standard edition compiler.

this works:

void SaveConfig()
{
ofstream fout("tpong.cfg"); fout << volume <<endl; //volume is an int
fout <<stream<<endl; //stream is a bool
fout <<maxPoints<<endl; //maxPoints is an int
}

this doesn't work:

void SavePlaylist()
{
ofstream fout("tpong.pl");
fout<<numSongs<<endl; //numSongs is an int
fout<<playlist.c_str()<<endl; //playlist is a string
}

both are called on after the other. Changing the order of calling them doesn't have any effect. After the program runs, and these functions are called, "tpong.cfg" is changed while "tpong.pl" isnt.

Any help would be much appreciated.

Have you tried deleting both the files and then running the program?

Or does your program open 'tpong.pl' elsewhere and does not close it?

Try checking with fout.good() to see if the file has been opened properly.

FireNet 64 Posting Whiz in Training

you should probably update your tutorial to use current c++ standards -- The information is very very old and many of it obsolete. This makes it pretty difficult for new c++ programmers to weed through the chaff to get to the good stuff.

I agree and it's true. It is based on pre standard C++ file streams. When I wrote it, only the cutting edge people really used STL and coded according to standard c++ methods. Geesh, I did not even know what a template was at that time.

Only recently that the support for STL and standard C++ has become mainstream and found it's way into schools and other educational institutes.


Amazing is it not, education always gives you the old stuff and when you step out into the real world, you find so many new things and much more advanced concepts in practical use. Never be stuck with what you get in school. The net is the best place to get to know what goes on in the real world.

And me, well I was inactive here for a long time. I've travelled a lot further, learnt so much that I never even knew existed ..... and got a new monster of a comp ;)


Write an update?
Good idea, I will see what I can do :)

http://xlock.fusionxhost.com

FireNet 64 Posting Whiz in Training

x = (float**) malloc(2 * n * sizeof(float*));

That's the problem I belive, why the 2? ,just put n like

x = (float**) malloc(n * sizeof(float*));

Then try.......

Also put in debug lines following each step,that way you can quickly find out where the problems are....


And this is really weird for (i = -n ; i <= n ; i++), I belive it's a mistake, it should be for (i = 0 ; i < n ; i++)

FireNet 64 Posting Whiz in Training

i also tried the the codes in dev c++ and it doesn't work. use another compiler.

I have not tried the code in DevC++, but there should be an option under traget settings to compile in large memory mode..........
1o0oBhP seems to know about it, I will ask him about it.

My advice, use DJGPP, and you can compile with no problems.And DJGPP is much better than using Borland too.DPMI (DOS Protected Mode Interface) sure has a lot of advantages one which making your life easier and the other protecting you from screwing up your comp ;)

FireNet 64 Posting Whiz in Training

Hey firenet
You had mentioned a way to delete a record from the file (using sequential access). I tried to do it with random access (i.e seekg and seekp). The program can't delete the last record. What do I do? :(

Hey post the code, I will be able to better pinpoint the problem :)

FireNet 64 Posting Whiz in Training

ok tnks for the help in the above section but i got another piece of a code here that i am wondering why it is not reading the whole line.

ofstream file;

	file.open("gamepc.txt");		//open a file
	cout<<"please insert the name of the game: "<<endl;
	cin>>name;
	file<<"name of the game: "<<name<<endl;   //write to it
	cout<<"please insert the game publisher: "<<endl;
	cin>>publisher;
	file<<"publisher: "<<publisher<<endl;
	cout<<"please insert the game developer: "<<endl;
	cin>>developer;
	file<<"developer: "<<developer<<endl;
	cout<<"please insert the game genre: "<<endl;
	cin>>genre;
	file<<"genre: "<<genre<<endl;
	cout<<"please insert the game release date: "<<endl;
	cin>>date;
file.close();

now my problem is that if the line that i put for the game variable is lets say world of warcraft so it doesn't go to the game varialbe but only the word "world" goes into it, and the words of and warcraft go into publisher and developer, respectivly. so my question is how do i make the whole sentence like "world of warcraft" go into one variable

Reading a whole line is quite simple.Just use:

file.getline(char_buffer,size);

and also:

file.getline(char_buffer,size,terminating_char);

By char buffer I mean any char array ;) and by teminating character I mean any character and the befault one is '\n' which stands for new line.

Helps?

FireNet 64 Posting Whiz in Training

i got a problem with the write to file function, what i want to do is write whatever is in the variable data into the file.

void write ()
{
fstream fin;
fin.open("files/titles.txt",ios::out|ios::app);
char* data;
cout<<"Enter the data you want to insert inside the file\n";
cin>>data;

fin.write(data,int);

fin.close();

}

There are a few problems with your code.The char *data, is just a pointer.You need to allocate some memory to it before you call cin or it will cause the program to crash.

Better yet just allocate the memory statically (normally) like char data[100].
the write function should be called as file_handle.write(data,size of data);

void write ()
{
fstream fin;
fin.open("files/titles.txt",ios::out|ios::app);
char data[100];
cout<<"Enter the data you want to insert inside the file\n";
cin>>data;

fin.write(data,100); //better instead of 100 you can use use strlen(data)

fin.close();

}
FireNet 64 Posting Whiz in Training

Are you including stdlib.h in your source? or you could try using the delay() function...

win16 version? what sort of comp are you using?

FireNet 64 Posting Whiz in Training

i no how u feel!!! i am self taught, learned by copying code from the help file in QBasic and lookin @ how it worked! having said that i am at a better standard in c++ vb and asm lang than other people i know doing A-levels in the specified subject so hold out as there are some good tuts out there. I have managed to create a few games and even worked as a software developer designing drivers and GUIs in vb just using tutorials and practising a LOT. good job too as part of my engineering masters degree is computer programming and they are using the same IDE as me (DevC++) :)

btw i forgot to say last time thank you to 'FireNet' for the fstream tutorial. Ive been looking for a good one for a while. is there any advantage into using the Win32 API (FILE) file handling? the win32 help is a bit patchy on the subject.....

You are welcome.

Advantages of Win32 API (FILE) file handling, are you kidding,it sucks.... well almost.One of the major problem with it is that it is platform dependent and uses C style functions.

Try this link,http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_file.2d.handling_tasks.asp

Using standard library functions are always better than using API stuff,unless you are doning something really specific, since std library code is cross-platform and will work on any OS which has the compiler.

this one was more intersting. keep it up. looking forward for the next part

FireNet 64 Posting Whiz in Training

Ok The Site is up,but I am still getting the content setup but still here is the link

http://xlock.fusionxhost.com/

FireNet 64 Posting Whiz in Training

You most welcome ;)

One becomes good at programming by doing and making mistakes.Failures are all stepping stones, and anyway making mistake once will help you to fix it faster if you make somthing similar again.

My next tut...... hmmmmm... I got to think about that, any suggestions ?

FireNet 64 Posting Whiz in Training

anastacia, best of luck, and if you really do what you say I can see you becoming a really good programmer.

FireNet 64 Posting Whiz in Training

DOS

If you use Borland then you will have to set the linked options to dos.

FireNet 64 Posting Whiz in Training

FireNet, your like the best at this, you knew i needed it. Im working on an FStream project, this helps alot!

You are most welcome ;)

I also have a new xlock (i.e my site) up.I will get the link out soon,Till then keep clicking http://xlock.ssr.be (right now it will not get you anything :( )

FireNet 64 Posting Whiz in Training

Sure thing.And you are most welcome ;)

FireNet 64 Posting Whiz in Training

http://www.polarhome.com:793/~xlock/zip/mirrorx.zip
http://www.polarhome.com:793/~xlock/zip/mirrorx01.zip


My mistake, there were too many 'r's.

If you mean if I have any public servers running, the answer is unfortunately no.But there are a couple running on my uni's lan network which are not accessable over the internet.

If your school has a network then you can use it there.It's not hard to set it up too.Just put a short-cut in the Start->Programs->Startup to make the mirrorx server start everytime the computer comes on.


P.S:Those links are to the old site's zip archive.The main site should be up in a week or so.

FireNet 64 Posting Whiz in Training

No way.You will go crazy if you process on char at a time.Just read a whole line into a char array and then encode it.I will give you a very simple encryption algorithm called XOR.

void XOR(char *message,char *pass)
{
    int p=0;
 
    for(int i=0;message[i]!=0;i++)
    {
           message[i] ^= pass[p++];
 
          if(pass[p]==0)p=0;
    }
}

ok I was having some fun.I will post some ideas as soon as I have thought them up.Man ,that question sure limits your scope.For me it's like trying to fit on a shoe 4 sizes too small(hope you understand).

FireNet 64 Posting Whiz in Training

Ok, but i have a question about one of your programs, its the chat one, do you have any servers for it?

Which one?If you mean MirrorX then the zip comes with a server and the client.

http://www.polarhome.com:793/~xlock/zip/mirrrorx.zip - older than the current version but has the client + server and a bot called bubble.It is used for testing the SMBS protocol.There are 2 clients, one which is dos (standard client) and the SMBS client.

http://www.polarhome.com:793/~xlock/zip/mirrrorx01.zip is the latest

FireNet 64 Posting Whiz in Training

Unfortunately the site is going to be down for sometime, it seems that the host is having some probelms with it's servers.I will be putting up a temp site soon (if I can)

Now officially the address to my site will be http://xlock.ssr.be which will get you to my site be it the temp one or the main one which ever one I will develop.I can also switch hosts and you can still get there with this address.

Xlock is comming again soon.............

FireNet 64 Posting Whiz in Training

Aight, Can you take all the parts and put them together in a file? Would be nice :)

All the parts in one file? Which format would you preffer, HTML or just plain Text?


Also on an apologetic note, my site is down at the moment and it may take a bit of time to get it up.If all things go well it should be up very soon.

N3wbi3C0d3r, thanks so much for the suggestion.

FireNet 64 Posting Whiz in Training
Graphics In Pixel
				     Part II B
			  'Realization of an Enigma'

Introduction
------------
Life's unfair, writing good tutorials take a lot of time, not typing it, but thinking up
the content does. Life's fun too, I had quite a good time learning new stuff. My hobby
at present is learning rasterization techniques. It's quite fun, but learning how the
things are done, is best done mathematically. The best part I love about algebra is the
way in which one proves something - make an assumption then derive something and
using the derivation prove the assumption was right.

Anyway rasterization is an approximation of reality. A raster is the medium used to
represent, in our case, the primitive (i.e. line, circle etc).This is usually, on computers,
a grid of square pixels.

Date:29/10/2004

Graphics Output
---------------
This series goes in for Mode13h (which is a very ancient mode) and DOS based. If you
can get this working then well and good. Incase you are unable then there is GCL which
stands for GDI Console Layer. It provides you a linear frame buffer just like mode13h but
uses windows gdi for output,=> win32 mode13h. You will be able to use the code given here
without any problem. Also If enough people ask for it, I will start providing GCL based code
too.

Razterization of a Circle
-----------------------
Razterization is a big …

alc6379 commented: excellent tutorial! +4
FireNet 64 Posting Whiz in Training

Did you check the C++ tutorial forum here?

Link:http://www.daniweb.com/tutorials/6811.html

FireNet 64 Posting Whiz in Training

Try http://www.google.com and search for writing compilers.You will find loads of solid info on that.Also search for Lexical Analisis.

FireNet 64 Posting Whiz in Training

Look in the tutorial forum at dani too ;) and google

FireNet 64 Posting Whiz in Training

Search the forum,I remmember typing out an entire function to get passwords while displaying *'s and supporting backspace too.

In a hurry gota go...

FireNet 64 Posting Whiz in Training

Quite easy.

The easiest one is from left to right and the principle is the same for the rest.Ok I am going to have some fun and provide you with the tools/code needed to produce the effects.You put them togather.


You will need to include conio.h for gotoxy(int x,int y) which will move the output location to x,y and they start from 1,1 not 0,0.getx() returns the current x loc and gety() .... guess.

The next is stdlib.h for delay(int time_in_milli_secs).

For the left to right animation you first output a char and call the delay.After that increase the x val by 1 (or your choice) and output.Loop these.


If you run into trouble post here,best of luck ;)

FireNet 64 Posting Whiz in Training
FireNet 64 Posting Whiz in Training

yea, also you can press Ctrl-End (which take you to the end of the page) and press enter (to make a blank line )

Simple

FireNet 64 Posting Whiz in Training

Yea you can use BGI with VC++, if you want you can get TurboC from http://www.borland.com

You could try Mode13h which is DOS based.
http://www.google.com

Also you can try GCL which is gui:
http://xlock.hostcubix.com/cgi-bin/lwton.cgi?page=prjGCL

Honestly if you are starting graphics , VC++ is not a good/easy compiler to use if you dont know GUI.

FireNet 64 Posting Whiz in Training
Graphics In Pixel
				     Part II A
			  'Now we are going to get it'

                              By Aaron (a.k.a FireNet)
                             [url]http://xlock.hostcubix.com[/url]

Introduction
-------------
The long awaited part 2 is finally almost here.This is mini section elaborates on
what Part I said.I broke up up Part II because it was getting too long.
Reasons, nothing much, I was very busy working on my site and developing video interfaces. A good thing too, I learnt and discovered a lot of things over a vast verity of graphics related subjects.You guys are going to benift from it in part 3.Here we will go over and above what we did last time.

Tutorial Source and Pics (Policy Stuff)
------------------------------------
Since it is against the policy of http://xlock.hostcubix.com to allow
linking of files and images directly I cannot place them on this page.To
get your source downloads/see pics/revised versions/etc for this series please visit:
http://xlock.hostcubix.com/cgi-bin/lwton.cgi?page=tutGRP

Other than that enjoy.

Language:C++
Compilers:Borland C++ 5.x, DJGPP 3.x
Date:2nd Spetember 2004
Site:http://xlock.hostcubix.com/

Setting the Mode with an understanding
---------------------------------------
Now let me explain what mode13h is all about.I did this last time so reffer that too.Every thing we see on a computer screen is made up of pixel, these are tiny dots, square ones (I think) and these are of diffrent colors, which give an image of all we see on the screen.Now if we could …

FireNet 64 Posting Whiz in Training

Check out the fstream tutorial which covers using structures to store info.It covers databases and a little more.

http://www.daniweb.com/techtalkforums/thread6542.html

FireNet 64 Posting Whiz in Training

Ask the user to do it ;)

Btw I have seen such funtionality only in carppy trojans and joke programs.

Try looking at http://www.google.com/

FireNet 64 Posting Whiz in Training

Yea, prevention is better than cure ;)

FireNet 64 Posting Whiz in Training

Simple, I will leave how to make a linked list to you, it's really simple.If you dont have any info on that look to http://www.google.com/.

int main(int args,char **argv)
{

}

This is what the main funtion should look like if you want to accept commandline parameters.Then getting hold of the parameters is as easy as pie (or a 2 dimentional char array ;))

The int variable args holds the number of parameters passed to your program
The char array hold the actual parameters

Look here to see how to display all the parameters

for(int i=0;i<args;i++)
{
     cout<<"Arg No ["<<(i+1)<<"] = "<<argv[i];
}

That will show you all the parameters passed via the commandline.Also the first parameter (i.e argv[0] ) is always the full path to your exe.

Helps?

FireNet 64 Posting Whiz in Training

Try doing a chat server.Or a graphics program.Or do some database management program.

Link
http://www.google.com - the best search engine

FireNet 64 Posting Whiz in Training

Yea,

http://www.google.com/ -is the best place to go

FireNet 64 Posting Whiz in Training

You don't HAVE to define NUM_TURNS as static. Defining it as static makes it common between all objects of that class. So if you have
GamePlayer a1;
GamePlayer a2;
then, a1.NUM_TURNS and a2.NUM_TURNS don't exist, but NUM_TURNS does.

True,and if NUM_TURNS were public you could access it by GamePlayer::NUM_TURNS