Grass
Loosely inspired by the fur demo, I wrote a grass program in a couple hours yesterday. It runs in OS 9 and is at http://david.emuscene.com/Grass.sit
A screenshot at extremely high detail settings is at http://david.emuscene.com/Newgrass.jpg
A screenshot at extremely high detail settings is at http://david.emuscene.com/Newgrass.jpg
Screenshot looks cool!
Any change of the source or a Mac OS X native version?
Any change of the source or a Mac OS X native version?
Do you know of any sample code for loading files in carbon? That's the one main thing I'm doing in classic that I'm not sure how to do in carbon. Then I can port all my stuff (black shades, glfighters) etc. to os x.
BTW a screenshot of grass at low (default) detail is at http://david.emuscene.com/Newgrasslowres.jpg
I only get 40 fps but if I put it all in a vertex array I think it would go faster
I only get 40 fps but if I put it all in a vertex array I think it would go faster
When you release the source to 'black shades' I reckon you'll have an osx version in about 20 minutes
Quote:Originally posted by David
Do you know of any sample code for loading files in carbon?...
which methods for loading files are you using under classic that don't work under carbon?
Well for example to open a saved game I would use:
short Files::OpenSavedGame(Str255 Name)
{
Point ptOrigin = { 0, 0 };
sSavedGameVolume = 0;
sprintf (szSavedGameName, "%s", Name);
SetVol( nil, sSavedGameVolume );
CtoPstr( szSavedGameName );
FSOpen( (Pstr) szSavedGameName, sSavedGameVolume,&sFile );
PtoCstr( (Pstr) szSavedGameName );
return( sFile );
}
Which seems to not work.
I guess I could try and use fopen and things like that instead.
short Files::OpenSavedGame(Str255 Name)
{
Point ptOrigin = { 0, 0 };
sSavedGameVolume = 0;
sprintf (szSavedGameName, "%s", Name);
SetVol( nil, sSavedGameVolume );
CtoPstr( szSavedGameName );
FSOpen( (Pstr) szSavedGameName, sSavedGameVolume,&sFile );
PtoCstr( (Pstr) szSavedGameName );
return( sFile );
}
Which seems to not work.
I guess I could try and use fopen and things like that instead.
Quote:Originally posted by David
I guess I could try and use fopen and things like that instead.
What about using the standard fstream.h stuff? I assume that OS X supports iostreams...
All you have to do is say:
ifstream input;
input.open("file name");
if(!input) cerr<<"File not found.";
// and then use:
char c = input.get();
// (it's exactly the same as using cin.get().)
Using stdio (or C++ streams -- ugh) is fine if you want a file in the same directory as your program. It doesn't work so well if you want a file in another directory, though...
Oh dear...
Those APIs were deprecated a long time ago. heheh. If you change the code to use FSSpecs it should work fine.
..and additionally, you would use APIs introduced after the eighties, which IMO can be beneficial these days.
Those APIs were deprecated a long time ago. heheh. If you change the code to use FSSpecs it should work fine.
..and additionally, you would use APIs introduced after the eighties, which IMO can be beneficial these days.
simply replace FSOpen(...) by
FSSpec fspec;
err = FSMakeFSSpec(sSavedGameVolume,sSavedGameFolder,szSavedGameName,&fspec);
and
err = FSpOpenDF(&fspec,fsRdWrPerm,&fref);
and it should work under carbon (though its still probably depricated)
FSSpec fspec;
err = FSMakeFSSpec(sSavedGameVolume,sSavedGameFolder,szSavedGameName,&fspec);
and
err = FSpOpenDF(&fspec,fsRdWrPerm,&fref);
and it should work under carbon (though its still probably depricated)
Great job David! Looks so nice. Like I was on some field getting ready for battle. Please remove your buildings, make them large trees, place this grass in Black Shades, and we would have a GREAT "Mercanary/Men-at-Arms" game. ie Same concept of Black Shades but you must escourt your lord/preist/tax man, etc from village to village, while taking out bandits and monsters. Daggers, bows, cross-bows. Anyone interested in working on a game based on Black Shades code like this, let me know, I'll chip in eye-candy and sounds and a design doc.
Cheers,
Cheers,
Carlos A. Camacho,
Founder
iDevGames
Thanks! I dont have trees yet but you can remove the blocks by replacing them with patches of grass or clearing 
I was actually going to do an oni/rune/jk2 (lightsaber) type game that takes place outdoors and has anthropomorph animal characters.
Or something. It would have more varied missions though, because constant bodyguarding can get tiring after a while.
But feel free to use black shades/grass code to do anything you want

I was actually going to do an oni/rune/jk2 (lightsaber) type game that takes place outdoors and has anthropomorph animal characters.
Or something. It would have more varied missions though, because constant bodyguarding can get tiring after a while.
But feel free to use black shades/grass code to do anything you want
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Normal Mapping Grass | Jake | 18 | 7,566 |
Apr 25, 2005 02:49 PM Last Post: Jake |
|

