Jump to content
  • Advertisement

Search the Community

Showing results for tags 'C#'.



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 Dev Loadout
  • Game Dev Unchained

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

  • 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 416 results

  1. [I accept: tutorials, videos, blog posts, scripts, any help is useful] [Preferably, if you are sending scripts to help please in C#] (i already created a post in a discord server, so i'll attach the post print)
  2. Hey, so i've created a disk in unity (2D mobile) that will be shot forward if you drag it back and the further you drag it from the start point the more force will be applied to the impulse similar to the 8ball pool drag to shoot mechanic on miniclip. However, when I applied a script that allows the main camera to follow the ball it broke the mechanic since the balls position is calculated through the camera in world space. So I created a bool that locks the camera in place until the ball is released so the calculation would happen before the camera starts to move. This works however the ball now rubber bands back and forwards close to the start position. If anything needs more explaining then i'd be glad to do so. I've only been coding for about a week so you'll have to bare with me. Any help is appreciated. Thank you very much. Here's What happens: https://gyazo.com/f211e50f32ac59437a93dad7295a14be (screencap gif of the game viewer) Here is the shoot script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Shoot : MonoBehaviour { [SerializeField] GameObject Disc; [SerializeField] float multiplier; Vector3 initPos; private Rigidbody2D rb; public static bool ballIsReleased = false; bool recordingDistanceDragged = false; private void Start() { rb = gameObject.GetComponent<Rigidbody2D>(); initPos = transform.position; } void OnMouseDrag() { recordingDistanceDragged = true; if(recordingDistanceDragged == true) { transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10)); } else { transform.position = initPos; } } void OnMouseUp() { ballIsReleased = true; } private void FixedUpdate() { if(ballIsReleased == true) { rb.AddForce((initPos - transform.position) * multiplier, ForceMode2D.Impulse); Debug.Log("ball is released"); recordingDistanceDragged = false; } else { ballIsReleased = false; } } } Here is the camera follow script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraFollow : MonoBehaviour { private Vector2 velocity; public float smoothTimeY; public float smoothTimeX; public GameObject player; private void Start() { player = GameObject.FindGameObjectWithTag("Player"); } private void FixedUpdate() { if (Shoot.ballIsReleased == true) { Debug.Log("camera can move"); float posX = Mathf.SmoothDamp(transform.position.x, player.transform.position.x, ref velocity.x, smoothTimeX); float posY = Mathf.SmoothDamp(transform.position.y, player.transform.position.y, ref velocity.y, smoothTimeY); transform.position = new Vector3(posX, posY, transform.position.z); } } }
  3. Welcome everyone, this is the last video on section and end of our Terminal Hacker game. In this video we will learn to create random number. And from our next section we will create 3d game We will create CUBE RACE for our lesson.
  4. Hey peeps. It's my first post here. I'm a newbie to c# and unity so bare with me. I'm learning to code by developing a mobile game based around the french game boules. The player is meant to click on the circle on the screen, drag it back then release the ball. The ball with then be shot off in the direction of the start point with the proportionate force according to how far it was dragged. Similar to the drag and release mechanic when playing 8 ball pool on miniclip. So far I have the drag and release mechanic working but I can't seem to get the ball to fire after the ball is release. Any input would help. Thankyou. using System.Collections; using System.Collections.Generic; using UnityEngine; public class Shoot : MonoBehaviour { [SerializeField] GameObject Disc; [SerializeField] float multiplier; Vector3 initPos; private Rigidbody2D rb; private void Start() { rb = gameObject.AddComponent<Rigidbody2D>(); initPos = transform.position; } void OnMouseDrag() { transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10)); } void OnMouseUp() { Disc.GetComponent<Rigidbody2D>().AddForce ((initPos - transform.position).normalized * multiplier); } }
  5. Well, in my journey (and completion) of learning C#, I've come upon a rather peculiar problem. I don't know if it has to do with having high-functioning autism, which I do, but I seem to struggle to remember anything related to this. If I see it and am given an example I can copy and reproduce results from a simple tutorial, I can do it usually without error (if not too complex). When I attempt to write my own script, my brain completely goes white. I can't remember or figure out how to use different parts of the C# language, and it's like attempting to read Chinese when I look through Unity's Scripting API and look for other tutorials for supplemental learning. I take notes, I pay full attention to the videos and interact along with them, and I do attempt solitary practice. I just can't seem to get anything to "stick" to the point where it makes sense outside of a learning example. I can't seem to apply what I'm learning in reality, and it's becoming a great problem. Does anyone have any advice for getting this stuff to stick? I've always been a visual learner and a hands-on learner, but with logical stuff that isn't within the realms of art has always been something I've had a hard time learning and remembering later on. I appreciate any advice you can give. Thank you. EDIT: Updated on 11/11/2018 because I've been sick and busy AF with stuff outside of coding. I have been making great headway thanks to the set of tutorials made by http://rbwhitaker.wikidot.com. I was recommended this tutor by the user Septopus, and good gods has he been helpful at breaking down the stuff I didn't understand. I've been following along with the beginning C# tutorials, and will move on to MonoGame ones when I am comfortable. I cannot thank you all enough for the support and encouragement you've given. Just another sign I should keep going with this. Take care!
  6. Nilmani Gautam

    Unity3D : Refactoring the code

    In this video we will learn to create new method form the existing method If you want to learn to develop game using Unity 3D from beginning to expert then join the course on YouTube
  7. Nilmani Gautam

    Unity3D: Enumeration

    hello everyone, in this video we are going to learn enumeration, and we will also save the game state in the enumeration.
  8. I've got a state machine set up that I'm having an issue with. I have a Start scene, a Level_01 Scene, and a GameOver Scene. Each scene has a corresponding state. When the game starts, it sets the game to the Start scene. When I click the start button, it loads the Gameplay state. The game plays fine, but when you lose, the GameOver state does not load, the game continues to run, and I get one error that says the Game Manager has been destroyed and I am still trying to reference it. I have my managers set up on a Singleton pattern and I'm not sure how it's getting destroyed. This is my first time using both the state machine and the singleton, and I also have very little experience switching between scenes so I may be doing something simple wrong. The main thing I can tell you is that the currentState variable is coming back as null when I go to hit the GameOver state, and that the code is not even getting far enough to hit the OnDeactivate for the GamePlay state (probably because currentState is null). I'm really out of ideas on this one and haven't been able to find anything useful online. Hopefully someone can show me what I'm doing wrong. Thanks! //Managers object code: public class Managers : MonoBehaviour { public static Managers instance = null; private static GameManager _gameManager; public static GameManager Game { get{ return _gameManager; } } private static UIManager _uiManager; public static UIManager UI { get{ return _uiManager; } } private static LevelManager _sceneManager; public static LevelManager Level { get{ return _sceneManager; } } private static BoardManager _boardManager; public static BoardManager Board { get{ return _boardManager; } } private static PickUpManager _pickUpManager; public static PickUpManager PickUp { get{ return _pickUpManager; } } private static SoundManager _soundManager; public static SoundManager Sound { get { return _soundManager; } } void Awake () { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); _gameManager = GetComponent<GameManager>(); _uiManager = GetComponent<UIManager>(); _sceneManager = GetComponent<LevelManager>(); _boardManager = GetComponent<BoardManager>(); _pickUpManager = GetComponent<PickUpManager>(); _soundManager = GetComponent<SoundManager>(); } } //GamePlayState code, other states are basically the same public class GamePlayState : _StatesBase { public override void OnActivate () { Debug.Log("GamePlay OnActivate"); Managers.Level.LoadLevel("Level_01"); Managers.Game.isGameActive = true; } public override void OnDeactivate () { Debug.Log("GamePlay OnDeactivate"); Managers.Game.isGameActive = false; } public override void OnUpdate () { Debug.Log("GamePlay OnUpdate"); } } //GameManager code public class GameManager : MonoBehaviour { public static MonoBehaviour monoBehaviour; public bool isGameActive; private int level = 50; private _StatesBase currentState; // Use this for initialization void Awake () { isGameActive = false; InitGame(); monoBehaviour = this; } public _StatesBase State { get { return currentState;} } void InitGame () { Managers.Board.SetupScene (level); } public void SetState (System.Type newStateType) { if (currentState != null) { currentState.OnDeactivate (); } currentState = GetComponentInChildren (newStateType) as _StatesBase; if (currentState != null) { currentState.OnActivate(); } } void Update () { if (currentState != null) { currentState.OnUpdate(); } } void Start () { SetState(typeof(MainMenuState)); } } //The load level method from the LevelManager public void LoadLevel (string name) { SceneManager.LoadSceneAsync(name); Brick.breakableCount = 0; }
  9. In this Video we will create a StartGame method and simplify our code
  10. I am just getting started with c# and am trying to make player movement for unity. I am very new and can't find the error in my code. I do know that this script was working fine until I added the gun inputs if that matters.
  11. I've been looking into server hosting for the game server, and since Windows Server does cost a bit to lease and also fires up a bunch of services that I don't need at all I've been looking into Linux. The server is written in C# and previously Mono was the only realistic alternative for Linux - but it had a reputation for very bad performance in many cases. .Net Core 1.x was way too restricted feature-wise, but with .Net core 2.x the tables have turned. So last day I embarked on a mission to port my entire codebase - except for some Windows Forms test projects - into .Net Standard, and created a .Net Core console project to start the service. This turned out to be totally painless. I wasn't using any functionality that wasn't part of .Net Standard 2.x so it simply just worked. The next step was to run this on Linux. I have very little experience with Linux but Google works well for most things so I set up a Centos 7 VM in Hyper-V and went to work. The installation did take a few tries and I had to battle a few permission problems when following a guide on installing .Net Core on Centos but they weren't a big hurdle. Of course when I managed to start the program it crashes immediately, and I found some issues with path names - backslashes and case-sensitivity - when loading game data. These were also fixed pretty easily and soon the server was running. I couldn't connect to it though from the host system, but this was a simple matter of opening a port in the firewall. So far I'm already becoming a Linux fan at least when it comes to servers. Running a box without any graphical user interface is in some ways easier. Everything is a file and everything you can do can be done with a command. On Windows most things you do when managing a server consist of a complex series of clicking this and that button or file icon, filling out textfields etc. etc. and is hard to document (I'm sure you can also do most things with CMD and Powershell of course) On Linux it might take some time to research how to do even the simplest thing for a newbie such as myself, but every command needed can simply be stored in a text-file, so that I can easily set up a new server from scratch. And this file can easily be updated - and reviewed by a Linux expert for troubleshooting.
  12. In this video we are going to discuss about the if, else if and else statement, difference between update and start method and we will also determine the input from keyboard. Please visit YouTube and comment
  13. Write a program that asks the user to enter a series of non-zero integers, one at a time.The program should keep asking the user for a number until they enter a value of 0.The program should then display the largest of the numbers that have been entered.Be aware that the user could enter all negative integers and your program has to beable to handle this.What I have tried:I've been at if for a couple of hours, just decided i hit a wall and can't do it. I've been taking programming courses for 3 weeks so I have no idea if this is hard or not but it looks like I can't solve it. I know for a fact I have to use loops and I've tried making a loops that compares the last number the user inputs to the previous one and keeping the largest then repeating until all numbers have been checked. I still think that's the solution but I don't know how to write it. Thanks in advance.
  14. Well, since adopting the KV database into my server architecture I've begun to rethink many of my earlier assumptions, one of them being that I would continue developing my servers on Windows until I was past alpha stage... Since I've already brought a Linux solution into the core of the architecture, now is the best time to rewrite the servers to meet their life-long hosts. Not only that, it's a good opportunity to rethink and retouch some bits and bytes. So, using the same CentOS7 VM I'm running redis on, I'll begin the process using what appears to be a fairly polished version of Visual Studio for Linux (Visual Studio Code) https://code.visualstudio.com/ But first, because I installed from the minimal distribution.. Gonna need a Gui. yum groupinstall "GNOME Desktop" Gotta get all Microsofty with it next.. Here's the Microsoft repos to install the dotnet sdk: https://docs.microsoft.com/en-us/windows-server/administration/linux-package-repository-for-microsoft-software Got those installed and then: yum install dotnet-sdk-x.x.x To get the sdk commands to work I did have to manually install 'libunwind-devel' as the ONLY missed prerequisite in this whole process. If you know anything about installing non-standard packages on linux, that's fairly impressive. I installed VSC from Microsoft's downloadable .rpm file. It actually had a reasonable number of STANDARD package dependencies, and didn't miss any... I'm still in shock. All in all, so far, I have to say I'm quite impressed with the progress that Microsoft's cross platform tools have made in the last few years... I haven't tried to do anything like this (.net on linux) in probably 4 or 5 years, but it was fairly crap back then... That's probably another reason I was initially putting off the rewrite for Linux. Now, well, you know where I'll be.
  15. This is the first of at least two posts regarding my evaluation of the addition of an In-Memory(RAM) Key-Value Database system to my server architecture. If you're unfamiliar, check out https://en.wikipedia.org/wiki/Key-value_database, for some broad spectrum info. I'm beginning with Redis, it runs on Linux which is my scale-up server platform of choice, and this database will be the key to the scalability of my server architecture. It's also open-source and has been around for a while now. Download: https://redis.io/download Documentation: https://redis.io/documentation Installation was pretty straight forward, I created a Centos7 VM using Oracle's VirtualBox software (https://www.virtualbox.org/ one of the easiest ways to use vms locally I've used on Windows), It has been a couple years since I worked on a Linux machine, but I still managed to figure it out: So, that's a working installation. Easy as 1,2,3.. Okay, a simple benchmark,VM is using a single core and 4G of ram, and I'm using the StackExchange.Redis client from NuGet: using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using StackExchange.Redis; namespace TestRedis { class Program { static Dictionary<string, string> TestDataSet = new Dictionary<string, string>(); static ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("192.168.56.101"); static void Main(string[] args) { //Build Test Dataset Console.Write("Building Test Data Set."); int cnt = 0; for (int i = 0; i < 1000000; i++) { cnt++; TestDataSet.Add(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); if (cnt > 999) { cnt = 0; Console.Write(i.ToString() + "_"); } } Console.WriteLine("Done"); IDatabase db = redis.GetDatabase(); Stopwatch sw = new Stopwatch(); sw.Start(); //Console.WriteLine("Starting 'write' Benchmark"); //foreach (KeyValuePair<string, string> kv in TestDataSet) //{ // db.StringSet(kv.Key, kv.Value); //} Console.WriteLine("Starting Parallel 'write' Benchmark."); Parallel.ForEach(TestDataSet, td => { db.StringSet(td.Key, td.Value); }); Console.WriteLine("TIME: " + (sw.ElapsedMilliseconds / 1000).ToString()); sw.Restart(); Console.WriteLine("Testing Read Verify."); //foreach (KeyValuePair<string, string> kv in TestDataSet) //{ // if (db.StringGet(kv.Key) != kv.Value) // { // Console.WriteLine("Error Getting Value for Key: " + kv.Key); // } //} Console.WriteLine("Testing Parallel Read Verify"); Parallel.ForEach(TestDataSet, td => { if (db.StringGet(td.Key) != td.Value) { Console.WriteLine("Error Getting Value for Key: " + td.Key); } }); Console.WriteLine("TIME: " + (sw.ElapsedMilliseconds / 1000).ToString()); sw.Stop(); Console.WriteLine("Press any key.."); Console.ReadKey(); } } } Basically I'm creating a 1million record Dictionary filled with Guids(keys & values). Then testing both a standard foreach and a parallel.foreach loop to write to Redis and then read from Redis/compare to dictionary value. Result times are all in seconds. Standard foreach loop(iterating through dictionary to insert into redis): Almost 5minutes to write and another almost 5 minutes to verify.. Using the Parallel.Foreach method: and then again with 1M records already present in DB: And then with 2M records present in DB: And then with 3M: and 4M: Well, you get the picture.. So far, I think I really like Redis. And now with the async "fire and forget" set method (db write without response), on empty db: Console.WriteLine("Starting Parallel 'write' Benchmark."); Parallel.ForEach(TestDataSet, td => { //db.StringSet(td.Key, td.Value); db.StringSetAsync(td.Key, td.Value, flags: CommandFlags.FireAndForget); }); Easy enough code change. Well, that's pretty fancy. 1 Million records added in under 10 seconds, and not a single error.. So, even though I think this is my winning candidate, I should at least perform the same benchmarks on NCache to see if it somehow blows Redis out of the water. So, keep posted, as NCache will be my next victim. It may be somewhat unfair though since I'll be installing NCache on my Windows machine directly and Redis was sequestered into a tiny vm with very limited resources, so if I need to(if NCache is ridiculously faster ootb) I'll be re-running these benchmarks again on a bigger VM. A few more benchmark results(11/1/18): I've repeated the final "fire and forget" with a couple bigger data sets. Same VM, so 1 single core, and 4G ram. 2 Million Records: This shows the top output snapped somewhere in the middle of the "write" test. This shows the benchmark output, the Redis cli console, and top for the Redis server. Post benchmark. Now 10Million Records: Redis Server Top output somewhere in the middle of the "write" test. We're hitting that single core ceiling here, but it's trucking along anyhow. Here's a snap from somewhere in the middle of the read/verify test. Working hard, but not taxing that single core. Up to 2G of ram now, 10m records.. not too bad. And the completed test. Frankly, I'm impressed. It pegged the single core for a fraction of that 83 seconds, but it didn't lose a single record in the process. And the final test result: a 1million record write, with 10million records already in the DB. Boom, still no errors. So, let us really break it good. I rewrote the benchmark script to Parallel.Foreach through 10 individual 1million record benchmark tests. Roughly simulating separate concurrent clients to the Redis server. And here is where we start finding limits in (this) installation/configuration. So, it got to about 3Million records inserted from 6 different connections before the load on the server caused the additional connections to time out(more or less). Okay, lets try it with 6 connections. hmm, I have 6 servers.. hmm. Mid write, good to go. Mid read/verify, good to go. And would you look at that, no exceptions, no read errors.
  16. Okay, I'm not going to go into as much depth with this evaluation simply because I don't feel like I need to. I'll provide the simple benchmark script(same as last one,just modified to use NCache instead) at the end. NCache installed easy enough, but I had to update my powershell to use it(still hacking on Win7 for now) since I decided not to use their 60 day full GUI interface... Overall it's very much similar to the setup/install experience of Redis, only the windows version of it, with the usual windows type quirks...;) The test environment is different though, NCache is running as a local service on my development machine, meaning it has full access to all 24G ram and 8 cores on my machine where-as Redis was running in a Linux VM on my machine with only 1 core and 4G of ram... Now on to the results, initial test, 1Million writes/reads in a standard foreach through the dataset: Just slightly better than Redis.. And then the Parallel.ForEach test: ...Slower...hmm And then I tried the NCache InsertAsync method inside a Parallel.ForEach method(this one Redis finished writing in under 10 seconds): Granted, there were 1million records in the db when I started that test. So, I cleared them out and ran the test again, 88 seconds for write time, and 107 seconds for read/verify... Memory Usage!! Redis I think topped out somewhere in the 500mb range, with multiple millions of records in the db. NCache has been using between 1.5G and 2G+ consistently with only 1M records in the db & over 2.5G with 2million. So, I ran a total of 4 tests against NCache and cleared the db 2 times, by the end of my testing the NCache service is sitting on 3.2G of memory, with 1million records in the db. I'm not going to get too into the configuration either, I'm sure there are options that could be tuned and whatnot.. I love simplicity, I love out of the box performance, I love friendly and efficient use of memory, and so far Redis is pretty far ahead in all 3 categories. So, what's next? Well, I need to do just a little more research and configuration testing on Redis to make sure it will hold up the way I would need it to, then I start coding again.. I may look into a distributed messaging solution like ZeroMQ as a possible augment, or alternative to the KV db as well. Still got some gears to turn here and there. Test Script: using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Alachisoft.NCache.Web.Caching; namespace TestCache { class Program { static Dictionary<string, string> TestDataSet = new Dictionary<string, string>(); //static ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("192.168.56.101"); static Stopwatch sw = new Stopwatch(); static void Main(string[] args) { //Build Test Dataset Console.Write("Building Test Data Set."); int cnt = 0; for (int i = 0; i < 1000000; i++) { cnt++; TestDataSet.Add(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); if (cnt > 999) { cnt = 0; Console.Write(i.ToString() + "_"); } } Console.WriteLine("Done"); string cacheID = "uwNCacheTest"; Cache csh = NCache.InitializeCache(cacheID); sw.Start(); //Console.WriteLine("Starting 'write' Benchmark"); //foreach (KeyValuePair<string, string> kv in TestDataSet) // { // csh.Insert(kv.Key, kv.Value); //} Console.WriteLine("Starting Async Parallel 'write' Benchmark."); Parallel.ForEach(TestDataSet, td => { //db.StringSet(td.Key, td.Value); // db.StringSetAsync(td.Key, td.Value, flags: CommandFlags.FireAndForget); //csh.Insert(td.Key, td.Value); csh.InsertAsync(td.Key, new CacheItem(td.Value), DSWriteOption.None, null); }); Console.WriteLine("TIME: " + (sw.ElapsedMilliseconds / 1000).ToString()); sw.Restart(); //Console.WriteLine("Testing Read Verify."); //foreach (KeyValuePair<string, string> kv in TestDataSet) //{ // if (csh.Get(kv.Key) as string != kv.Value) // { // Console.WriteLine("Error Getting Value for Key: " + kv.Key); // } //} Console.WriteLine("Testing Parallel Read Verify"); Parallel.ForEach(TestDataSet, td => { //if (db.StringGet(td.Key) != td.Value) if (csh.Get(td.Key) as string != td.Value) { Console.WriteLine("Error Getting Value for Key: " + td.Key); } }); Console.WriteLine("TIME: " + (sw.ElapsedMilliseconds / 1000).ToString()); sw.Stop(); Console.WriteLine("Press any key.."); Console.ReadKey(); } } }
  17. Welcome to new section on Complete Game Development Course Using Unity3D. In this lecture we will discuss about about our new game. We will import assets WM2000 (word master 2000) and write code for terminal. See the differences of Debug.Log and Terminal.WriteLine. Please visit YouTube watch video and suggest for improvement.
  18. Hello guys. I am making a code for this game for a class task. so far I wrote some of it, and I need to write few things, who honestly I really don't know how to write them 😅. I was wonder if it is possible to somehow randomly choose a question, I mean I organized the question by levels so each level has 3 options and I want that the program will randomly select a question between the 3, do you guys think it is possible? And second thing, I need to write an help for the user, like if he wants he can choose that 2 answers out of the 4 will be gone so only 2 answers will left for him to choose, any ideas about how to make that? Thank's guys for all of your help, and sorry for my bad English.
  19. I'm attempting to implement my first state machine and I'm running into a problem with unloading the main menu and loading the game scene. I'm kind of learning this as I go and I'm basing it off of a really solid example I have to go off of, but I'm apparently missing something because I'm getting a Null Reference Exception. I'll post the exception and code below. Hopefully someone will see my mistake. Thanks! public class StartButton : MonoBehaviour { public void OnClickStartPlay () //This script is attached to my Start Button in the Main Menu scene { Managers.Game.SetState(typeof(GamePlayState)); } } //This is the script for my MainMenuState public class MainMenuState : _StatesBase { public override void OnActivate () { SceneManager.LoadScene("Start"); } public override void OnDeactivate () { SceneManager.UnloadSceneAsync("Start"); } public override void OnUpdate () { } } //This is the code for my GamePlayState public class GamePlayState : _StatesBase { public override void OnActivate () { SceneManager.LoadScene("Level_01"); } public override void OnDeactivate () { SceneManager.UnloadSceneAsync("Level_01"); } public override void OnUpdate () { } }
  20. I'm attempting to rework some code that I wrote early on and I'm not the best at math, so what I ended up doing to avoid figuring out a math problem that puzzled me for several days was as follows: Problem: figure out how to get the correct angle of the players direction of travel relative to the "north pole" on my 3d planet... for generating a stinking simple compass display. Honestly, I think I spent almost a full week trying to get this to work.. I looked up nearly every math heavy google result I could to try and make it work but I just couldn't wrap my head around enough of it to get it going without some trickery. So, even though I've learned a LOT since then, I really don't want to spend hours and hours trying to look up the same problem that I really wasn't effective at solving on my own the first time.. haha My Trickery: 1) I was having trouble figuring out how to implement the correct math for half of the problem(maybe the only real math part...). So, instead, I created a child object of the player character and gave it this code: (the code was not actually doing anything at all, so I've removed it..., see below example where the gymbal object rotation is set, the code here was doing similarly).. My goal, and the effect, was to define a constant source of angle information so I didn't have to do the math. It works, quite effectively.. I just feel like there's a much much much easier(more efficient) way to do it that I can't sort out (mathematically IN c#)... 2) the second part of the trickery is using the data from the "gymbal" object instead of calculating the math directly. //Code to determine player direction of travel NSEW, on a spheroid planet. Vector3 point2origin = transform.position - planet.transform.position; //origin is center of planet Vector3 point2closestPointOnLine = point2origin - Vector3.Dot(point2origin, planet.transform.up) * planet.transform.up; //(playerGymbal) == Generic game object parented to player character object(keeps it moving with the pc). playerGymbal.transform.rotation = Quaternion.FromToRotation(-transform.up, point2closestPointOnLine) * transform.rotation; //Here's the number I actually need. float angle = SignedAngle(playerGymbal.transform.forward, planet.transform.up, playerGymbal.transform.position); String nsew = ""; if (angle < -5 && angle > -85) {nsew = "SE";} if (angle <= 5 && angle >= -5) {nsew = "S";} if (angle > 5 && angle < 85) {nsew = "SW";} if (angle >= 85 && angle <= 95) {nsew = "W";} if (angle > 95 && angle < 175) {nsew = "NW";} if (angle >= 175 || angle <= -175) {nsew = "N";} if (angle > -175 && angle < -95) {nsew = "NE";} if (angle >= -95 && angle <= -85) {nsew = "E";} Dir.text = nsew; So, ignoring the pile of ifs and I'm sure a few other nasty code smells, does anybody see my solution clearly? I just want to simplify this process and get rid of the extra gymbal object and its Update loop. If I wasn't worried about optimization, or could use it as a helpful visual aid, I would just keep it because I think I clevered my way out of that problem pretty creatively.. But nope, it's just an invisible object using resources.. Anyhow, thanks for checking it out, any help would be greatly appreciated! To summarize, I've got: Planet's position in 3d space. Player's position/rotation in 3d space. North Pole's position in 3d space. How do I calculate the resulting angles as above(or similar), simply, without all the extra trickery? An important point: The player character's "gymbal" object, always points towards the line running from the north pole to the south pole, and it rotates relative to the player's rotation, so that's how the extra object saved me from figuring out the math... I failed to mention that anywhere above.. sorry.
  21. I am developing a 3D interactive mobile Game in Unity3d and am trying to implement a first person camera controller. I have done much research into first person camera controllers, but I can't seem to find the ideal set up. I am trying to develop a first person camera controller that can be used on touch devices. The inputs from the user would have to come from the user swiping, pinching etc rather than using a UI joystick. I have seen first person camera controllers that make use of UI joysticks but this isn't what I am looking for. - First person camera controller - touch device friendly - responds to gestures from user such as swiping and pinching. I am unsure what to do right now???
  22. Hi everyone. I am programmer from Ukraine. I am not designer , but I want to draw cool art and make cool games. I learning. I walked the long road from zero to publicating game in store. So, I want to tell you about my game. I hope you enjoy my game and you will write feedback in Store or here (In store will be better 😉 ). Thanks everyone who will play my game. Genre: Arcade/Runner Platform: Android (4.1 and higher) Description: Do you think what these stairs is easy ? No! Every stair want to kill you. One wrong move and you begin from start. You should be careful. Try to find good tactic and look a both ! Be careful ! Stairs are anywhere ! Do you want to be a King of Stairs ? It will not easy. Android - https://play.google.com/store/apps/details?id=com.nazariyoliynyk.dangerousstairs
  23. I'm working on some collision game, I have 2 prefabs 1 is player and other is Guard But when I instantiate Guard prefab 2 times and they collide with each other nothing happens. But when they collide with the player it works completely fine. I'm using Tags for the Detection. Here's my code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class GuardCollision : MonoBehaviour { public Vector3 spawnValue; void OnCollisionEnter (Collision collider){ if (collider.gameObject.CompareTag ("Guard")) { Debug.Log ("It's a guard"); } else if (collider.gameObject.CompareTag ("Player")) { Debug.Log ("It's a Player"); } } }
  24. Hello and welcome everyone. Again I am uploading another video on Complete Game development Tutorial Using Unity3d. And In this video we are going to calculate our actual guess form guess variable.. Please comment on video for improvement and subscribe if you want to see the complete tutorial. I will upload video frequently on week
  25. Our project is a scifi game that takes place 50 years in the future, as humanity takes its first steps onto the galactic stage. We currently have progress in the Meta-game and Space Combat areas and are looking to expand our programmer team to fill out some other areas. Gameplay Programmer If you're interested in infantry and vehicle combat. As well as tactics and strategy. Planetary Programmer If you're interested in procedural planets, floating origins, double precision coordinate systems, and relative scientific accuracy. Volumetric Programmer If you're interested in gorgeous volumetric effects for engine trails, planetary accretion disks, and more. If one or more of these positions interest you feel free to contact me on discord at mushroomblue#0384
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!