Grass

Member
Posts: 164
Joined: 2002.04
Post: #1
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
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Screenshot looks cool!

Any change of the source or a Mac OS X native version?
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #3
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.
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #4
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
Quote this message in a reply
henryj
Unregistered
 
Post: #5
When you release the source to 'black shades' I reckon you'll have an osx version in about 20 minutesSmile
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #6
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?
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #7
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.
Quote this message in a reply
Michael
Unregistered
 
Post: #8
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().)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #9
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...
Quote this message in a reply
aleph0
Unregistered
 
Post: #10
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. Grin
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #11
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)
Quote this message in a reply
Founder
Posts: 1,138
Joined: 2002.04
Post: #12
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. Grin

Cheers,

Carlos A. Camacho,
Founder
iDevGames
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #13
Thanks! I dont have trees yet but you can remove the blocks by replacing them with patches of grass or clearing Smile

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 Smile
Quote this message in a reply
Quicksilver
Unregistered
 
Post: #14
Wow, looks nice. Probably better that UT 03's grass.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Normal Mapping Grass Jake 18 8,386 Apr 25, 2005 02:49 PM
Last Post: Jake