Jump to content
  • Advertisement

Search the Community

Showing results for tags 'C#'.

The search index is currently processing. Current results may not be complete.


More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Game Developers Conference
    • GDC 2017
    • GDC 2018
  • Power-Up Digital Games Conference
    • PDGC I: Words of Wisdom
    • PDGC II: The Devs Strike Back
    • PDGC III: Syntax Error

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Community
    • GameDev Challenges
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Topical
    • Virtual and Augmented Reality
    • News
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical
  • GameDev Challenges's Topics
  • For Beginners's Forum

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams
  • GameDev Challenges's Schedule

Blogs

There are no results to display.

There are no results to display.

Product Groups

  • GDNet+
  • Advertisements
  • GameDev Gear

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Role


Twitter


Github


Twitch


Steam

Found 307 results

  1. I am working on a script that takes 3-4 inputs and creates a line formula from this. The formula is then used in line calculations, like collisions. The problem is the line formula has 4 versions that allows you to use 3 floats to construct it. These constructors are conflicting with each other. I found some old code of mine where I did the same thing but with single integer inputs. So I copied my code and it is working but I don't know if what I am doing is correct.Debugging proved it works, Code: I don't understand my own code here: var LineFormula = new LineFormula(); This tells me I made a new empty version of the class, inside of the class so there is 2 now? If there is two then what happens to one after return, is it waiting for garbage collection now? Why the static? Is this even a valid way to create similar arguments? Is there better ways? I checked online and found programmers using interfaces to make similar arguments. I think it made sense to me back then, but I have forgotten it as I never needed to use it again.
  2. I've got a ball object and I want to be able to manipulate the ball's speed (both speed up and slow down) based on different pickups dropped in the game. I'm not sure how best to do this. Here is my code for the Ball class: public class Ball : MonoBehaviour { private Paddle paddle; private bool hasStarted = false; private Vector3 paddleToBallVector; // Use this for initialization void Start () { paddle = GameObject.FindObjectOfType<Paddle>(); paddleToBallVector = this.transform.position - paddle.transform.position; } // Update is called once per frame void Update () { if (!hasStarted) { //Lock the ball relative to the paddle. this.transform.position = paddle.transform.position + paddleToBallVector; //Wait for a mouse press to launch. if (Input.GetMouseButtonDown (0)) { hasStarted = true; this.GetComponent<Rigidbody2D> ().velocity = new Vector2 (2f, 10f); } } } void OnCollisionEnter2D (Collision2D collider) { //use this vector2 to adjust the velocity so the ball does not get stuck in a vertical bouncing loop Vector2 tweak = new Vector2 (Random.Range(0f, 0.2f),Random.Range(0f, 0.2f)); if (hasStarted) { AudioSource audio = this.gameObject.GetComponent<AudioSource>(); audio.Play(); this.gameObject.GetComponent<Rigidbody2D>().velocity += tweak; } } } I just need to know how to manipulate the speed for this class. I'm not sure if how I have it set up now is the best way to manage movement of the ball object or if I should modify it to accommodate for speed manipulation.
  3. I guess my level could be classified as "just left Beginner's zone", so, gone through a lot of beginner's programming tutorials already, still junior and the problem is I don't know what's next. I mean, I found a lot of tutorials for beginners everywhere, and the next things I found everywhere are beautiful and complicated source code on Github: tutorials for beginners -- materials for "Grade 1 students" to learn beautiful and complicated source code on Github (not the beginner type of source code) -- materials for "Phd students" to learn However, what's in between? After I learned the Grade 1 materials I can't just directly jump to Phd level, I am trying to find the Grade 2,3,4,5,6 level materials to learn, right? Didn't find a lot of those. I am still a junior programmer. When I finished the beginner's programming tutorials I feel like leaving the Beginner's zone, no guidance anymore. I'm in LA, game programming is not like web programming,etc; there are some web programming bootcamps, but not game programming bootcamps, sad. Maybe as a junior programmer it is too much for me to request the market/youtube/online learning websites to produce structured intermediate level materials for learning game programming? It is also possible that I misjudge my own levels so I don't know where I am, therefore don't know what I should aim for next. The demo of the game I made for practice, somehow showing my level: https://youtu.be/RNAXWTQOQ2E The video about programming of my game, somehow showing my level: https://youtu.be/mi26UiFwvqY Github: https://github.com/nancyivy/Game_for_practice I would be grateful if you give me advice like: "you are still in beginner's zone", or "you can do xxx in your game to improve yourself", or "you may do xxx in programming to improve yourself" or anything else. I don't know, I'm just lost. I'm not sure whether this is the right place to post this type of questions; I hope my struggles can help someone in someway (don't know how this will help...)
  4. ERASERHEAD STUDIO

    13 RONIN - DevLog #2 - Lightning

    Ok, It hasn't been a full month since my first post here, but I still think it's time for an update, and from now on I plan to post a major news article at the beginning of every month containing a summary of what I've been up to lately. For anyone interested in more I recommend my blog at Eraserhead Studio where you can find random news, animations, images, sound and code that hopefully can help you out in your own game project. So, what have I been up to lately? Well, due to an aching hand, the result of too much asset drawing, I've let my hand rest from the tablet and instead focused on doing some proper coding. The result is two quite flexible engines: one for rain and the other one for lightning. Rain Since a few of the levels will take place in bad weather it's important for me to be able to generate some good looking rain. I talked about my rain engine already in the last post but since then I've fixed a few bugs, added some properties and posted a higher quality demonstration video on YouTube. The engine has a lot of settings, all which will help me make a living and varied rain. Some of these are: Drop velocity Drop acceleration Density Drop creation interval Wind No of splashes at ground contact There are still some minor features to add, such as individual ground height at different z-level, but majority of the engine is now done. If you want to do something similar for you own project please check out the demonstration video at YouTube . And why not download the source code from BitBucket . Lightning For an even more dramatic effect I want thunder and lightning in the game. I started doing a lightning bolt, then a lightning branch and finally a lightning engine sending randomized bolts and branches through the sky. As with the rain engine this engine also has a lot of settings, some of these are: Lightning length Lightning angle Interval between lightning strikes Lightning duration Animation Fade This was quite fun to code and I'm quite pleased with the result. Things left to add is sound for thunder and maybe a flashing background. Check out the demonstration video on YouTube and get the source code from BitBucket . A big thank you to Michael Hoffman whose awesome article was a big inspiration for this work. Other inspirations have been google images and YouTube. Internet is just awesome! Shaders Working with the lightning I spent a few hours and reading up on HLSL and including shaders in MonoGame. It was interesting and fun, but also quite time consuming. There will be a number of shaders included in the end product, but for now it will be a type of coding I will save for the polishing phase. For anyone getting started with MonoGame and HSLS I highly recommend the article My First Pixel Shader(s) . I'd be very happy for recommendations on other good HSLS pages. Home page I'm using WIX for the Eraserhead Studio page but unfortunately the WIX-editor is both slow and buggy. I've spent a number of hours in the editor trying to achieve a nicer looking and easier to use site than the previous one but WIX doesn't make it easy. I've still got two active tickets at the WIX-support regarding bugs I can't find any solutions for, but hopefully the site will still be better than the last one. The short lesson being - don't use WIX. Dev forums Besides writing and publishing this post I've also drawn avatar, logo and banner and added those to my profiles on: GameDev IndieGamer TIGForums GameJolt Reddit IndieDB When I've got a finished demo I'll also get on Facebook and Twitter. Do you have recommendations on other sites where you think I belong? Please let me know. Please visit Eraserhead Studio for more. Happy coding! /jan. NOTE. As always, everything I publish here or on any other site is work in progress and subject to change.
  5. ERASERHEAD STUDIO

    13 RONIN - DevLog #1

    13 RONIN 13 RONIN is a 2D pixel art samurai sword fighting game inspired by old Japanese samurai movies and 8-bit classics such as Barbarian and The Way Of The Exploding Fist. Your mission as a noble samurai is to defeat 13 renegade ronin and their murderous leader. Although done in low-resolution pixel art the game will have a somewhat “arty” aesthetic in black and white mixed with details in color. Who am I? I’m a 40 year old Swede with about 17 years of professional experience working as a .Net developer. To make a game has been a dream ever since I as a child learned to write a “guess a number”-game on my Commodore 64. Now I’m trying to fulfill that dream. I’m the sole developer behind this project and I’m doing it as a spare time project so please be patient. Status The main structure of the game and basic gameplay, based on placeholder graphics, is done and I’m currently switching between drawing assets and coding graphics effects like rain and lightning. News I’m quite often updating my dev blog with short posts about the progress I make. A post can contain a new animation, a sound effect, a code sample or something else related to the making of 13 RONIN. On this and other forums I will post updates, that are longer than those on my site, but not as often. To help and inspire the community I will share tools and parts of the code on my BitBucket-page. Happy coding! /jan. https://www.eraserheadstudio.com/
  6. Once again, starting from scratch. But this time it's in regard to how I code things. Going forward I'll be using new organization tricks to make sure I understand how the entire game works inside and out. No more endless bug hunts because I'll know exactly where they are and what that line of code interacts with, all to better help me deduce the cause of any problems. Also took a stab at rearranging the development schedule to aim for a July 25th release. The path is laid out, but the main factor determining if I can make it is getting to that Alpha build I've been yapping about for years now. All this reorganization stuff should help with that, because things will be more efficient than ever. No more hardcoding, no more just copy/pasting from solution forums, and no more being stingy with line spacing, name lengths, or comments. Now I'm using all kinds of visual tricks to make sense of the thousands of lines of code I quickly scroll through. Big purple lines and comments everywhere draw my eye to quickly read what a particular piece of code does. Big green bookmarks help me keep track of different sections of similar functions. And little purple headers above each function helps my eyes hone in on each one too, whereas before I'd scrunch related ones as close together as possible. The philosophy now is to not be afraid to space things out, name variables clearly, and comment EVERYTHING. No more getting lost. No more forgetting what something does. Completed: Finished Making Global Variables as Clear as Possible Reorganized Variables Some More Changed Global Functions to Work More Efficiently Made Global Functions Easier to Read Deleted the Old Garbage Code Wrote Design Ideas for Sequel (this project is late as is, no time to implement even more features and experiment with new layouts) Tested New Save System The mobile gaming platform continues to be an embarrassment. This is why gamer's look disgusted when you tell them you're working on a mobile game. Lessons Learned: The whole Harry Potter Mobile Game fiasco really depresses me as a dev. But it does make me that much more sure that a game like BGP has to exist to show people how it's done. A game that charges upfront then lets you have fun for as long as you want. I'm really tired of seeing games with great potential die right before my eyes because of corporate greed. Found this interesting article by the Web Master at Seribii talking about What Pokemon's Main Series Can Learn from GO. Designs I intend to implement in BGP look a lot like what that article talks about so I'm reconfirmed not to be the only one seeking a game like this. I'd really like to implement a more fun capture mechanic like Pokemon GO's addictive ball toss, but I'll have to experiment with that stuff as well as online connectivity and timed special events in the sequel. There's a lot of Polish Touches for me to put on BGP, but I need to keep pushing them back. It's function over form at the moment and I need a game that works right now. Perfection comes later. I might not have time to make the Battle AI as advanced as I want to, but I can lay a foundation to expand on later with DLC difficulty settings. Revised schedule of what must be done to get this game out in time for BronyCon. Looking at the state of things right now I feel like the To Do schedule is feasible enough. Spend the next week continuing what I'm doing now with remaking all interfaces, basic combat, and making sure there's a stand-in for anything I'll be adding later. After that, I'll need to remake the overworld systems (cleaning up & copying over the working bits of that code I've already done) and convert my graph paper maps to Unity Tile Maps. After that it's just polishing up a presentable demo, then drawing sprites and testing the game for a couple months. The key to getting all those art assets done in time is ignoring perfection until the very last step. I need rough sprites for everything, then cleaned up versions and in-between frames. Once that's all done, I can go back and tweak things with however much time is left. Main objective here is: If you can tell what it is, that's good enough for now. Sprites have caused major delays for me in the past, and it's mostly because I spend half the time staring at the thing wondering what details are missing or debating between 2 or 3 options for 10 minutes at a time. Gotta speed this up. Saw this email on Monday and submitted the Info Form ASAP with a revised version of the panel description. If I can reach the Alpha build by June, I'll definitely shoot them another email saying how close the game is to release. If it gets enough buzz just before BronyCon starts, and I let them know it comes out on the first day of the convention, I might find myself off the waitlist sooner rather than later. The new BGP breakdown. (Now I gotta live up to my word and have this out in 3 months.) __________________________________________________________ Patreon: If you didn't know, Yotes Games is on Patreon! Hats off to these guys as well as one Mr. Craig who's been donating 10 of his hard-earned dollars every month over PayPal since 2015. Monthly reminder that these are the MVPs keeping the Yotes Games fire alive! Battle Gem Ponies is looking better than ever because of you patrons giving me a budget to dedicate towards tools and assets to make development a lot easier (and faster too). Can't wait to put your tribute characters into the game and see your reactions! Downloads: As a side note, think I should stop sharing my download number estimates and just celebrate noteworthy milestones as they come. It seems like sales data is just a privacy issue and doesn't do much beside make people want to guess exactly how much money you have at any given time or make judgements on investing in you or not. I can accomplish my goals of letting you know if I ever achieve success or not my just showing the obvious rankings and major milestones. Keeping track of all the sales numbers is interesting and all, but the methods I use to track em are falling off one by one because companies all seem to be saying sharing exact sales figures is a bad idea. I think my best bet for a personal checkup is just to go by App Annie for mobile sales tracking, then Itch.io and Steam for computer stuff. But in terms of sharing with the rest of the world, I'll stick to the big milestones and vague sales goals. (Plus I'm sure calculating things to the last cent and estimating profit after taxes and expenses is only interesting to nerds like me who willingly took a bunch of accounting and finance classes.) But if you're curious about a vague estimation of how I'm doing so far, over 150,000 people have downloaded and played an app I've made. I've collected about $2,200 total since 2013 from my first game Unicorn Training (pretty much all went towards getting a Macbook to port to iOS where I failed to get the money back). Nowadays I dream about convincing those 150,000 people to pay $5 each for Battle Gem Ponies and just being set to start a life and make BGP2 with nothing holding me back. __________________________________________________________ Racing towards this game's alpha build feels like the longest marathon of my life. I just pray the uphill part is over soon. Morale would go through the roof if I could just get to the point where all the systems are in place, just ready to be molded into a fun adventure.
  7. Hello, This is actually my first post after being a lurker for quite some time here. For the last couple of days I try to get my head around the concept of Overwatch's multiplayer architecture after watching the GDC 2017 talks by Timothy Ford ("Overwatch Gameplay Architecture and Netcode") and Dan Reed ("Networking Scripted Weapons and Abilities in Overwatch"). ( I hope someone here has Vault Access :D) As usual with such complex systems Overwatch seems to combine different approaches to hide latency. Among others, the ones I am mostly interested in are, Command Frames and State Synchronization. I think I understood both concepts but I have problems adding them up. 1) Ford talks about the client being in the future by ~ half the RTT plus one command frame. This ensures that all commands sent from the client to the server tend to arrive when the server is actually at the tick referenced in the command. If that's correct my assumption would be the following: Server is at tick 1000. RTT is ~ 10 ticks -> around 10*16.6 ms. Client simulates tick 1005 and sends command associated with tick 1005. <5 ticks later> Server is at tick 1005 and received a client command. (maybe its already queued in a buffer). Server applies command and sends state for tick 1006 (State_N + Input_N = State_N=1). RTT might still be 10 ticks. Client simulates tick 1010. <5 ticks later> Server is at tick 1010... Client received State for tick 1005 and checks internal buffers for prediction. Does that really apply? Does the client really simulate half-rtt in the future? 2) How do I handle ticks at the start of the game? My network layer requires a timestamp to work and I'd use ticks in the main game loop. Do I have something like a grace period until the client can calculate the required ticks to move to the future (by calling simulation.Tick(1/60f) for the number of ticks to be in the future)? 3) If I run the simulation at 60Hz and the network layer at say 20Hz. Do I have 60 Inputs that I send from Client to Server or 20? I know, this is somewhat similar to other questions in this forum, but I feel like this particular talk has never been discussed? Cheers, poettlr
  8. Hi there, I'm trying to put building from real lat-long in my Monogame app (4 buildings in my school, please check the image with the blue circles) But after some convert method, it went terribly wrong (please check image) Please help me find out what's wrong. My code: public List<float> Gps2Cartesian(float latitude_degree, float longitude_degree, float elevation) { cartesResult = new List<float>(); var longtitude_rad = DegreeToRadian(longitude_degree); var latitude_rad = DegreeToRadian(latitude_degree); var n = a / Math.Sqrt(1 - e2 * Math.Sin(latitude_rad) * Math.Sin(latitude_rad)); var cartes_X = (n + elevation) * Math.Cos(latitude_rad) * Math.Cos(longtitude_rad); //ECEF x (z in right - handed system) (m) var cartes_Y = (n + elevation) * Math.Cos(latitude_rad) * Math.Sin(longtitude_rad); //ECEF y (x in right - handed system) (m) var cartes_Z = (n * (1 - e2) + elevation) * Math.Sin(latitude_rad); //ECEF z (y in right-handed system) (m) cartesResult.Add((float)cartes_Y); cartesResult.Add((float)cartes_Z); cartesResult.Add((float)cartes_X); return cartesResult; } And this is debug result: Thank you !
  9. I am asking this just to get a sense of how people think about this problem as I don’t think there is a “right” answer and they way I think about code structure for my day job (which is highly functional / immutable based JavaScript code for frontend applications) don’t quite fit into game development I think. This question came up from the fact that I added a simple quest system prototype to my game and one of the requirements for a quest could be collect X number of items. The original way I implemented this was that in order to see if a quest was completable, you would have to pass the quest the inventory object of the player and then it could check the items and see if the player meets the requirements. Then I wanted to add a message in the activity log (this is a turn based game) when the player reached the item requirements however I could not do that, at least easily, with how the quest item requirement was designed so I instead move the coupling of the quest system and inventory system so that the inventory system would update the quest when an item iwas added / removed which allowed me to easily add the activity log message that I wanted to. This might be a stupid question however I was wondering what peoples process might be when figuring out how / where to couple game systems together? Maybe it is just something the comes to light when you figuring out how the game system are going to work (and maybe I need to do more forethought about my game systems) but I figured I would ask to see if I could gain some insight about this from other people.
  10. Hi guys, I've never done any ray-casting before and have a problem using it in my game. I have managed to get the initial raycast to work and drawing rays is much easier now to me but if the ball were to bounce against the top of the bottom walls in my game of pong, I want to raycast from those points as quickly as possible to predict where it is going to end up on the computer side, my code for it is below.. I've tried to annotate to help demonstrate my problem. using System.Collections; using System.Collections.Generic; using UnityEngine; public class RaycastTest : MonoBehaviour { private Rigidbody2D rb2d; private RaycastHit2D hit; private Vector2 predictedCollision; private Vector2 collisionPoint; private int numberOfCollisions; void Start () { rb2d = GetComponent<Rigidbody2D> (); numberOfCollisions = 0; } void FixedUpdate () { //Directions of the ball (normalized) Vector3 forward3 = new Vector3 (rb2d.velocity.normalized.x, rb2d.velocity.normalized.y, 0) * 20; Vector2 forward2 = new Vector2 (rb2d.velocity.normalized.x, rb2d.velocity.normalized.y); // If the ball has just hit the player paddle if (BallMovement.isOnPath == true) { if (numberOfCollisions == 0) { //make sure we have the correct initial collision point from another script collisionPoint = BallMovement.collisionPoint; //draw and cast a ray to detect the next point of collision Debug.DrawRay (collisionPoint, forward3, Color.red, 20f); hit = Physics2D.Raycast (collisionPoint, forward2, Mathf.Infinity); //print the name of the object that has been hit print (hit.collider.name); //change the initial collision point to the new one collisionPoint = new Vector2 (hit.point.x, hit.point.y); print (collisionPoint); //add on to the number of collisions numberOfCollisions += 1; print (numberOfCollisions); } //if we still haven't reached the HitArea we need to do another bounce if (hit.collider.name != "HitArea") { //make sure we get the velocity after impact and reverse the direction of the y velocity. forward2 = new Vector2(rb2d.velocity.normalized.x, rb2d.velocity.normalized.y * -1f); forward3 = new Vector3 (rb2d.velocity.normalized.x, rb2d.velocity.normalized.y * -1f, 0) * 20; //draw and cast a ray to detect the next point of collision hit = Physics2D.Raycast(collisionPoint, forward2, Mathf.Infinity); Debug.DrawRay(collisionPoint, forward3, Color.red, 20f); //change the initial collision point to the new one collisionPoint = hit.point; print (collisionPoint); //add on to the number of collisions numberOfCollisions += 1; } //If we've hit the HitArea, we reset everything so it stops looping and we've got our predicted point of collision on the computer side. if (hit.collider.name == "HitArea") { predictedCollision = hit.point; numberOfCollisions = 0; BallMovement.isOnPath = false; } } } } My real question is, when you have a script attached to the ball, like this one, is the raycast attached and moving with the ball? Do I need to make a script on the side? Or can I remove the initial raycast attached and start a new one from the new collision point if it hits the top or bottom boundary? Thanks guys!
  11. COMPANY AND THE PROJECT We are an indie game studio consisted of professional and skilled artists who are dedicated indie enthusiasts. Our current project is INT, developed on Unity Engine 5 for platforms Windows, Linux, and Mac. We are recruiting a few more members on the team to finalize our playable demo. INT is a 3D Sci-fi RPG with a strong emphasis on story, role playing, and innovative RPG features such as randomized companions. The focus is on the journey through a war-torn world with fast-paced combat against hordes of enemies. The player must accomplish quests like a traditional RPG, complete objectives, and meet lively crew members who will aid in the player's survival. Throughout the game you can side and complete missions through criminal cartels, and the two major combatants, the UCE and ACP, of the Interstellar Civil War. Please note that all of our current positions are remote work. You will not be required to travel. For more information about us, follow the links listed below. INT Official website Steam Greenlight IndieDB page Also follow social media platforms for the latest news regarding our projects. Facebook Twitter UNITY ENGINE PROGRAMMER We are looking for Unity Programmers. You will be working with our Coding team Lead to implement systems and mechanics using C# language. Your duties will include: Attendance of regular team meetings. Timely completion of implementation of assets. Direct contact with Project Lead and other Department Leads for the implementation process. Utilization of version control suites. Utilization of our project management boards (Trello) and communication channels to obtain up-to-date assets. REQUIREMENTS To be successful in this position, following requirements apply: Clear communication and self starter - pushes to meet deadlines and contribute to the project. Ability to complete tasks with limited input/direction from management. Comfortable with working with people remotely and via Trello management system. Good internet connection with ability to update assets/builds quickly, with large dependencies. At least 15 hours of availability each week. Proficient experience using the Unity Game Engine. Proficient experience in implementing assets into the Unity Game Engine. REVENUE - SHARE This is a great opportunity to get into the game development industry. We have the majority of our art assets completed and are marching towards our crowd-funding campaign, currently planned for mid 2018. We are unable to offer wages or per-item payments at this time. However revenue-sharing from crowd-funding is offered to team members who contribute 15-20 hours per week to company projects, as well as maintain constant communication and adhere to deadlines. Your understanding is dearly appreciated. TO APPLY Please send your Cover Letter, CV, Portfolio (if applicable), and other relevant documents/information to this email: JohnHR@int-game.net Thank you for your time! Please feel free to contact me via the email provided should you have any questions. We look forward to hearing from you! John Shen HR Lead Starboard Games LLC
  12. Hello everyone! I'm an atmospheric scientist working on radar data visualization software and have hit a bit of a snag with my move to DX10 and implementation of a geometry shader. Here's an example of the interface, showing several different products from a mobile radar dataset. In the build shown, I precalculate the positions of all the gates (basically, radar pixels) in the dataset and pass that to the VShader and PShader for transformation to screen coordinates and coloration based on color tables. I recently implemented a GShader to expand my road layers so as to have them be more than one pixel wide, and want to implement a GShader for data so that I can dramatically decrease the memory load of a dataset (long-range radar datasets can consume >1GB of video memory... not great). I initially wrote the whole shader implementation, but when it didn't work I backed way off and have just been trying to get the GShader to emit triangles that form a quad in the middle of each frame. In the input assembler stage, I'm passing the VShader two 2-byte integers: a beam index (to know which direction the antenna is pointing) and a gate index (range from radar). Below is my passthrough VShader (since all the actual geographical geometry is going to need to be calculated in the GShader stage). I put the "POSITION" semantic in VOut thinking that vertices without a defined position were getting culled, but that apparently is not the case. There's a few other radar-related fields in there (Value, FilterValue, SpecialValue) but I think we can safely ignore those, unless inclusion of them has pushed my vertex size over some limit and is the cause of my problems. struct VOut { float4 Position : POSITION; int2 GateRay : GATE_RAY; float Value : VALUE; float FilterValue : FILTER_VALUE; int SpecialValue : SPECIAL_VALUE; }; Texture2D<float> filterData : register(t0); Texture2D<float> valueData : register(t1); VOut VShader(int2 GateRay : POSITION) { VOut output; output.Position = float4(0.5, 0.5, 0.5, 0.0); output.GateRay = GateRay; output.Value = valueData[output.GateRay]; output.FilterValue = filterData[output.GateRay]; if (output.Value == -1.#INF) output.SpecialValue = 1; else if (output.Value == 1.#INF) output.SpecialValue = 2; else output.SpecialValue = 0; return output; } My dummy GShader code is below. I am intentionally winding one triangle the wrong way - I do this during shader development so that if I screw up badly I can see at least half of my triangles. At this point, I'm just trying to get something to show onscreen. I don't see anything glaringly wrong with it, but I suppose if I did I would have fixed it. I adapted this code from the GShader that expands my GIS road lines into rectangles. Unlike this one, that GShader works. struct PS_IN { float4 Position : SV_POSITION; int2 GateRay : GATE_RAY; float Value : VALUE; float FilterValue : FILTER_VALUE; int SpecialValue : SPECIAL_VALUE; }; [maxvertexcount(6)] void GShader(point VOut gin[1], inout TriangleStream<PS_IN> triStream) { PS_IN v[4]; v[0].Position = float4(-0.5, -0.5, 0.5, 0.0); v[0].GateRay = int2(1, 1); v[0].Value = 50.0; v[0].FilterValue = 0.0; v[0].SpecialValue = 0; v[1].Position = float4(0.5, -0.5, 0.5, 0.0); v[1].GateRay = int2(1, 1); v[1].Value = 50.0; v[1].FilterValue = 0.0; v[1].SpecialValue = 0; v[2].Position = float4(-0.5, 0.5, 0.5, 0.0); v[2].GateRay = int2(1, 1); v[2].Value = 50.0; v[2].FilterValue = 0.0; v[2].SpecialValue = 0; v[3].Position = float4(0.5, 0.5, 0.5, 0.0); v[3].GateRay = int2(1, 1); v[3].Value = 50.0; v[3].FilterValue = 0.0; v[3].SpecialValue = 0; triStream.Append(v[0]); triStream.Append(v[3]); triStream.Append(v[2]); triStream.RestartStrip(); triStream.Append(v[0]); triStream.Append(v[3]); triStream.Append(v[1]); triStream.RestartStrip(); } Below is the dummy pixel shader I'm using. It should just color my triangles white. Normally I use a pixel shader compiled from HLSL code I generate from a user-defined color table - but in the interest of reducing sophistication in debugging, I'm using this dummy. struct PS_IN { float4 Position : SV_POSITION; int2 GateRay : GATE_RAY; float Value : VALUE; float FilterValue : FILTER_VALUE; int SpecialValue : SPECIAL_VALUE; }; float4 PShader(float4 Position : SV_POSITION, int2 GateRay : GATE_RAY, float Value : VALUE, float FilterValue : FILTER_VALUE, int SpecialValue : SPECIAL_VALUE) : SV_TARGET { return float4(1.0, 1.0, 1.0, 1.0); } Thanks in advance for the help!
  13. So I am working on a arcade game in Unity, one of the problems I am having is that there is just too many projectiles and it is dropping the frame rate. Because it is an arcade style game where players can dodge projectiles, I need slow moving projectiles that can detect collision on it's own. The problem is that there are hundreds of these just flying around. Normally I would just result to ray tracing but it won't work here because projectiles are slow and not instant. I already have a limit for projectiles each ship can have, that isn't working. I feel like I am missing something obvious here.
  14. bowcox

    Pong AI

    Hi guys! I have created a Pong game that has an AI that is almost beatable, changing the speed of the AI can make it ridiculously easy or hard depending on the way you go about it. using System.Collections; using System.Collections.Generic; using UnityEngine; public class ComputerMovement : MonoBehaviour { private float speed; private float reAdjustSpeed = 1f; private Rigidbody2D computer2d; public static bool isTwoPlayer; GameObject theBall; Rigidbody2D rb2d; void Start() { computer2d = GetComponent<Rigidbody2D> (); } void FixedUpdate() { if (isTwoPlayer == true) { speed = 5f; if (Input.GetKey (KeyCode.W)) { computer2d.position += Vector2.up * speed * Time.deltaTime; } if (Input.GetKey (KeyCode.S)) { computer2d.position += Vector2.down * speed * Time.deltaTime; } } if (isTwoPlayer == false) { speed = 3f; if (theBall == null) { theBall = GameObject.FindGameObjectWithTag ("Ball"); } rb2d = theBall.GetComponent<Rigidbody2D> (); //Is the ball going left or right if (rb2d.velocity.x > 0) { if (rb2d.velocity.y > 0) { if (rb2d.position.y > computer2d.position.y) { MoveUp (); } if (rb2d.position.y < computer2d.position.y) { MoveDown (); } } if (rb2d.velocity.y < 0) { if (rb2d.position.y > computer2d.position.y) { MoveUp (); } if (rb2d.position.y < computer2d.position.y) { MoveDown (); } } } //Whilst it's not moving at the paddle, let it gain a slight reset by moving with the ball at a slower pace. if (rb2d.velocity.x < 0) { if (computer2d.position.y < 0) { computer2d.position += Vector2.up * reAdjustSpeed * Time.deltaTime; } if (computer2d.position.y > 0) { computer2d.position += Vector2.down * reAdjustSpeed * Time.deltaTime; } } } } void MoveDown() { if (Mathf.Abs(rb2d.velocity.y) > speed) { computer2d.position += Vector2.down * speed * Time.deltaTime; } else { computer2d.position += Vector2.down * speed * Time.deltaTime; } } void MoveUp() { if (Mathf.Abs (rb2d.velocity.y) > speed) { computer2d.position += Vector2.up * speed * Time.deltaTime; } else { computer2d.position += Vector2.up * speed * Time.deltaTime; } } } I have looked up several posts across many different forums in order to create a much better AI. Most of the posts recommend that I use Raycasts to find out exactly where the ball might hit the paddle. I have looked up how to use them and I'm just completely lost, do raycasts consider collisions and go on infinitely or once they hit a wall, that's where it'll end up? Would anyone be able to help me understand raycasts a little better? If you have another solution that enables me to calculate exactly where the ball will end up on the opponents side, I am more than willing to hear it Thanks again if you read this!
  15. We're looking for a Unity (C#) Programmer for our 2D Project. We're looking for a new lead programmer to continue with an existing project. Project is an open-world RTS, and is very close to a prototyping (playable) phase. Our existing lead, unfortunately, has no more time for the project, and thus we are in search of a new one who is interested. Game is purely fantasy based, and we'll be able to give you much more detailed info about the project as we begin to work you into it. You'll be working with our junior developer, who has been here since the beginning. Primary skills needed are just being able to work within Unity. But skills within XML are also a plus. Our list of major goals we'd need you to do is minimal, yet still fairly extensive: -Edit our current Pathfinding system to account for a few extra features. -Setup our global map system. You’ll be working off an existing random node-map web generator and existing random map generation system and essentially linking the two together. This includes handling random spawns (which has already been semi-setup) unique to each node’s respective map. -Further implementation of an existing random spawning algorithm (used to spawn things like enemies randomly across the Map). -Making sure to Save and Record all respective aspects of what was mentioned above. -Handling our XML database- database is created, but we’ll need to be integrating it. This includes all various things from units to abilities and so forth. Will also need to handle implementing an object’s unique attributes we cannot take care of within XML. -Various Content Implementation (to be done once our XML has been integrated). -Various Saving and Recording of all respective aspects of the database info mentioned above. -Various Performance Enhancements. -Potential for various misc things, such as further UI work. -Setting up a Menu system. We have a considerable amount of things done already- however I must warn ahead of time we have quite a bit of unclean code, which may be fairly overwhelming for a new developer on the project. Let me know your rates per hour, and we'll see if we can work out a good deal between both of us. Royalties are also included. If interested, send an email to: eldwin11929@yahoo.com Thanks!
  16. My bestselling and highly recommended Unity book has been fully revised! Unity in Action, Second Edition teaches you to write and deploy games with the Unity game development platform. You'll master the Unity toolset from the ground up, adding the skills you need to go from application coder to game developer.Foreword by Jesse Schell, author of The Art of Game DesignDon't take my word for it being good, look at the sky-high ratings on GoodReads.You can order the ebook directly from the publisher's site, or order the book on Amazon to get both the physical book and a coupon to download the ebook!
  17. Kristiyan21

    Your opinion on my game?

    Hello guys,i am writing this topic to get to the opinion of more people.I have just released my first game for android(worked on it for about 5-6 months in my spare time) i used Unity framework and i am planning to make it a big project but i had to release 1.0 version so i am 100% sure i wouldn't quit the project at some time.What i am asking any of you guys is to give me your opinion about the game. What do you like,what you don't , is the ad too irritating?is the GUI okay?any information you might consider usefull for me would be helpful,thanks in advance! the game on google play: https://play.google.com/store/apps/details?id=com.KindieGames.PlaneDash
  18. I've got a custom Brick class. I need at least one other type of Brick subclass, maybe more. These classes should do most of what the Brick class does, but have a bit of modified or added behavior. Normally I would assume inheriting from the Brick class would be the best choice for this, but when I tried to do it I was having some issues because of having to make additional instances of variables referencing manager objects. I'm not sure if I was just doing it wrong, or if maybe inheritance isn't the right solution here. Here is the Brick class: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Brick : MonoBehaviour { public AudioClip crack; public Sprite[] hitSprites; public static int breakableCount = 0; public GameObject smoke; private LevelManager levelManager; private int timesHit; private bool isBreakable; private float delay = 1.5f; //Delay till bricks move down 1 row. private float timer = 0; // update ever frame and compare to delay. // Use this for initialization void Start () { isBreakable = (this.tag == "Breakable"); //keep track of breakable bricks if (isBreakable){ breakableCount++; } timesHit = 0; levelManager = GameObject.FindObjectOfType<LevelManager>(); } // Update is called once per frame void Update () { timer += Time.deltaTime; if (timer >= delay) { transform.Translate(0.0f, -1.0f,0.0f); timer = 0; } } void OnCollisionEnter2D (Collision2D collision) { if (collision.gameObject.tag == "EndScreen") { levelManager = GameObject.FindObjectOfType<LevelManager>(); levelManager.LoadLevel("Lose"); } AudioSource.PlayClipAtPoint (crack,transform.position); if (isBreakable) { HandleHits (); } } void HandleHits () { timesHit++; int maxHits = hitSprites.Length + 1; if (timesHit >= maxHits) { breakableCount--; levelManager.BrickDestroyed(); PuffSmoke(); Destroy (gameObject); } else { LoadSprites(); } } void LoadSprites () { int spriteIndex = timesHit - 1; if (hitSprites [spriteIndex] != null) { //if statement keeps it from loading nothing if level designer forgets to assign a sprite this.GetComponent<SpriteRenderer> ().sprite = hitSprites [spriteIndex]; } else { Debug.LogError("Brick sprite missing"); } } void PuffSmoke () { var smokePuff = Instantiate(smoke, transform.position, Quaternion.identity); var effect = smokePuff.GetComponent<ParticleSystem>().main; effect.startColor = GetComponent<SpriteRenderer>().color; } } What I need is for a different kind of brick to destroy all other adjacent bricks when the ball hits it. I considered just adding this functionality in to the brick class, and have it activate based on tags, but that didn't seem like the best solution. I'm open to any ideas. Thanks!
  19. Epicghost 505

    Forming A Team

    Hello, We are looking for people to be apart of a team, to help create a horror game we are looking for 3d modelers, coders, artist, animators, fx artist, level designers, and audio design, there will be a payment plan once release of game if your interested come join our discord We hope to see you there https://discord.gg/6rcc6xr -Epicghost505
  20. ***Original blog post can be found by clicking HERE*** ***Untouched Earth Website can be found by clicking HERE*** Good day everyone! If you had a chance to read my last blog post, then you’re well aware I had the opportunity to have some very kind individuals play test the game two weeks ago. In addition to discussing the game’s progress, I’d like to use this post and future blog posts to discuss the tips I’m learning as I continue implementing suggestions, fixing bugs, and creating the game. Development Tips 1) Use raycasting to stop character movement instead of relying on colliders. 2) Improve performance and limit excessive calls to the garbage collector by disabling game objects instead of destroying them. Game Updates 1) Improved playability and enhanced visual appeal in level one 2) Created an animation for the maya coin 3) Fixed bugs associated with bullets 4) Implemented object pooling for bullets 5) *See Picture* Created a Boar Character 6) *See Picture* Created a Goat Character 7) Updated combat mechanics to utilize triggers rather than colliders 8) Fixed bugs associated with climbing, hanging, and swinging 9) Fixed bugs associated with Poker obstacles 10) *See Video* Fixed confusion about which walls are climbable through enhanced artistic presentation 11) Fixed confusion about which objects are swingable through enhanced artistic presentation 12) *See Picture* Updated bounceable object _____________________________________________________________________________________________ Tip One: Use raycasting to stop character movement instead of relying on colliders. Consider the scenario above. The hero is running toward a wall with the expectation that he will stop when the two colliders meet. From what I’ve found, this method works just fine most of the time and tends to be bug free. However, I’ve also discovered that collision detection can be inconsistent, and the hero occasionally runs through thin walls. The problem is that the code allows the hero to continue moving with the expectation that the collider will stop his forward progression. While it would be possible to stop the hero from moving forward when the colliders collide, I believe the following solution produces better, bug free results. Basically the raycast detects whether a wall is in front of the character. If it is, and if the hero is close enough to the wall, the code signals to the hero to stop updating his forward motion. This way, the hero isn’t relying on the colliders to stop his movement, but is using code to stop him in his tracks and no collision is even necessary. This solution may be more resource intensive, but I believe it is a worthwhile trade off for the benefits. _______________________________________________________________________________ Tip Two: Improve performance and limit excessive calls to the garbage collector by disabling game objects instead of destroying them. In the scenario above, the hero is climbing up a wall and is about to pick up coins. If each coin is destroyed when it is collected, it won’t take long before the garbage collector activates to get rid of all the excess, destroyed objects. Considering that a level might have 200-300 coins in it, then the number of destroyed game objects quickly adds up. Rather than destroying each coin when it is collected, simply setting it inactive when the hero picks it up prevents the garbage collector from running as often. The code above is a portion of the coin script, and shows how this solution is implemented. I believe it results in less calls to the garbage collector. ___________________________________________________________________________________ Update Pictures & Videos Original character was purchased in the asset store and updated by me. Thank you Mimu studios! Original character was purchased in the asset store and updated by me. Thank you Mimu studios! Updated Bounceable Obstacle _________________________________________________________________________________________ As always, thank you for reading. I would love to hear from you and would love to hear any comments or ideas you have. Feel free to leave a comment or email me at watermoongames@gmail.com. ***Original blog post can be found by clicking HERE*** ***Untouched Earth Website can be found by clicking HERE*** ________________________________________________________________________________________
  21. I'm having a weird issue with detecting a collision. I've tried everything I could find online but nothing seems to work. I have a brick object. It has a 2D Collider attached and I have also attached a 2D Rigidbody on it. I also have an EndScreen 2D Collider. The EndScreen 2D collider is tagged with "EndScreen". I am trying to detect when a brick collides with the end screen collider and simply print "game over" in the console. This is my current code for this part of the program, it is attached to the bricks: void OnCollisionEnter (Collision2D collision) { if (collision.gameObject.tag == "EndScreen") { Debug.Log("Game over"); } } Several things have happened depending on the set up. If I have the rigidbody 2D set as static, my ball object can still collide with the bricks, but I get no Log message. If I set it to Kinematic or Dynamic, I get absolutely no interaction between the ball and the bricks, and nothing when the bricks pass through the collider. I have tried to set the collider to a trigger and use OnTriggerEnter2D, no change. I have tried to put the rigidbody on the EndScreen object and tried to set it's body type to all 3 settings, no change. The only thing I can think of that I have not done is put the script on the EndScreen object and switch the tag to the bricks. The reason I have not done this is because I will have several types of bricks, some of which will have different tags. Please tell me somebody can see what I'm doing wrong here, because I'm losing my mind over something I feel should be ridiculously simple. Thanks.
  22. I'm working on an endless wave-based arkanoid/space invaders style hybrid. Bricks spawn above the screen and move down line by line. You must destroy all bricks before they hit the bottom of the screen. There will be multiple types of bricks and random power-up spawns. Currently I am just using a simple Log function that takes in the current wave as a parameter. This works to increase the number of bricks spawned each wave, but I want to find a way to make this much more complicated. Here is a list of everything that should be effected by the increase in difficulty: 1. Number of bricks 2. Types of bricks (1 hit bricks, 2 hit bricks, 3 hit bricks, etc.) 3. Speed that the bricks move down the screen 4. How often power-ups spawn The biggest problem here is that I can't just increase all of these with each new wave. If I did that, it would quickly become far to difficult. What I would like is an algorithm that gives some amount of variance in the increase between all 4 of these. Say one wave we put 60% of the increase to number of bricks, 20% increase to power-up spawns, 10% to types of bricks and 10% to speed of bricks. But on the next wave those percentages are all moved around and we now have say 105% to work with so the overall difficulty has increased as well. The different types of bricks need to also change to the point where if someone has made it to a certain wave, such as wave 50 for example, there are no longer any 1 hit bricks. We now would have just 2-4 hit bricks, and if they are crazy good and make it all the way to round 100, Now it's just 3-5 hit bricks, etc. If anybody has any good ideas or suggestions on this, I'd appreciate anything you've got! Thanks!
  23. Recently a long-awaited event has happen - Unity Technologies uploaded the C# source code of the game engine, available for free download on Github. The code of the engine and the editor is available. Of course, we couldn't pass up, especially since lately we've not written so many articles about checking projects on C#. Unity allows to use the provided sources only for information purposes. We'll use them exactly in these ways. Let's try out the latest version PVS-Studio 6.23 on the Unity code. Introduction Previously we've written an article about checking Unity. At that time so much C#-code was not available for the analysis: some components, libraries and examples of usage. However, the author of the article managed to find quite interesting bugs. How did Unity please us this time? I'm saying "please" and hope not to offend the authors of the project. Especially since the amount of the source Unity C#-code, presented on GitHub, is about 400 thousand lines (excluding empty) in 2058 files with the extension "cs". It's a lot, and the analyzer had a quite considerable scope. Now about the results. Before the analysis, I've slightly simplified the work, having enabled the mode of the code display according to the CWE classification for the found bugs. I've also activated the warnings suppression mechanism of the third level of certainty (Low). These settings are available in the drop-down menu of PVS-Studio in Visual Studio development environment, and in the parameters of the analyzer. Getting rid of the warnings with low certainty, I made the analysis of the Unity source code. As a result, I got 181 warnings of the first level of certainty (High) and 506 warnings of the second level of certainty (Medium). I have not studied absolutely all the warnings, because there were quite a lot of them. Developers or enthusiasts can easily conduct an in-depth analysis by testing Unity themselves. To do this, PVS-Studio provides free trial and free modes of using. Companies can also buy our product and get quick and detailed support along with the license. Judging by the fact that I immediately managed to find couple of real bugs practically in every group of warnings with one or two attempts, there are a lot of them in Unity. And yes, they are diverse. Let's review the most interesting errors. Results of the check Something's wrong with the flags PVS-Studio warning: V3001 There are identical sub-expressions 'MethodAttributes.Public' to the left and to the right of the '|' operator. SyncListStructProcessor.cs 240 MethodReference GenerateSerialization() { .... MethodDefinition serializeFunc = new MethodDefinition("SerializeItem", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.Public | // <= MethodAttributes.HideBySig, Weaver.voidType); .... } When combining enumeration flags MethodAttributes, an error was made: the Public value was used twice. Perhaps, the reason for this is the wrong code formatting. A similar bug is also made in code of the method GenerateDeserialization: V3001 There are identical sub-expressions 'MethodAttributes.Public' to the left and to the right of the '|' operator. SyncListStructProcessor.cs 309 Copy-Paste PVS-Studio warning: V3001 There are identical sub-expressions 'format == RenderTextureFormat.ARGBFloat' to the left and to the right of the '||' operator. RenderTextureEditor.cs 87 public static bool IsHDRFormat(RenderTextureFormat format) { Return (format == RenderTextureFormat.ARGBHalf || format == RenderTextureFormat.RGB111110Float || format == RenderTextureFormat.RGFloat || format == RenderTextureFormat.ARGBFloat || format == RenderTextureFormat.ARGBFloat || format == RenderTextureFormat.RFloat || format == RenderTextureFormat.RGHalf || format == RenderTextureFormat.RHalf); } I gave a piece of code, preliminary having formatted it, so the error is easily detected visually: the comparison with RenderTextureFormat.ARGBFloat is performed twice. In the original code, it looks differently: Probably, another value of enumeration RenderTextureFormat has to be used in one of two identical comparisons. Double work PVS-Studio warning: V3008 CWE-563 The 'fail' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1633, 1632. UNetWeaver.cs 1633 class Weaver { .... public static bool fail; .... static public bool IsValidTypeToGenerate(....) { .... if (....) { .... Weaver.fail = true; fail = true; return false; } return true; } .... } The true value is assigned twice to the value, as Weaver.fail and fail is one and the same static field of the Weaver class. Perhaps, there is no crucial error, but the code definitely needs attention. No options PVS-Studio warning: V3009 CWE-393 It's odd that this method always returns one and the same value of 'false'. ProjectBrowser.cs 1417 // Returns true if we should early out of OnGUI bool HandleCommandEventsForTreeView() { .... if (....) { .... if (....) return false; .... } return false; } The method always returns false. Pay attention to the comment in the beginning. A developer forgot about the result PVS-Studio warning: V3010 CWE-252 The return value of function 'Concat' is required to be utilized. AnimationRecording.cs 455 static public UndoPropertyModification[] Process(....) { .... discardedModifications.Concat(discardedRotationModifications); return discardedModifications.ToArray(); } When concatenating two arrays discardedModifications and discardedRotationModifications the author forgot to save the result. Probably a programmer assumed that the result would be expressed immediately in the array discardedModifications. But it is not so. As a result, the original array discardedModifications is returned from the method. The code needs to be corrected as follows: static public UndoPropertyModification[] Process(....) { .... return discardedModifications.Concat(discardedRotationModifications) .ToArray(); } Wrong variable was checked PVS-Studio warning: V3019 CWE-697 Possibly an incorrect variable is compared to null after type conversion using 'as' keyword. Check variables 'obj', 'newResolution'. GameViewSizesMenuItemProvider.cs 104 private static GameViewSize CastToGameViewSize(object obj) { GameViewSize newResolution = obj as GameViewSize; if (obj == null) { Debug.LogError("Incorrect input"); return null; } return newResolution; } In this method, the developers forgot to consider a situation where the variable objis not equal to null, but it will not be able to cast to the GameViewSize type. Then the variable newResolution will be set to null, and the debug output will not be made. A correct variant of code will be like this: private static GameViewSize CastToGameViewSize(object obj) { GameViewSize newResolution = obj as GameViewSize; if (newResolution == null) { Debug.LogError("Incorrect input"); } return newResolution; } Deficiency PVS-Studio warning: V3020 CWE-670 An unconditional 'return' within a loop. PolygonCollider2DEditor.cs 96 private void HandleDragAndDrop(Rect targetRect) { .... foreach (....) { .... if (....) { .... } return; } .... } The loop will execute only one iteration, after that the method terminates its work. Various scenarios are probable. For example, return must be inside the unit if, or somewhere before return, a directive continue is missing. It may well be that there is no error here, but then one should make the code more understandable. Unreachable code PVS-Studio warning: V3021 CWE-561 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains method return. This means that the second 'if' statement is senseless CustomScriptAssembly.cs 179 public bool IsCompatibleWith(....) { .... if (buildingForEditor) return IsCompatibleWithEditor(); if (buildingForEditor) buildTarget = BuildTarget.NoTarget; // Editor .... } Two identical checks, following one after another. It is clear that in case of buildingForEditor equality to the true value, the second check is meaningless, because the first method terminates its work. If the value buildingForEditor is false, neither then-brunch nor if operator will be executed. There is an erroneous construction that requires correction. Unconditional condition PVS-Studio warning: V3022 CWE-570 Expression 'index < 0 && index >= parameters.Length' is always false. AnimatorControllerPlayable.bindings.cs 287 public AnimatorControllerParameter GetParameter(int index) { AnimatorControllerParameter[] param = parameters; if (index < 0 && index >= parameters.Length) throw new IndexOutOfRangeException( "Index must be between 0 and " + parameters.Length); return param[index]; } The condition of the index check is incorrect - the result will always be false. However, in case of passing the incorrect index to the GetParameter method, the exception IndexOutOfRangeException will still be thrown when attempting to access an array element in the return block. Although, the error message will be slightly different. One has to use || in a condition instead of the operator && so that the code worked the way a developer expected: public AnimatorControllerParameter GetParameter(int index) { AnimatorControllerParameter[] param = parameters; if (index < 0 || index >= parameters.Length) throw new IndexOutOfRangeException( "Index must be between 0 and " + parameters.Length); return param[index]; } Perhaps, due to the use of the Copy-Paste method, there is another the same error in the Unity code: PVS-Studio warning: V3022 CWE-570 Expression 'index < 0 && index >= parameters.Length' is always false. Animator.bindings.cs 711 And another similar error associated with the incorrect condition of the check of the array index: PVS-Studio warning: V3022 CWE-570 Expression 'handle.valueIndex < 0 && handle.valueIndex >= list.Length' is always false. StyleSheet.cs 81 static T CheckAccess<T>(T[] list, StyleValueType type, StyleValueHandle handle) { T value = default(T); if (handle.valueType != type) { Debug.LogErrorFormat(.... ); } else if (handle.valueIndex < 0 && handle.valueIndex >= list.Length) { Debug.LogError("Accessing invalid property"); } else { value = list[handle.valueIndex]; } return value; } And in this case, a release of the IndexOutOfRangeException exception is possible.As in the previous code fragments, one has to use the operator || instead of && to fix an error. Simply strange code Two warnings are issued for the code fragment below. PVS-Studio warning: V3022 CWE-571 Expression 'bRegisterAllDefinitions || (AudioSettings.GetSpatializerPluginName() == "GVR Audio Spatializer")' is always true. AudioExtensions.cs 463 PVS-Studio warning: V3022 CWE-571 Expression 'bRegisterAllDefinitions || (AudioSettings.GetAmbisonicDecoderPluginName() == "GVR Audio Spatializer")' is always true. AudioExtensions.cs 467 // This is where we register our built-in spatializer extensions. static private void RegisterBuiltinDefinitions() { bool bRegisterAllDefinitions = true; if (!m_BuiltinDefinitionsRegistered) { if (bRegisterAllDefinitions || (AudioSettings.GetSpatializerPluginName() == "GVR Audio Spatializer")) { } if (bRegisterAllDefinitions || (AudioSettings.GetAmbisonicDecoderPluginName() == "GVR Audio Spatializer")) { } m_BuiltinDefinitionsRegistered = true; } } It looks like an incomplete method. It is unclear why it has been left as such and why developers haven't commented the useless code blocks. All, that the method does at the moment: if (!m_BuiltinDefinitionsRegistered) { m_BuiltinDefinitionsRegistered = true; } Useless method PVS-Studio warning: V3022 CWE-570 Expression 'PerceptionRemotingPlugin.GetConnectionState() != HolographicStreamerConnectionState.Disconnected' is always false. HolographicEmulationWindow.cs 171 private void Disconnect() { if (PerceptionRemotingPlugin.GetConnectionState() != HolographicStreamerConnectionState.Disconnected) PerceptionRemotingPlugin.Disconnect(); } To clarify the situation, it is necessary to look at the declaration of the methodPerceptionRemotingPlugin.GetConnectionState(): internal static HolographicStreamerConnectionState GetConnectionState() { return HolographicStreamerConnectionState.Disconnected; } Thus, calling the Disconnect() method leads to nothing. One more error relates to the same method PerceptionRemotingPlugin.GetConnectionState(): PVS-Studio warning: V3022 CWE-570 Expression 'PerceptionRemotingPlugin.GetConnectionState() == HolographicStreamerConnectionState.Connected' is always false. HolographicEmulationWindow.cs 177 private bool IsConnectedToRemoteDevice() { return PerceptionRemotingPlugin.GetConnectionState() == HolographicStreamerConnectionState.Connected; } The result of the method is equivalent to the following: private bool IsConnectedToRemoteDevice() { return false; } As we can see, among the warnings V3022 many interesting ones were found. Probably, if one spends much time, he can increase the list. But let's move on. Not on the format PVS-Studio warning: V3025 CWE-685 Incorrect format. A different number of format items is expected while calling 'Format' function. Arguments not used: index. Physics2D.bindings.cs 2823 public void SetPath(....) { if (index < 0) throw new ArgumentOutOfRangeException( String.Format("Negative path index is invalid.", index)); .... } There is no error in code, but as the saying goes, the code "smells". Probably, an earlier message was more informative, like this: "Negative path index {0} is invalid.". Then it was simplified, but developers forgot to remove the parameter index for the method Format. Of course, this is not the same as a forgotten parameter for the indicated output string specifier, i.e. the construction of the type String.Format("Negative path index {0} is invalid."). In such a case, an exception would be thrown. But in our case we also need neatness when refactoring. The code has to be fixed as follows: public void SetPath(....) { if (index < 0) throw new ArgumentOutOfRangeException( "Negative path index is invalid."); .... } Substring of the substring PVS-Studio warning: V3053 An excessive expression. Examine the substrings 'UnityEngine.' and 'UnityEngine.SetupCoroutine'. StackTrace.cs 43 static bool IsSystemStacktraceType(object name) { string casted = (string)name; return casted.StartsWith("UnityEditor.") || casted.StartsWith("UnityEngine.") || casted.StartsWith("System.") || casted.StartsWith("UnityScript.Lang.") || casted.StartsWith("Boo.Lang.") || casted.StartsWith("UnityEngine.SetupCoroutine"); } Search of the substring "UnityEngine.SetupCoroutine" in the condition is meaningless, because before that the search for "UnityEngine." is performed. Therefore, the last check should be removed or one has to clarify the correctness of substrings. Another similar error: PVS-Studio warning: V3053 An excessive expression. Examine the substrings 'Windows.dll' and 'Windows.'. AssemblyHelper.cs 84 static private bool CouldBelongToDotNetOrWindowsRuntime(string assemblyPath) { return assemblyPath.IndexOf("mscorlib.dll") != -1 || assemblyPath.IndexOf("System.") != -1 || assemblyPath.IndexOf("Windows.dll") != -1 || // <= assemblyPath.IndexOf("Microsoft.") != -1 || assemblyPath.IndexOf("Windows.") != -1 || // <= assemblyPath.IndexOf("WinRTLegacy.dll") != -1 || assemblyPath.IndexOf("platform.dll") != -1; } Size does matter PVS-Studio warning: V3063 CWE-571 A part of conditional expression is always true if it is evaluated: pageSize <= 1000. UNETInterface.cs 584 public override bool IsValid() { .... return base.IsValid() && (pageSize >= 1 || pageSize <= 1000) && totalFilters <= 10; } Condition for a check of a valid page size is erroneous. Instead of the operator ||, one has to use &&. The corrected code: public override bool IsValid() { .... return base.IsValid() && (pageSize >= 1 && pageSize <= 1000) && totalFilters <= 10; } Possible division by zero PVS-Studio warning: V3064 CWE-369 Potential division by zero. Consider inspecting denominator '(float)(width - 1)'. ClothInspector.cs 249 Texture2D GenerateColorTexture(int width) { .... for (int i = 0; i < width; i++) colors[i] = GetGradientColor(i / (float)(width - 1)); .... } The problem may occur when passing the value width = 1 into the method. In the method, it is not checked anyway. The method GenerateColorTexture is called in the code just once with the parameter 100: void OnEnable() { if (s_ColorTexture == null) s_ColorTexture = GenerateColorTexture(100); .... } So, there is no error here so far. But, just in case, in the method GenerateColorTexture the possibility of transferring incorrect width value should be provided. Paradoxical check PVS-Studio warning: V3080 CWE-476 Possible null dereference. Consider inspecting 'm_Parent'. EditorWindow.cs 449 public void ShowPopup() { if (m_Parent == null) { .... Rect r = m_Parent.borderSize.Add(....); .... } } Probably, due to a typo, the execution of such code guarantees the use of the null reference m_Parent. The corrected code: public void ShowPopup() { if (m_Parent != null) { .... Rect r = m_Parent.borderSize.Add(....); .... } } The same error occurs later in the code: PVS-Studio warning: V3080 CWE-476 Possible null dereference. Consider inspecting 'm_Parent'. EditorWindow.cs 470 internal void ShowWithMode(ShowMode mode) { if (m_Parent == null) { .... Rect r = m_Parent.borderSize.Add(....); .... } And here's another interesting bug that can lead to access by a null reference due to incorrect check: PVS-Studio warning: V3080 CWE-476 Possible null dereference. Consider inspecting 'objects'. TypeSelectionList.cs 48 public TypeSelection(string typeName, Object[] objects) { System.Diagnostics.Debug.Assert(objects != null || objects.Length >= 1); .... } It seems to me that Unity developers quite often make errors related to misuse of operators || and && in conditions. In this case, if objects has a null value, then this will lead to a check of second part of the condition (objects != null || objects.Length >= 1), which will entail the unexpected throw of an exception. The error should be corrected as follows: public TypeSelection(string typeName, Object[] objects) { System.Diagnostics.Debug.Assert(objects != null && objects.Length >= 1); .... } Early nullifying PVS-Studio warning: V3080 CWE-476 Possible null dereference. Consider inspecting 'm_RowRects'. TreeViewControlGUI.cs 272 public override void GetFirstAndLastRowVisible(....) { .... if (rowCount != m_RowRects.Count) { m_RowRects = null; throw new InvalidOperationException(string.Format("....", rowCount, m_RowRects.Count)); } .... } In this case, the exception throw (access by the null reference m_RowRects) will happen when generating the message string for another exception. Code might be fixed, for example, as follows: public override void GetFirstAndLastRowVisible(....) { .... if (rowCount != m_RowRects.Count) { var m_RowRectsCount = m_RowRects.Count; m_RowRects = null; throw new InvalidOperationException(string.Format("....", rowCount, m_RowRectsCount)); } .... } One more error when checking PVS-Studio warning: V3080 CWE-476 Possible null dereference. Consider inspecting 'additionalOptions'. MonoCrossCompile.cs 279 static void CrossCompileAOT(....) { .... if (additionalOptions != null & additionalOptions.Trim().Length > 0) arguments += additionalOptions.Trim() + ","; .... } Due to the fact that the & operator is used in a condition, the second part of the condition will always be checked, regardless of the result of the check of the first part. In case if the variable additionalOptions has the null value, the exception throw is inevitable. The error has to be corrected, by using the operator && instead of &. As we can see, among the warnings with the number V3080 there are rather insidious errors. Late check PVS-Studio warning: V3095 CWE-476 The 'element' object was used before it was verified against null. Check lines: 101, 107. StyleContext.cs 101 public override void OnBeginElementTest(VisualElement element, ....) { if (element.IsDirty(ChangeType.Styles)) { .... } if (element != null && element.styleSheets != null) { .... } .... } The variable element is used without preliminary check for null. While later in the code this check is performed. The code probably needs to be corrected as follows: public override void OnBeginElementTest(VisualElement element, ....) { if (element != null) { if (element.IsDirty(ChangeType.Styles)) { .... } if (element.styleSheets != null) { .... } } .... } In code there are 18 more errors. Let me give you a list of the first 10: V3095 CWE-476 The 'property' object was used before it was verified against null. Check lines: 5137, 5154. EditorGUI.cs 5137 V3095 CWE-476 The 'exposedPropertyTable' object was used before it was verified against null. Check lines: 152, 154. ExposedReferenceDrawer.cs 152 V3095 CWE-476 The 'rectObjs' object was used before it was verified against null. Check lines: 97, 99. RectSelection.cs 97 V3095 CWE-476 The 'm_EditorCache' object was used before it was verified against null. Check lines: 134, 140. EditorCache.cs 134 V3095 CWE-476 The 'setup' object was used before it was verified against null. Check lines: 43, 47. TreeViewExpandAnimator.cs 43 V3095 CWE-476 The 'response.job' object was used before it was verified against null. Check lines: 88, 99. AssetStoreClient.cs 88 V3095 CWE-476 The 'compilationTask' object was used before it was verified against null. Check lines: 1010, 1011. EditorCompilation.cs 1010 V3095 CWE-476 The 'm_GenericPresetLibraryInspector' object was used before it was verified against null. Check lines: 35, 36. CurvePresetLibraryInspector.cs 35 V3095 CWE-476 The 'Event.current' object was used before it was verified against null. Check lines: 574, 620. AvatarMaskInspector.cs 574 V3095 CWE-476 The 'm_GenericPresetLibraryInspector' object was used before it was verified against null. Check lines: 31, 32. ColorPresetLibraryInspector.cs 31 Wrong Equals method PVS-Studio warning: V3115 CWE-684 Passing 'null' to 'Equals' method should not result in 'NullReferenceException'. CurveEditorSelection.cs 74 public override bool Equals(object _other) { CurveSelection other = (CurveSelection)_other; return other.curveID == curveID && other.key == key && other.type == type; } Overload of the Equals method was implemented carelessly. One has to take into account the possibility of obtaining null as a parameter, as this can lead to a throw of an exception, which hasn't been considered in the calling code. In addition, the situation, when _other can't be cast to the type CurveSelection, will lead to a throw of an exception. The code has to be fixed. A good example of the implementation of Object.equals overload is given in the documentation. In the code, there are other similar errors: V3115 CWE-684 Passing 'null' to 'Equals' method should not result in 'NullReferenceException'. SpritePackerWindow.cs 40 V3115 CWE-684 Passing 'null' to 'Equals' method should not result in 'NullReferenceException'. PlatformIconField.cs 28 V3115 CWE-684 Passing 'null' to 'Equals' method should not result in 'NullReferenceException'. ShapeEditor.cs 161 V3115 CWE-684 Passing 'null' to 'Equals' method should not result in 'NullReferenceException'. ActiveEditorTrackerBindings.gen.cs 33 V3115 CWE-684 Passing 'null' to 'Equals' method should not result in 'NullReferenceException'. ProfilerFrameDataView.bindings.cs 60 Once again about the check for null inequality PVS-Studio warning: V3125 CWE-476 The 'camera' object was used after it was verified against null. Check lines: 184, 180. ARBackgroundRenderer.cs 184 protected void DisableARBackgroundRendering() { .... if (camera != null) camera.clearFlags = m_CameraClearFlags; // Command buffer camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, m_CommandBuffer); camera.RemoveCommandBuffer(CameraEvent.BeforeGBuffer, m_CommandBuffer); } When the camera variable is used the first time, it is checked for null inequality. But further along the code the developers forget to do it. The correct variant could be like this: protected void DisableARBackgroundRendering() { .... if (camera != null) { camera.clearFlags = m_CameraClearFlags; // Command buffer camera.RemoveCommandBuffer(CameraEvent.BeforeForwardOpaque, m_CommandBuffer); camera.RemoveCommandBuffer(CameraEvent.BeforeGBuffer, m_CommandBuffer); } } Another similar error: PVS-Studio warning: V3125 CWE-476 The 'item' object was used after it was verified against null. Check lines: 88, 85. TreeViewForAudioMixerGroups.cs 88 protected override Texture GetIconForItem(TreeViewItem item) { if (item != null && item.icon != null) return item.icon; if (item.id == kNoneItemID) // <= return k_AudioListenerIcon; return k_AudioGroupIcon; } An error, that in some cases leads to an access by a null link. The execution of the condition in the first block if enables the exit from the method. However, if this does not happen, then there is no guarantee that the reference item is non-zero. Here is the corrected version of the code: protected override Texture GetIconForItem(TreeViewItem item) { if (item != null) { if (item.icon != null) return item.icon; if (item.id == kNoneItemID) return k_AudioListenerIcon; } return k_AudioGroupIcon; } In the code there are 12 similar errors. Let me give you a list of the first 10: V3125 CWE-476 The 'element' object was used after it was verified against null. Check lines: 132, 107. StyleContext.cs 132 V3125 CWE-476 The 'mi.DeclaringType' object was used after it was verified against null. Check lines: 68, 49. AttributeHelper.cs 68 V3125 CWE-476 The 'label' object was used after it was verified against null. Check lines: 5016, 4999. EditorGUI.cs 5016 V3125 CWE-476 The 'Event.current' object was used after it was verified against null. Check lines: 277, 268. HostView.cs 277 V3125 CWE-476 The 'bpst' object was used after it was verified against null. Check lines: 96, 92. BuildPlayerSceneTreeView.cs 96 V3125 CWE-476 The 'state' object was used after it was verified against null. Check lines: 417, 404. EditorGUIExt.cs 417 V3125 CWE-476 The 'dock' object was used after it was verified against null. Check lines: 370, 365. WindowLayout.cs 370 V3125 CWE-476 The 'info' object was used after it was verified against null. Check lines: 234, 226. AssetStoreAssetInspector.cs 234 V3125 CWE-476 The 'platformProvider' object was used after it was verified against null. Check lines: 262, 222. CodeStrippingUtils.cs 262 V3125 CWE-476 The 'm_ControlPoints' object was used after it was verified against null. Check lines: 373, 361. EdgeControl.cs 373 The choice turned out to be small PVS-Studio warning: V3136 CWE-691 Constant expression in switch statement. HolographicEmulationWindow.cs 261 void ConnectionStateGUI() { .... HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState(); switch (connectionState) { .... } .... } The method PerceptionRemotingPlugin.GetConnectionState() is to blame here. We have already come across it when we were analyzing the warnings V3022: internal static HolographicStreamerConnectionState GetConnectionState() { return HolographicStreamerConnectionState.Disconnected; } The method will return a constant. This code is very strange. It needs to be paid attention. Conclusions I think we can stop at this point, otherwise the article will become boring and overextended. Again, I listed the errors that I just couldn't miss. Sure, the Unity code contains a big number of the erroneous and incorrect constructions, that need to be fixed. The difficulty is that many of the issued warnings are very controversial and only the author of the code is able to make the exact "diagnosis" in each case. Generally speaking about the Unity project, we can say that it is rich for errors, but taking into account the size of its code base (400 thousand lines), it's not so bad. Nevertheless, I hope that the authors will not neglect the code analysis tools to improve the quality of their product. Use PVS-Studio and I wish you bugless code!
  24. I feel like I should know this, but I tried looking it up to make sure I wasn't confusing myself, and couldn't seem to find a clear answer that made sense to me. When assigning something like this: GridSquare randomPosition; randomPosition = gridPositions[Random.Range(0,gridPositions.GetLength(0)),Random.Range(0,gridPositions.GetLength(1))]; Am I putting a copy of the GridSquare in gridPositions into the GridSquare randomPosition, or is randomPosition referencing the GridSquare at this location? If it's a copy, is there a way to reference it, like a pointer in c++, because that's what I want to do.
  25. I'm looking for people to collaborate with on a (small scoped) project of our choosing. I'm ideally looking for something that we can publish to an app store in under 6 months and then reassess the situation before deciding on next steps. I'm not terribly concerned about genre/art/2Dvs3D/platform/etc, I think it's more important to gather a group of like-minded individuals and then make those choices once we understand the skillset of the people involved. I want to treat this as a learning experience, a way to add another game to our CVs, and potentially as a way to meet people who can continue to collaborate in the future. Full Disclosure I've tried this in the past (using the similar Reddit forum) and gotten burned every time. Because of that, I want to make sure that I'm only collaborating with people who will be directly contributing to the product - art/sound/animation/development/etc. I'm not looking to work with people whose responsibilities are limited to entrepenuer/"idea man"/project management. About Me By day, I'm a Principal Software Architect at an enterprise software firm. I've been working in Software Development for around 15 years, mainly focusing on the Microsoft stack - C++, C#, .NET, WPF, databases and most recently with modern architecture (containers, Docker, REST APIs, RabbitMQ, etc etc). I have many years of Product Ownership, Project Management, and leading a dev team from an idea to a released product, so I can very comfortably "rein in" the scope of work, ensure we're driving towards an MVP, and make sure we're all on the same page about decisions we're making. By night, I'm a hobby Game Developer. I've been playing with game dev for years (like basically every person who gets into Software Dev) from DirectX 9 through XNA, GameMaker Studio, and the last 5 or so years have been in Unity3D. Feel free to browse my Github (https://github.com/natertots). I've "published" a couple very, very basic games by myself. Here's one: https://play.google.com/store/apps/details?id=com.NaterTots.Sloth . Don't get your hopes up. Being an architect by profession, I sometimes focus on spending too much time architecting the "perfect" solution to a problem. Case in point - I've spent the last couple weeks making a Data I/O layer to more easily create data objects that get serialized/deserialized generically from any of a number of locations (locally, web, save location). I have a strong programming background and feel comfortable implementing most any aspect of a game. About You A passionate contributor: art/sound/animation/development/etc. Experience level doesn't matter. I don't think we should try to enforce hours/time contribution, just as long as we're not stalling and continually making progress, even if it slows at times. Someone who's in it to learn and get better. We're not going to make the next PUBG or WoW. I don't even want to have the expectation that the focus of this project is to make money. A good communicator. I've had the best experience working with a combination of Slack and Trello. I'm in the EST time zone and will spend most of my working time around 8pm-midnight, so being available at some point during those times to chat would be a big plus. Willing to work in Unity 3D and (if a dev) program in C#. Sorry this is a narrow scope, but since I've focused so much effort on ramping up on this platform and language, I would rather not shift away from it. Note: I'm just looking for people "willing", not necessarily experienced. I look forward to working with you, Nate
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!