Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

173 Neutral

About Drakken255

  • Rank
  1. Many thanks, can I get an example in the shader? I can't seem to get it working. Also, translations are held in the bottom row of matrices, yes? Because I build each instance's translation matrix like so: float4x4 instanceTrans = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, trans[0], trans[1], trans[2], 1}; and when I multiply that with my rotations, things get weird. But if I don't, then the faces face up as expected.
  2. Thanks for the tip, but I decided to simply build and pass 6 rotation matices to the shader before even sending the instances, since a cube face can only have 6 rotations. So now it's just a matter of correctly reducing the size of my atlas index information. Should I be able to apply a similar technique since my atlas indices are unsigned shorts? Even if I have to pack 2 shorts into one 32 bit integer, and unpack them to 2 32 bit unsigned ints in the shader, that's fine. I just don't know what combination of options will allow me to correctly send 4 unsigned shorts.
  3. Let it be known that all I'm asking is how to write my shader and other relavent graphics code to send as little data per-instance as possible. I'll worry about reducing instances on my own.   That being said, I need to know how to send four (4) unsigned short integers to the GPU, considering HLSL has no 16 bit integer type.
  4. Firstly, if this ever becomes more than a learning exercise, it will definitely not be a Minecraft clone. It will instead likely be a 3D Pocket Tanks. I am already instancing individual faces, and my game detects whether a face is hidden by others. So it is only drawing what can be seen, except for faces behind others. I haven't quite figured out occlusion culling yet, but that is a secondary concern. The entire purpose of my post was to ask how to effectively reduce graphics transfer bandwidth on a per-instance basis first, and then reduce the number of instances. EDIT: I figured out how to reconstruct translation and rotation matrices, so all I need to pass per-instance is 3 floats for position, and 3 floats for rotation. Now, it's just a matter of whether or not a ushort will be properly converted to a regular int by the shader.
  5. Hello all, long time since my last post.   I worked on a voxel engine about a year ago in XNA using hardware instancing of each cube's faces. While making it, I made a post here asking for advice (link below) on how to improve the framerate, as my code was incredibly inefficient, from doing too much unneeded update logic to simply drawing too much. During said discussion it has improved vastly, but had to put the project down without implementing the number 1 most important piece of advice I took from that post: reducing the volume of data about each instance. Following is a quote explaining how much I was using and how much I could have been using.     My goal is to take the last byte count down even further. transform 3*4 -> 12 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes color 2*1 -> 2 bytes TOTAL: 20 bytes   As the quote shows, I was indeed passing an entire matrix, when only the translation info was needed. I solved this easily enough by simply passing a Vector3 and rebuilding the world matrix in the shader.   Next, I want to take the next three variables (coordinates for a texture atlas, (base, overlay, and breaking)), and reduce them further than 2*2 down to a single 16 bit unsigned integer, which should allow ~65,536 different atlas coordinates. Problem is: (1). I don't know how to turn an index into an x and a y int in HLSL code. I could do it in C# fine by just dividing the index by the number of pieces per row, storing the rounded down number as y, and subtracting the y * the number of pieces per row from the index to get x. (2). HLSL has no 16-bit integer. Is it possible to still send a 16 bit int, but convert to a 32 bit int once it's there? Or am I just missing unlisted integral types?   Lastly, for my color, I only want to send 2 bytes. The first will represent red, green, and blue, while the second will represent transparency. How do I convert 2 bytes into 2 floats when the time comes?   All in all, I just need help in converting different data types back and forth to allow for the least needed bandwidth when I send my instance information.   For those of you that would like to view the original discussion, click this link:       EDIT: I just realized that since I am instancing individual faces of each cube, I do also need rotation, so memory per instance will actually look like this: transform 12*4 -> 48 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes texcoord 1*2 -> 2 bytes color 2*1 -> 2 bytes TOTAL: 56 bytes   What I don't understand is why I need to send an additional 6 bytes for a 3 axis rotation, or where in the matrix that data is, so I now also need help getting this cut down a bit.
  6. Hello all, I am trying to port my program, PatchCraft to Linux and Mac, but Mono doesn't have a WebBrowser control for OSX. The browser control is essential, so I can't remove it, and I'm having massive trouble finding any other working and documented library out there. The control doesn't even have to be capable of much; my pages have no more than text, hyperlinks, and an external stylesheet. The problem lies in the fact that either each library isn't well documented, or it only works for one or two of the three platforms. Ideally, the library I need would build into a single DLL to be shipped with PatchCraft that will wrap runtimes developed for each respective OS. I've searched long and hard for a solution, but I am beginning to get very confused by it all and would very much appreciate a simple "step-by-step" guide on this. I must stress again that the library I need must work on Windows without Mono, and on both Linux and Mac WITH Mono, and not include 2 GB (exaggeration) worth of redists and natives that I myself must distribute. On a side note, GeckoFX has failed me by working fine on Windows alone, but producing this exception (produced by custom handler) under Windows Mono: An unhandled exception has occurred! Message: xpcom at (wrapper managed-to-native) Skybound.Gecko.Xpcom:NS_NewNativeLocalFile (Skybound.Gecko.nsACString,bool,object&) at Skybound.Gecko.Xpcom.Initialize (System.String binDirectory) [0x00000] in <filename unknown>:0 at PatchCraft.Program.Begin (System.String[] args) [0x00000] in <filename unknown>:0 Any ideas?
  7. Drakken255

    [XNA] Model Renders Black

    Lost contact with the user above. Thus, I still am looking for someone to do this.
  8. Hello all, I need to be able to zip and unzip files that are known to be named oddly, and my current method (SharpZipLib and a recursive zip/unzip wrapper) can't do it right. An example would be "aux.class" which is a reserved file name, so File won't write that. I've currently rigged a bit of a renaming system specifically for this file, but I dont like doing that sort of thing, it's just too messy and inefficient having to do special things for one file. Next, I've noticed that even though the files now unzip and rezip, there is a difference between the original and the rezip. Currently, both the manually unzipped and the programmatically unzipped folders have the same size, but there is a difference of over 90KB between the original and the rezipped files, when done so programmatically. Any difference in zips is highly unacceptable since it's actually a JAR archive I'm messing with. There is the possibility that I am missing something, so I'll give the benefit of the doubt and post my wrapper here: [spoiler] using System; using System.Collections; using System.IO; using ICSharpCode.SharpZipLib.Zip; namespace PatchCraft.Classes { public static class ZipUtils { public static void ZipFiles(string inputFolderPath, string outputPathAndFile, string password) { string[] moddedFileNames = null; bool fileNamesModded = false; if (File.Exists(inputFolderPath + @"\changedFiles.zud")) { moddedFileNames = File.ReadAllLines(inputFolderPath + @"\changedFiles.zud"); File.Delete(inputFolderPath + @"\changedFiles.zud"); fileNamesModded = true; } ArrayList ar = GenerateFileList(inputFolderPath); // generate file list //int TrimLength = (Directory.GetParent(inputFolderPath)).ToString().Length; int TrimLength = inputFolderPath.Length; // find number of chars to remove // from orginal file path //TrimLength += 1; //remove ‘\’ FileStream ostream; byte[] obuffer; string outPath = inputFolderPath + @"\" + outputPathAndFile; ZipOutputStream oZipStream = new ZipOutputStream(File.Create(outputPathAndFile)); // create zip stream if (password != null && password != String.Empty) oZipStream.Password = password; oZipStream.SetLevel(9); // maximum compression ZipEntry oZipEntry; foreach (string Fil in ar) // for each file, generate a zipentry { string realFile = Fil; oZipEntry = new ZipEntry(realFile.Remove(0, TrimLength)); oZipStream.PutNextEntry(oZipEntry); if (!Fil.EndsWith(@"/")) // if a file ends with ‘/’ its a directory { ostream = File.OpenRead(Fil); obuffer = new byte[ostream.Length]; ostream.Read(obuffer, 0, obuffer.Length); oZipStream.Write(obuffer, 0, obuffer.Length); ostream.Close(); ostream.Dispose(); } oZipEntry = null; } oZipStream.Finish(); oZipStream.Close(); oZipStream.Dispose(); ar = null; } private static ArrayList GenerateFileList(string Dir) { ArrayList files = new ArrayList(); bool Empty = true; foreach (string file in Directory.GetFiles(Dir)) // add each file in directory { files.Add(file); Empty = false; } if (Empty) { if (Directory.GetDirectories(Dir).Length == 0) // if directory is completely empty, add it { files.Add(Dir + @"/"); } } foreach (string dirs in Directory.GetDirectories(Dir)) // recursive { foreach (object obj in GenerateFileList(dirs)) { files.Add(obj); } } return files; // return file list } public static void UnZipFiles(string zipPathAndFile, string outputFolder, string password, bool deleteZipFile) { ZipInputStream s = new ZipInputStream(File.OpenRead(zipPathAndFile)); if (password != null && password != String.Empty) s.Password = password; ZipEntry theEntry; string tmpEntry = String.Empty; while ((theEntry = s.GetNextEntry()) != null) { string directoryName = outputFolder; string fileName = Path.GetFileName(theEntry.Name); // create directory if (directoryName != "") { Directory.CreateDirectory(directoryName); } if (fileName != String.Empty) { if (theEntry.Name.IndexOf(".ini") < 0) { string fullPath = ""; if (!theEntry.Name.Contains("aux")) { fullPath = directoryName + "\\" + theEntry.Name; } else { fullPath = directoryName + "\\_" + theEntry.Name; } fullPath = fullPath.Replace("\\ ", "\\"); string fullDirPath = Path.GetDirectoryName(fullPath); if (!Directory.Exists(fullDirPath)) Directory.CreateDirectory(fullDirPath); FileStream streamWriter = null; streamWriter = File.Create(fullPath); int size = 2048; byte[] data = new byte[2048]; while (true) { size = s.Read(data, 0, data.Length); if (size > 0) { streamWriter.Write(data, 0, size); } else { break; } } streamWriter.Close(); streamWriter.Dispose(); } } } s.Close(); s.Dispose(); theEntry = null; if (deleteZipFile) File.Delete(zipPathAndFile); } } } [/spoiler] If my code is correct, then I can't use SharpZipLib. I need something that can zip and unzip files accurately with no difference between the original and the rezip, no matter the file name, so I'm looking to use something else. Anyone have any ideas on what else to try? UPDATE: I have switched over to DotNetZip and it does FAR better. The JAR (being Minecraft) actually runs now! The problem now is still that aux.class file. Now, when loading a map, the game will crash with "Incompatible magic value 0 in class file aux" or "ClassDefNotFound for aux" which obviously means it is corrupted somehow, but I just don't know what's going on with it. I have narrowed it down to the fact that done manually, the file will use 313 KB zipped, but after programmatical modification, the file will be only 8. 7-Zip strangely enough shows that each has the same unzipped file size...
  9. Drakken255

    Logo feedback - Ninja Cat and Zombie Dinosaurs

    I think what Daaark is saying is a game logo is not going to be good with just a text layer. You need to manually DRAW the text to give it more style. Make a logo focusing solely on Ninja Cat, then it's safe to add "VS. Zombie Dinosaurs" as a subtitle. I suggest a cat in the background, also manually drawn. Maybe with a sword splitting a letter in half? It all boils down to originality. Give it your own touch. Don't use pre-made graphics, not even fonts. Not unless it fits perfectly, and you have the creator's permission.
  10. Drakken255

    Settings File and Compatibility

    So the following should work: int oldLength = settings.Length; if (settings.Length < numberOfBoxes) { Array.Resize(ref settings, numberOfBoxes); for (int i = oldLength; i < settings.Length; i++) { settings = "false"; } } And then each time settings change I just modify the constant numberOfBoxes? As it is I'm not yet comfortable with XML serialization. I currently use manual data storage with File.WriteAllLines(). I'm assuming it's a much better way to go in this situation? EDIT: I seem to have found a solution involving a Checked List Box. I didn't want to make a separate file out of it, but oh well. When saving, I save with: List<string> checkedItems = new List<string>(); foreach (object checkedBox in checkBoxList.CheckedItems) { checkedItems.Add(checkedBox.ToString()); } File.WriteAllLines(<FILE>, checkedItems.ToArray<string>()); And Load with: List<string> checkedItems = new List<string>(); checkedItems.AddRange(File.ReadAllLines(<FILE>)); for (int i = 0; i < checkBoxList.Items.Count; i++) { if (checkedItems.Contains(checkBoxList.Items.ToString()) { checkBoxList.SetItemChecked(i, true); } }
  11. Hello all, Bear in mind this is a bit difficult for me to explain. I currently have a set of check boxes in my settings form and I might add more in later updates. I want to save these to a file in the general format of: false true false etc etc... But what happens when an update adds a check box or two? I try to load the file's boolean values into them with: string [] array = File.ReadAllLines(<FILE>); checkboxOne.Checked = bool.Parse(array[0]) checkboxTwo.Checked = bool.Parse(array[1]) //etc etc... But when it gets to the new check boxes, for which there is no line in the file, it will throw an IndexOutOfBoundsException because the file has x minus number-of-boxes-added lines and thus so does the array. Example: 5 old boxes, 3 new. the file and array count 5, so when the program reaches index 5 (the sixth and nonexistent line), exception. Is there a better way to implement this to allow for a growing set of check boxes? Should I constantly check if the array length is less and resize as necessary?
  12. Drakken255

    [XNA] Model Renders Black

    Hello all, I am having a massive amount of trouble with a model and its texture showing up in XNA. I know it's not XNA because I am using a completely unmodified copy of the Skinned Model Sample to test it. Currently, it will render correctly in Blender, but will render black in XNA. I have already asked about this elsewhere in vain. Now out of frustration I am simply looking for someone to fix it for me. Credit will be given in my Minecraft tool called PatchCraft. The person that fixes it will be labeled in it as the sole creator of the model. Screenshot of my problem (in PatchCraft): [spoiler] [/spoiler] Contact me if you would like to give it a try.
  13. Thanks. Will try after work and edit with results. EDIT: Setting the pre-multiply alpha setting on either the model or the texture didn't work... Not even removing all transparency options in Blender works...
  14. Ok, how do I turn this off?
  15. Thanks for your reply. 1: I may be using custom code, but even using the Skinned Sample by MS with no changes other than the model and animation name strings, it stays black. 2: I am always sure to correctly export the model. 3: My texture is placed in the right spot and when it isn't, VS complains like it is supposed to. 4: Wait... Blender doesn't export my UV map? I did make my own... This sounds like a part of the problem, but I don't know... 5: Similar to 1. EDIT: My models did work ok with Blender 2.6, whereas now I am using 2.63a. Is this an issue?
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!