• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Charabis

Members
  • Content count

    48
  • Joined

  • Last visited

Community Reputation

123 Neutral

About Charabis

  • Rank
    Member

Personal Information

  • Location
    Washington
  1. Graduation is Friday, although it's still unknown who the program valedictorian is. Down to me and one other person, so just waiting to find out, and may be Friday before we do :P Now the big question is whether to stop or move somewhere to get my Masters :)
  2. I had noticed that. Part of why I was hoping for something simpler like just getting the SSL now instead of waiting. The code will just have to be changed to use it then, so why not do it right the first time? Unfortunately it's a matter of determining how C# gets its results and finding the matching Javascript version that's out there. Something tells me this is not a common problem
  3. Actually, it's Javascript, but that's a different matter entirely. I have the following C# code that simply takes a string and encodes it: [code] public string CalculateMD5Unicode(string input) { // step 1, calculate MD5 hash from input MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] inputBytes = System.Text.Encoding.Unicode.GetBytes(input); byte[] hash = md5.ComputeHash(inputBytes); return Convert.ToBase64String(hash); } [/code] Now I need to duplicate the output of this code in Javascript. So far, I've gotten it to where the same bytes are extracted: [code] function Process(str) { var ch; var bytes = []; for(var i = 0; i < str.length; i++) { ch = str.charCodeAt(i); bytes.push(ch & 0xFF, ch>>>8); } } [/code] But I've hit a bit of a snag in trying to get the MD5 values to match. Specifically, this will be called from an HTML form to generate the same data currently being generated in the compiled C# program. And yes, I know MD5 hashing is not terribly secure for doing passwords and what-not, but this is only going to be used until this gets closer to being released. Taking a lot of work to convince the guys in charge to buy an SSL certificate as they don't see it as being needed for testing. Isn't it fun to work for people who just don't know how to do...well anything [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]
  4. Okay, it turns out the problem wasn't in any of the code I posted. StartSending uses Unity's WWW object to communicate with the server. I was still using the version I was using to pass XML around (WWW.text), which is not advised for binary data. That's what "WWW.bytes" is for >.<
  5. Back to the problem early The size of the file is 4183 as reported by "filesize()" in PHP. Using Deprecated's suggestion of "print(readfile($data_location . "/" . $file));" returns a string to the C# script that's only 4040. Using my original method of "$arr[] = file_get_contents($data_location . "/" . $file);" and echoing element 0 (the one element in this test case), yields a string of size 4036. Can anyone explain why both of these are shorter than the number of bytes in the original file? I hadn't thought it would be so tricky to get a byte array into PHP and return it to the C# script that calls it, but that certainly seems to be the case. [b]Calling code and reporting result[/b] [CODE] WWWForm form = new WWWForm(); form.AddField("merchant", accountID); form.AddField("test", testMode); string result = sendData.StartSending(form, prepend + "get_images.php"); Debug.Log(result.Length); [/CODE] [b]PHP Code[/b] [CODE] <?php if(filter_has_var(INPUT_POST, "merchant") && filter_has_var(INPUT_POST, "test")) { $merchant = filter_input(INPUT_POST, "merchant", FILTER_SANITIZE_STRING); $test = filter_input(INPUT_POST, "test", FILTER_SANITIZE_STRING); } else { die ("DataMissing"); } $data_location = $_SERVER['DOCUMENT_ROOT'] . "/" . $merchant; $arr = array(); if (is_dir($data_location)) { $dir = opendir($data_location) or die("Couldn't access directory!"); while (($file = readdir($dir)) !== false) { if($file != "." && $file != "..") { //print(readfile($data_location . "/" . $file)); $arr[] = file_get_contents($data_location . "/" . $file); } } echo $arr[0]; closedir(); } else { // Need to create it mkdir($data_location, 0700) or die("Couldn't create " . $data_location); echo "Empty"; } ?> [/CODE]
  6. Ah. That's much shorter than trying to echo it, and gets the same results. Unfortunately, the results still don't seem to want to load as an image. Then too, there's the matter of returning it as an array of images regardless. At least this gets a good start on tomorrow. Thanks for the assist, Deprecated.
  7. Okay, seems there's a gotcha I wasn't aware of. I haven't confirmed 100% that the above works, but I was able to confirm that part of the code results in a bit of an oddity. [quote] while (($file = readdir($dir)) !== false) { $arr[] = file_get_contents($file); } [/quote] Detects 3 files even though only one is in the folder. The other two filenames it picks up are "." and "..". Wrapping the the line to load the file inside [quote] if($file != "." && $file != "..")[/quote] returns something that looks like it might be what I wanted. The size of the byte[] is about what I expected
  8. Excepting this has nothing to do with a browser I'm creating a PC/Mac standalone, not a web player application. Thus the need to figure out how to get a byte array to pass back to C# from PHP. It would be easy if "return" would actually work, but that doesn't seem to actually return anything to C#. Of course at the moment neither does the echo $arr
  9. I may not have said it quite the way I intended. let me clarify a bit more. I'm utilizing the Unity 3D game engine and need to get the PNG files into PHP and returned to C# as a byte array. The reason for needing this format is I intend to utilize "Texture2D.LoadImage()" to take the byte data and convert it into a Texture2D for display in the game. Sorry about the confusion
  10. I'm working on a project that requires an array of textures. I'm looking to get the assets through PHP to avoid allowing direct access to them, but am having trouble getting them to return in a meaningful way. This is what I've built so far on the PHP side: [CODE] <?php if(filter_has_var(INPUT_POST, "merchant") && filter_has_var(INPUT_POST, "test")) { $merchant = filter_input(INPUT_POST, "merchant", FILTER_SANITIZE_STRING); $test = filter_input(INPUT_POST, "test", FILTER_SANITIZE_STRING); } else { die ("DataMissing"); } $data_location = $_SERVER['DOCUMENT_ROOT'] . "/" . $merchant; $arr = array(); if (is_dir($data_location)) { $dir = opendir($data_location) or die("Couldn't access directory!"); while (($file = readdir($dir)) !== false) { $arr[] = file_get_contents($file); } echo $arr; } else { // Need to create it mkdir($data_location, 0700) or die("Couldn't create " . $data_location); echo "Empty"; } ?> [/CODE] Creating the directory works fine, however I'm not seeming to get what I'd expect back to the C# program which calls it. In fact, with nothing in the folder, I seem to get back the string "Array". Needless to say, that's not what I expect or want!
  11. Below are two snippets of code. The first works, but the second is claiming that "Object reference not set to an instance of an object." As near as I can tell, they're effectively identical, so why does the second one not work? They're written in Visual Basic 2005, and are part of my final project for Intro to Programming. Sad thing is I showed the teacher and he wasn't sure what I did in the first one! Dim picButton As System.Windows.Forms.PictureBox Dim lstButton As System.Windows.Forms.ListBox Do Until Placement > 26 If Placement < 9 Then picButton = Me.Controls("picSkill0" & (Placement + 1)) lstButton = Me.Controls("lstSkill0" & (Placement + 1)) Else picButton = Me.Controls("picSkill" & (Placement + 1)) lstButton = Me.Controls("lstSkill" & (Placement + 1)) End If LoadButtonInfo(0, Placement, picButton, lstButton) Placement += 1 Loop Dim BoxRef As System.Windows.Forms.NumericUpDown BoxRef = Me.Controls("numAccuracy") AttributeChange(0, BoxRef) Ideas? I'm at a total loss, and searching for hours on the web has yielded nothing relating to this except mention of using something like "Set Boxref =" etc. Problem is when I try to prefix that line with Set, Visual Basic discards it again.
  12. Cool! :) I'll give it a shot as soon as I can convince GIMP to behave itself. Darned Windoze anyway :p EDIT : Installed the newest version of GIMP and made it into a 1024x512, and it worked fine. Thanks, Enrico! Told'ja I was sure I'd done something stupid ;) ------------------------------------------------------ [Edited by - Charabis on March 18, 2007 3:38:24 PM]
  13. Would that cause them to render that way, or is that another problem I'll run into once I get around this one?
  14. Can't help you with #1, but for #2, just hop to this link on the site: Path to Game Development That should take you through several projects to get some skills practice in. -----------------------------------
  15. I was trying to load a PNG file to display on the screen. However, the following code just makes a largish, white block that doesn't even fill the screen. Both the image and the screen resolution are set to 640x480 resolution. Here's the code snippets: FROM INIT: // Initialize SDL if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) &lt; 0) { cout &lt;&lt; "Couldn't initialize SDL! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } atexit (SDL_Quit); // Have SDL clean itself up when the program exits // Set OpenGL attributes if (SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1) == -1) // Turn on double-buffering { // FAILED!! cout &lt;&lt; "Unable to turn on double buffer! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } /* MAY BE NEEDED FOR NON-MAC SYSTEMS if (SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 8)) == -1) // Turn on double-buffering { // FAILED!! cout &lt;&lt; "Unable to set red component's buffer size! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } if (SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1)) == -1) // Turn on double-buffering { // FAILED!! cout &lt;&lt; "Unable to set green component's buffer size! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } if (SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1)) == -1) // Turn on double-buffering { // FAILED!! cout &lt;&lt; "Unable to set blue component's buffer size! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } if (SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 1)) == -1) // Turn on double-buffering { // FAILED!! cout &lt;&lt; "Unable to set alpha component's buffer size! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } */ // Set up drawing context gp_screen = SDL_SetVideoMode (gi_width, gi_height, 32, SDL_OPENGL | SDL_FULLSCREEN); if (!gp_screen) { cout &lt;&lt; "Unable to set resolution to " &lt;&lt; gi_width &lt;&lt; "x" &lt;&lt; gi_height &lt;&lt; ": " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } SDL_WM_SetCaption ("Tringus", NULL); // Prep Open GL glClearColor (0.0, 0.0, 0.0, 0.0); // Set clear color to BLACK // Set OpenGL Projection Matrix glMatrixMode (GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, gi_width, gi_height, 0.0, -1.0, 1.0); // Initialize Modelview Matrix glMatrixMode (GL_MODELVIEW); glLoadIdentity(); // Ensure Viewport is set to the entire window glViewport (0, 0, gi_width, gi_height); if (glGetError() != GL_NO_ERROR) // Check for any errors { cout &lt;&lt; "Error setting up OpenGL! " &lt;&lt; glGetError() &lt;&lt; '\n'; return 0; } // Initialize SDL_Mixer if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 1, 4096) == -1) { cout &lt;&lt; "Unable to initialize SDL Mixer! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 0; } return 1; FROM MAIN : GLuint textures[2]; if (!initGame()) return 1; Resource files[] = { {1, "graphics/vbslogo.png"}, {1, "graphics/presents.png"}, {2, "sound/howl.wav"} }; if (checkResources (files, 3)) { cout &lt;&lt; "Please reinstall software to restore the missing resources.\n"; return 1; } // Load/check studio screen SDL_Surface* image = IMG_Load("graphics/vbslogo.png"); if (!image) { cout &lt;&lt; "Unable to load studio graphic! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 1; } glGenTextures (2, textures); glBindTexture (GL_TEXTURE_2D, textures[0]); glTexImage2D (GL_TEXTURE_2D, 0, 3, image-&gt;w, image-&gt;h, 0, GL_RGB, GL_UNSIGNED_BYTE, image-&gt;pixels); SDL_FreeSurface(image); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // STUDIO SCREEN READY TO GO!!! glBindTexture (GL_TEXTURE_2D, textures[1]); glTexImage2D (GL_TEXTURE_2D, 0, 3, image-&gt;w, image-&gt;h, 0, GL_RGB, GL_UNSIGNED_BYTE, image-&gt;pixels); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // PRESENTATION SCREEN READY TO GO!! // Load audio file Mix_Chunk* sound = Mix_LoadWAV("sound/howl.wav"); if (!sound) { cout &lt;&lt; "Unable to load sound effect! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 1; } Mix_AllocateChannels (1); // Only need 1 channel for now Mix_VolumeChunk (sound, MIX_MAX_VOLUME); // Set chunk to max volume if (Mix_PlayChannel(-1, sound, 0) == -1) { cout &lt;&lt; "Unable to play sound! " &lt;&lt; SDL_GetError() &lt;&lt; '\n'; return 1; } // Turn 2D-Texturing on glEnable (GL_TEXTURE_2D); // Turn 2-d texturing on glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the buffers (Screen to black) glBindTexture (GL_TEXTURE_2D, textures[0]); // Make Studio texture active glBegin (GL_QUADS); // START DRAWING!!! glTexCoord2i (0, 0); glVertex2i (0, 0); glTexCoord2i (1, 0); glVertex2i (gi_width, 0); glTexCoord2i (1, 1); glVertex2i (gi_width, gi_height); glTexCoord2i (0, 1); glVertex2i (0, gi_height); glEnd(); SDL_GL_SwapBuffers(); Now we can play "Find the stupid mistake I made." I'm sure I did something monumentally stupid to such a basic idea to make it not work, but darned if I can find it after 3 days of trying to! ----------------------------------------