Guest Chuwaca Posted September 10, 2005 Report Posted September 10, 2005 (edited) copy the folder in the storage card it has only 3 units the warfactory and hundreds and hundreds of.............bugs :( there are enemies on the right 8) up down left right - move cursor action key - select (if keep pressed and move the cursor can select more) soft buttom 1 - move or attack 8 -special function (for the moment only the truck that put mines use it :cry: ) 0 - bar (only the warfactory) Firts of all i'm newbie to smartphone programming so i have a TONS of questions 1- how to access the current dir. For example...to play the sounds i use PlaySound(L"/Storage Card/RA/unitready.wav", NULL, SND_FILENAME | SND_ASYNC); I tried L"unitready.wav" but it play the standard sound. (also what does the "L" before the path do??????? i copy that from a tutorial and all i know is that it works :o) 2- I'm using STGapiBuffer. Is there any way to use compressed images like jpg instead of bmp??? 3-how to load the images from outside???? 4 ...........thats all i remember for nowra.rar Edited September 10, 2005 by Chuwaca
Guest Tech Posted September 10, 2005 Report Posted September 10, 2005 for the first Q (PlaySound) this is what you should really be doing: assuming your using C# // this goes at the beginning of the Class file public const UInt32 SND_ASYNC = 0x0001; public const UInt32 SND_MEMORY = 0x0004; public const UInt32 SND_PURGE = 0x0040; //So does this underneath ^ code [DllImport("CoreDll.dll", EntryPoint="PlaySound", SetLastError=true)] public static extern bool PlaySound(byte[] Sound, IntPtr hMod, UInt32 dwFlags); [DllImport("CoreDll.dll", EntryPoint="PlaySound", SetLastError=true)] public static extern bool PlaySound(byte[] Sound, UInt32 fuSound); then create a Stream and a FileStream then when you are about to call the method to play the sound: make the filestream set to the name/path of the file. make the sound stream == to the file stream get the byte[] of the file stream read the soundstream playsound: this.theFileStream = new FileStream(this.theFileNameOfSoundIncomingMsg, FileMode.Open); this.theSoundStream = this.theFileStream; byte[] byteStream = new byte[this.theFileStream.Length]; this.theSoundStream.Read(byteStream, 0 , (int)this.theFileStream.Length); PlaySound(byteStream, IntPtr.Zero, (int) SND_ASYNC | SND_MEMORY); this.theFileStream.Close(); this.theSoundStream.Close(); hope it helps lol in order to access the running directory you need to use reflection/runtime classes in .NET (again assuming your using .NET/C#) So: Assembly.GetExecutingAssembly().GetName().CodeBase.Substring(0, Assembly.GetExecutingAssembly().GetName().CodeBase.LastIndexOf(@"\")); gives you the path of the application's running directory (without the executable filename!)
Guest muff Posted September 10, 2005 Report Posted September 10, 2005 first off, well done for diving in there and getting coding :o [for those that may try it on other devices, this exe is for Smartphone 2003] 2. I'd strongly advise using the Hekkus library for your sound stuff (www.shlzero.com) 3. for image loading on current OS's look here (http://www.voscorp.com/products/developer/winmobile/voimage/) for image loading of jpg etc - this is different when you move to WM5 as they've changes the way that this dll works (or on some devices removed it completely) - but I dare say will do for now 4. http://www.pocketpcdn.com/ has some useful articles (and the fact you are currently using stgapi points to you knowng this site already) good luck with the coding, muff
Guest inlinesk8a Posted September 10, 2005 Report Posted September 10, 2005 is this a agem or homescreen?
Guest inlinesk8a Posted September 10, 2005 Report Posted September 10, 2005 do u have c&c red alert 2? if you do we can have a game :-) ill start a poll of and maybe we can have a ra torunemnet depending on how many people have it
Guest Chuwaca Posted September 10, 2005 Report Posted September 10, 2005 first off, well done for diving in there and getting coding :o [for those that may try it on other devices, this exe is for Smartphone 2003] 2. I'd strongly advise using the Hekkus library for your sound stuff (www.shlzero.com) 3. for image loading on current OS's look here (http://www.voscorp.com/products/developer/winmobile/voimage/) for image loading of jpg etc - this is different when you move to WM5 as they've changes the way that this dll works (or on some devices removed it completely) - but I dare say will do for now 4. http://www.pocketpcdn.com/ has some useful articles (and the fact you are currently using stgapi points to you knowng this site already) good luck with the coding, muff <{POST_SNAPBACK}> well you answered my fouth question before i posted it.....thanks :( now i can play multiple wave file at the same time.
Guest Chuwaca Posted September 10, 2005 Report Posted September 10, 2005 for the first Q (PlaySound) this is what you should really be doing: .... .... .... in order to access the running directory you need to use reflection/runtime classes in .NET (again assuming your using .NET/C#) So: Assembly.GetExecutingAssembly().GetName().CodeBase.Substring(0, Assembly.GetExecutingAssembly().GetName().CodeBase.LastIndexOf(@"\")); gives you the path of the application's running directory (without the executable filename!) <{POST_SNAPBACK}> I'm using visual c++. I think i will follow muff recomendation and use Hekkus library for the sound, but thank for answer anyway anyone knows an easy way to move a group of units??? now i'm using the A* algorytm(not sure if is the correct name), which works great when you move 1 unit but with more it can slow down the game.
Guest muff Posted September 10, 2005 Report Posted September 10, 2005 (edited) A* is a pretty hardcore algorithm for path finding of this sort of game I'd write something far simpler if I were you oh and for current path :- char *CurrentDir; void SetCurrentPath() { TCHAR szExecutable[200]; int szExecutableLen; //strip the filename down to it's bare roots GetModuleFileName(NULL, szExecutable, 200); for (int tmp = 0; tmp < 200; tmp++) { if (szExecutable[tmp] == 0) { while (szExecutable[tmp]!=92) { tmp--; } szExecutableLen = tmp + 1; break; } } //muff - win98se / XP #ifdef __PC__ CurrentDir = (char *) ""; #else CurrentDir = (char *) malloc(sizeof(char) * (szExecutableLen + 1)); wcstombs(CurrentDir, szExecutable, szExecutableLen); CurrentDir[szExecutableLen] = 0; #endif }[/code] Edited September 10, 2005 by muff
Guest muff Posted September 10, 2005 Report Posted September 10, 2005 I'd also caution you about using gfx from commercial games in something you are releasing whilst you are dev'ing something for yourself it's probably ok (as no one will really know), but I wouldn't be distributing commercial assets if I were you
Guest Chuwaca Posted September 10, 2005 Report Posted September 10, 2005 I'd also caution you about using gfx from commercial games in something you are releasing whilst you are dev'ing something for yourself it's probably ok (as no one will really know), but I wouldn't be distributing commercial assets if I were you <{POST_SNAPBACK}> yes i know. i only using it for the moment so that i can concentrate in the programming, but when i finish it, i will change it(with my patience probably never :o ) if you look at the previous version with my graphics you will probably laught :cry:RA.exe
Guest Chuwaca Posted September 10, 2005 Report Posted September 10, 2005 A* is a pretty hardcore algorithm for path finding of this sort of game I'd write something far simpler if I were you <{POST_SNAPBACK}> before the A* i used a function that moves units in a straight line and if it found an obstacle try turn clockwise or counterclockwise. i wil use that function first and then the A* but the problem of moving groups of units remains because they block each other and recalculate the path all the time.
Guest *747* Posted September 10, 2005 Report Posted September 10, 2005 I have a problem. After loading of the executable file and pressing the new game button - error message appearing. It says that program can`t find map. Game loading, but the area is black, and i can see only buildings and units. I think, that it is because on my phone memory card calls not storage card, but Mounthed volume, isn`t it?
Guest Chuwaca Posted September 10, 2005 Report Posted September 10, 2005 (edited) I have a problem. After loading of the executable file and pressing the new game button - error message appearing. It says that program can`t find map. Game loading, but the area is black, and i can see only buildings and units. I think, that it is because on my phone memory card calls not storage card, but Mounthed volume, isn`t it? <{POST_SNAPBACK}> try with this one but sounds won't workRA.exe Edited September 10, 2005 by Chuwaca
Guest muff Posted September 10, 2005 Report Posted September 10, 2005 before the A* i used a function that moves units in a straight line and if it found an obstacle try turn clockwise or counterclockwise. i wil use that function first and then the A* but the problem of moving groups of units remains because they block each other and recalculate the path all the time. there are lots of ways to approach this, so I guess it's down to personal approach
Guest Jamma14 Posted September 11, 2005 Report Posted September 11, 2005 (edited) Nice to see someone else interested in smartphone development. :o I'm afraid on the 550 as soon as you press new game with any of the exes it crashes (the media buttons are great for getting out of crashed programs - shows how htc are progressing - no more rebooting)! Any plans for a 550 version? :( Edited September 11, 2005 by Jamma14
Guest Chuwaca Posted September 12, 2005 Report Posted September 12, 2005 Nice to see someone else interested in smartphone development. :o I'm afraid on the 550 as soon as you press new game with any of the exes it crashes (the media buttons are great for getting out of crashed programs - shows how htc are progressing - no more rebooting)! Any plans for a 550 version? :( <{POST_SNAPBACK}> no idea why it doesn't work in your phone, maybe the gapi library is different since your phone has higher resolution :??: if you want i attach the code so you can see where the problem is
Guest muff Posted September 12, 2005 Report Posted September 12, 2005 the STGapi library has some pretty severe limitations - and that is one of them - it was written a long time ago after all the default gapi queries when run on the 550 report the screen as 176x220 - to run on hires devices properly you need to actually look for the hires support and that returns 240x320 see this article if you want to have a go at fixing STGapi yourself :- http://msdn.microsoft.com/library/default....i_awareness.asp as you are just starting out on the Smartphone I would strongly suggest that you concentrate on the devices you have access to and can test on or else get the Visual Studio 2005 beta so that u can test on it's built in emulators
Guest Coolbox Posted September 14, 2005 Report Posted September 14, 2005 This game is so cool...thank you for making it possible for us to play. It even runs very fast(almost to fast I think) so I dont think there will be any problem when more troops are added. I look forward to see more updates on this game:-) I have been waiting for some strategy games like this....finally!! P.S. It would be cool if you could ad some shortcut keys so that you can use the number keys to move the map instead of the joystick....but I know thats not so important now.
Guest Chuwaca Posted September 14, 2005 Report Posted September 14, 2005 Thanks...i wish i didn't have exams now.....but in two weeks i will free and start programming again :( regarding the keys any idea it's welcome :o that reminded me of other question The GetAsyncKeyState() function doesnt work if i don't put a Sleep() before that. anyone knows why????
Guest muff Posted September 15, 2005 Report Posted September 15, 2005 personally I put a Sleep(1) after each game frame this allows the OS and other apps to have a small time slice each game frame, which on a multitasking device is the right thing to do didn't know that GetAsyncState() got interfered with if u didn't tho :S
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now