This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

OcularCash

ADG
  • Content count

    3,465
  • Joined

  • Last visited

  • Days Won

    91

OcularCash last won the day on June 20

OcularCash had the most liked content!

Community Reputation

871 Excellent

About OcularCash

  • Rank
    Team Member
  • Birthday 04/29/1985

Profile Information

  • Gender
    Not Telling
  • Location:
    Springfield Missouri USA
  • Interests
    Javascript, 3d Modeling, Foley Recording, Photography
  1. For the fps kit or using an fps kit... no. I don't know of any kits that use the fallout kind of system. There may be some out there but I'm not aware of them. Your only options are to put the man hours in and modify the code yourself or scour the internet and try to find one (if any)
  2. There is no possible way to change it with the current system. You will need to completely rewrite how ammunition works and how it is stored and there really is no quick way of doing that bc of the sheer amount of code that would need to be changed/rewritten. Would probably taken a couple days straight for oma himself to make those kind of changes let alone anyone else
  3. It's because the system the fps kit uses isn't ammo independent. For instance, each weapon has its own ammo count. They do not share from a pool of ammo. So if you have 40 types of guns but your holding a rocket and you pick up mags, it wouldn't know which weapon to give the ammo to, does that make sense? Unless all of your weapons share from a pool of ammo of that type, you cannot in any way make a good system that will pickup ammo and know exactly which weapon to give it to unless it goes directly to the weapon being held (which is exactly how it's written)
  4. I don't use it and haven't even looked at the code in a good year or two but I would assume it would be something like: weapons[ammoIndex].ammo += amount;
  5. As stated by Zhavier, forge Networking is now free and available on github here: https://github.com/BeardedManStudios/ForgeNetworkingRemastered/blob/master/README.md confirmation email directly from the developer attached
  6. Not really much going at the moment and I'm just hanging out for the next 30 minutes so I figured I'd go over editor optimization. Editor optimization can be important when developing custom editors such as tile map editor windows, long lists, etc... basically for anything the requires a scroll view. The reason is because GUI can eat up your memory like a Cookie Monster because your not only using memory for unitys editor itself, but your also consuming your own. one of the best ways to optimize this by using rect space culling. Rect space culling is the same thing as screen space culling but your defining a rectangle within the screen. So let's say your making a tilemap editor window and the map your making is 100x100 but your only seeing 10x10 (or 11x11 when scrolling). If your render the whole map at once, your rendering 10k images vs the 100 you should only be rendering. So how do fix this: well we we know two things. We know our rect size is 160x160 (assuming each image is 16x16) and we know how far we've scrolled because of the scroll view. Well hell, that's all the info we need. So we can smash each 16 unit into 1 unit by saying this: unitScroll.x = (int) (scrollview.x / 1600 * 16); the same goes for the y. That will give us the bottom left corner tile to be rendered in our array. So now in our looping we can say: for(int x = unitScroll.x; x < ...; x++) same for y. Now we are culling everything that shouldn't be rendered on the left and bottom (top if you don't have it flipped) of the rect. Now let's get the right and top (bottom if not flipped) culled. Since we know the size of the rect and where we started, we can calculate it the same way: max.x = (int) ((scrollview.x + rect.width) / 1600 * 16); and there you have it, you've successfully rect culled by doing the following loop: for(int x = unitScroll.x; x < max.x; x++) this will only allow 10x10 tiles to be rendered at once. But this also means it will look weird when scrolling through tiles because 11x11 will need to be rendered. So you can just fix that by saying x < max.x + 1 and the first thing you do is check if x >= 100, if it is, break. Same with y. this can be used for anything that is using a scrollview and jumps performance incredibly. Don't forget to flip the y tho. start rendering y at (1600 - 16) * y instead of at y itself (ongui starts from the top, not the bottom)
  7. I must've skipped this topic somehow. But to add what calum said, you can also add a refresh button and/or hotkey. The same basic rule of thumb applies when searching for servers as well to cut down on the amount of calls. I'm personally a big fan of hotkeys in anything really... guess it's just the lazy side of me wanting to come out
  8. Don't question why you develop. You develop for the enjoyment of developing, whether it's a learning project or something your pursuing. The only way to acquire the knowledge to create something from great from scratch is to tinker around with projects you personally enjoy. No one created smash hit for a first project, we tinkered around with things we like until we honed in on our skill set. I wouldn't mind watching your video if u had it up
  9. It's just an example of killstreaks in general. What your describing would take weeks if not months to do. I don't think anyone is going to spend that kind of time to make you something for free. Your best bet to just to do the research, look at examples of killstreaks and go from there. What your describing is multiple systems. Killstreak streak system, single killstreak, shop system, etc... it's not a 10 line piece of code. More 2000 lines of code spread out between multiple scripts
  10. Idk how or if this is still going to work in unity 5 but the closest thing your going to get to call of duty killstreak examples is this: i posted it on my bday over 5 years ago when I was still pretty new to unity so a lot things were pretty hard coded and sloppy written but it did the job
  11. Good, I'm glad it helped. It can bring a static player to life very quickly. The bad part is, besides this pack I made several years ago, there isn't (even to this day) really any other universal animations out there despite how many ppl could actually use them
  12. Since your using c#, you have to pass in a new vector and set one it's values: rb.angularVelocity = new Vector3(rb.angularVelocity.x, Input.GetAxis("Horizontal") * tf, rb.angularVelocity.z);
  13. looks good man. I guess I have short term memory loss bc I don't remember helping anyone with anyone with inventory lately, but either way, you did the heavy lifting so good work.
  14. So I'm going to post a text rendering method I'm using for LWJGL 3. Seems there really isn't any libraries supporting version 3, only version 2. So here is a rather robust but effective and quick implementation (rendering thousands of characters 'hundreds of full length strings' at over 50 fps on a old home computer). GUI.java package engine; import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; import static org.lwjgl.opengl.GL11.glBindTexture; import java.util.Map; import engine.Quad.Anchor; public class GUI { public static Color textColor = Color.white(); private static Font font = null; private static Shader shader; private static Quad quad; public static void Init() { quad = new Quad(Anchor.BottomLeft, true); shader = new Shader("GUIShader"); try { font = new Font("Roboto-Regular", 16); } catch (Exception e) { e.printStackTrace(); } } public static void Prepare() { glBindTexture(GL_TEXTURE_2D, font.GetFontTextureID()); shader.Bind(); shader.SetUniform("projection", Application.GetGUIProjection()); } public static void Label(String text, int x, int y) { Map<Character, Rect> chars = font.GetCharacters(); int xTmp = x; for(char c : text.toCharArray()) { Rect r = chars.get(c); shader.SetUniform("position", xTmp, y); shader.SetUniform("offset", r.x, r.y, r.width, r.height); shader.SetUniform("pixelScale", new Vector2(r.scale.x, r.scale.y)); shader.SetUniform("color", textColor.r, textColor.g, textColor.b, textColor.a); quad.Render(); xTmp += r.scale.x; } } } Font.java package engine; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import static org.lwjgl.opengl.GL11.*; public class Font { private int fontTextureId; private BufferedImage bufferedImage; private Vector2 imageSize; private java.awt.Font font; private FontMetrics fontMetrics; private Map<Character, Rect> chars = new HashMap<Character, Rect>(); private final Map<Integer,String> drawChars = new HashMap<Integer,String>() { private static final long serialVersionUID = 1L; { put(0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); put(1, "abcdefghijklmnopqrstuvwxyz"); put(2, "0123456789"); put(3, "ÄÖÜäöüß"); put(4, " $+-*/=%\"'#@&_(),.;:?!\\|<>[]§`^~"); } }; //Constructors public Font(String name, float size) throws Exception { this.font = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, new File("./res/Font/" + name + ".ttf")).deriveFont(size); //Generate buffered image GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); Graphics2D graphics = gc.createCompatibleImage(1, 1, Transparency.TRANSLUCENT).createGraphics(); graphics.setFont(font); fontMetrics = graphics.getFontMetrics(); imageSize = new Vector2((float) drawChars.values().stream().mapToDouble(e -> fontMetrics.getStringBounds(e, null).getWidth()).max().getAsDouble(), (float) drawChars.keySet().size() * (this.getCharHeight())); bufferedImage = graphics.getDeviceConfiguration().createCompatibleImage((int) imageSize.x,(int) imageSize.y,Transparency.TRANSLUCENT); //Generate texture fontTextureId = glGenTextures(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, fontTextureId); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,(int) imageSize.x,(int) imageSize.y,0, GL_RGBA, GL_UNSIGNED_BYTE, asByteBuffer()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } //Functions public void drawText(String text, int x, int y, Shader shader, Quad quad) { glBindTexture(GL_TEXTURE_2D, this.fontTextureId); int xTmp = x; for(char c : text.toCharArray()) { Rect r = chars.get(c); shader.SetUniform("position", xTmp, y); shader.SetUniform("offset", r.x, r.y, r.width, r.height); shader.SetUniform("pixelScale", new Vector2(r.scale.x, r.scale.y)); quad.Render(); xTmp += r.scale.x; } } public Map<Character, Rect> GetCharacters(){return chars;} public int GetFontTextureID(){return this.fontTextureId;} //Conversions public ByteBuffer asByteBuffer() { ByteBuffer byteBuffer; //Draw the characters on our image Graphics2D imageGraphics = (Graphics2D) bufferedImage.getGraphics(); imageGraphics.setFont(font); imageGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); imageGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // draw every CHAR by line... imageGraphics.setColor(java.awt.Color.WHITE); drawChars.keySet().stream().forEach(i -> ProcessCharacters(imageGraphics, i)); //Generate texture data int w = (int)imageSize.x; int h = (int)imageSize.y; int[] pixels = new int[w * h]; bufferedImage.getRGB(0, 0, w, h, pixels, 0, w); byteBuffer = ByteBuffer.allocateDirect((w * h * 4)); for(int y = 0; y < h; y++) { for(int x = 0; x < w; x++) { int pixel = pixels[y * w + x]; byteBuffer.put((byte) ((pixel >> 16) & 0xFF)); // Red byteBuffer.put((byte) ((pixel >> 8) & 0xFF)); // Green byteBuffer.put((byte) (pixel & 0xFF)); // Blue byteBuffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha } } byteBuffer.flip(); return byteBuffer; } public void ProcessCharacters(Graphics2D g, int index) { char[] cArray = drawChars.get(index).toCharArray(); for(int i = 0; i < cArray.length; i++) { float charWidth = getCharWidth(cArray[i]); float charHeight = getCharHeight(); chars.put(cArray[i], new Rect(1f / imageSize.x * getCharX(cArray[i]), 1f / imageSize.y * getCharY(cArray[i]), 1f / imageSize.x * charWidth, 1f / imageSize.y * charHeight, charWidth, charHeight)); } g.drawString(drawChars.get(index), 0, fontMetrics.getMaxAscent() + (getCharHeight() * index)); } public float getCharX(char c) { String originStr = drawChars.values().stream().filter(e -> e.contains("" + c)).findFirst().orElse("" + c); return (float) fontMetrics.getStringBounds(originStr.substring(0, originStr.indexOf(c)), null).getWidth(); } public float getCharY(char c) { float lineId = (float) drawChars.keySet().stream().filter(i -> drawChars.get(i).contains("" + c)).findFirst().orElse(0); return this.getCharHeight() * lineId; } public float getCharWidth(char c){ return fontMetrics.charWidth(c); } public float getCharHeight(){ return (float) (fontMetrics.getMaxAscent() + fontMetrics.getMaxDescent());} } This ofcourse is not going to work straight out of the box because I've also got a quad class that creates the quad and stores it in a vbo and ofcourse using uniforms in the shader, etc.. etc.. But for the actual creation of the font, offsetting and label calls, it's all there. Methods are modification from THIS by TheBoneJarmer but 6000% the speed. The script found there is in a single script so it's easier to read and is standalone (out of the box), but is very very slow
  15. Lmao i didn't say anything about slopes, angles (slopes, walls, ceilings, etc..). But yes, the code you posted is what I was making sure you put in, alot of people forget that. Although 0.1f is very small, it should be fine. I personally use 0.3 because 0.1 you still get some clipping in some occasions. Edit: And my camera near clip is set to the lowest value. This image I set it to 0.1 instead of 0.3