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 436 results

  1. Hello... This is my version of the Chapter 18 CLASS exercise about throwing and popping a bunch of balls. : NOTES : Random() For the most part as I worked through the exercise things became clear but I am still confused about "scope" or w/e it is called that determines when a variable is available to be read by other sections of the code. I wanted to use Random(); to build random numbers on the fly, but it seemed that I was either calling the random very quickly in succession, so all the results were identical, or I wasn't able to access the random object I created when I wanted to. I got around this problem by creating a custom random class called RAN. This initiated Random() during the creation of the class in the main program.. so that only happened once. Then it had functions to produce the random numbers I wanted, in the type I wanted. Also I found the code to be really ugly and hard to read if I just used Random(). I was using Bytes for my 0-255 colour codes.. and as far as I know Random() is returning only floats.. so every time I had to use Random() object I had to use Convert()... this lead to it being a mess. So I build into the RAN class in a way to choose the types for me to clean this up a little. This is only using Random() to for loop 5-50 times and make a list of balls with a size of 1-25 Random rand = new Random(); List<Ball> balls = new List<Ball>(); for (int i = 0; i < Convert.ToInt32(rand.Next(5, 50)); i++) { balls.Add(new Ball(Convert.ToInt32(rand.Next(1, 25)))); } The Colour class that was using bytes was even worse. balls[1].colour.red = Convert.ToByte(rand.Next(1, 255)); balls[1].colour.green = Convert.ToByte(rand.Next(1, 255)); balls[1].colour.blue = Convert.ToByte(rand.Next(1, 255)); And the BALL class was every worse worse!! Ball ball = new Ball(Convert.ToByte(rand.Next(1, 255)), Convert.ToByte(rand.Next(1, 255)), Convert.ToByte(rand.Next(1, 255)), Convert.ToInt32(rand.Next(1, 25)); I found it really strange that using Random() to get specific types would cause such ugly and bloated looking code. So I ended up making my own Random Class called Ran(). This would change the above code to.... Ran Ran = new Ran(); List<Ball> balls = new List<Ball>(); for (int i = 0; i < Ran.Int(5, 50); i++) { balls.Add(new Ball(Ran.Int(1, 25))); } balls[1].colour.red = Ran.Byte(); balls[1].colour.green = Ran.Byte(); balls[1].colour.blue = Ran.Byte(); Ball ball = new Ball(Ran.Byte(), Ran.Byte(), Ran.Byte(), Ran.Int(1, 25)); Which seems to me to be a zillion times easier to read. I has occurred to me now, while writing these notes on the lesson that I probably should have put the conversions into the BALL and COLOUR class themselves.. so it always takes a float in the constructor but stores it as a Byte.. or something like that.. but even doing that would change all the stuff like so.... Ran.Byte() -> random.Next(0,255) Ran.Int(1,25) -> ranomd.Next(1,25) I dunno.. even this looks worse than my custom thing I guess... it seems that there is something I may be missing here... as it seems ugly and hard to write. Maybe there is a better way to handle conversions instead of Convert.ToInt32 or w/e : NOTES : Code Comments I really need to start looking into making proper notes into my code. There should be a way using the ///sumemry type stuff to add ways to have VS use intense to show me what the members are expecting as I go. I will make a effort to comment more in my next one, but thought I would level this entire project with no comments.. just to see how little I understand it when I next look at it. C# Players Guide dose cover comments but after reading it a few times it is still confusing.. I need to source google page on this before next time. - THING TO DO. : NOTES : Possible Error I think there is a error in the main program, not a fatal one.. but I believe now I am going though it for my notes that I should have used <= instead of < for the for loops. As I am counting from 1 and not from 0. I will not bother fixing this.. but it is something to keep in mind. The 0 start in the Arrays and Lists is a little hard to remember. I think it is not an error though as I am using +1 in the readouts... but I am done for now and will not be checking or changing anything lol. It is time to move on. : CODE : Ball Class Colour Class Program Custom Random Class Exit Program Class : EXAMPLE OUTPUT : Well, see ya next time!
  2. Hi everybody ! We are an indie startup called Darkstar Games ! We are just creating our first game called Greater powers, a novel type medieval fantasy TCG MMORPG with which we use unity. We develop our games for Android, PC, iOS, and we have a software kit developer contract with Microsoft to adapt them to VR Microsoft HoloLens and VR Magic Leap in the future. We are developing our own alpha for the Kickstarter campaign at the moment ! So we are actively searching for motivated programmers willing to take place in our project to build the engine we are creating of our own right now ! The game is coded in C# and any unity experience is greatly appreciated! We collaborate to the startup worldwide remotely ! Programmers collaborating to the project such as building the alpha become shareholders and are hired in the start-up launch ! Here are some links about the project: https://www.artstation.com/floriangionnane https://www.facebook.com/DarkstarGamesCorp https://connect.unity.com/p/games-greater-powers If anyone interested, please send your resume to flosambora123@gmail.com Have a nice day !
  3. 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 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. OTHER OPEN POSITIONS 3D Environment Modeller Website Manager 3D Character Modeller REVENUE - SHARE The project is marching increasingly closer to be ready for our crowd-funding campaign. Being an Indie team we do not have the creative restrictions often imposed by publishers or other third parties. We are extremely conscientious of our work and continuously uphold a high level of quality throughout our project. 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
  4. hello guys, i'm new in unity and i wanna make a ricing game , but i don't know how to start. The script of racing games in youtube is very bad how i wanna a better script but i don't know how and where to start , is any one here can help me ?
  5. Hey Developers! If you already played No Man's Sky, you probally visited another planet, but the planets are a sphere (obviously duh) but when you are entering the atmosphere of the planet, the "curved terrain" turns into a flat terrain with moutains, etc... I'm creating a space travel system, and i want to simulate this "effect" but i don't have any idea how to do that idk if is a camera trick, a illusion etc... Help Me guys!
  6. You want to create custom meshes for your Unity3D UI, but you found the documentation lacking? In this article, I will describe How to implement a bare-essentials custom Unity UI mesh Point out all the pitfalls that leave you looking at invisible or non-existent meshes TL;DR To implement your own UI mesh, derive from MaskableGraphic and implement OnPopulateMesh(). Don’t forget to call SetVerticesDirty/SetMaterialDirty upon changes to texture or other editor-settable properties that influence your UI-elements and should trigger a re-rendering. Don’t forget to set the UIVertex’s color, otherwise, you won’t see anything due to alpha=0, i.e. full transparency. You can look at the full, minimal code example, here. Of Rendering Mini Maps Inside Unity UI My use case was simple: I wanted to create level previews for my current puzzle game project Puzzle Pelago, and I wanted to try making a simple tiling system based on a custom UI mesh. The requirements I was eyeing was that it should behave like all the other UI elements in unity, i.e. it should fit inside its RectTransform, it should work inside a masked ScrollView, and it should respond to disabled state tinting since it would be living inside of a button. What I ended up with looks something like this: The path there was not that bad, but still frustrating at times since all I found online was forum posts and Unity's own source code to go off of. So here I want to build a simplified example in which we will render a grid of textured quads inside a UI element, using one script. This should take all the hurdles for building any kind of (flat, 2d) UI geometry you might want to build. Unity Scene Setup Alright, let’s set up the scene as follows: Open the Unity project and Scene you want to work in. If there is no Canvas in the scene yet, create one! For this tutorial, I left all the properties at default. Inside the Canvas, create a ScrollView - we will want to check that our new UI component works inside of that! Inside the ScrollView > Viewport > Content, create new empty game object - let’s call it MyUiElement Add a CanvasRenderer component to the new game object, and then add new script: MyUiElement Open the new script in your favourite c# editor (I love Rider btw.), and go back to Unity’s scene. To make our lives easier, we will want to set the Scene View’s render mode to “Shaded Wireframe” so we can see our UI mesh geometry in detail. Also, it is useful to switch to the 2D view perspective, select our “MyUiElement” object and press F, so unity zooms in just right. Implementing the Custom Unity UI Mesh Script in C# Now we can go ahead and implement our new C# script! First off, our new script needs to at least derive from Graphic . But, if masking inside of ScrollViews, for example, needs to work, we better derive from MaskableGraphic. Otherwise, our graphics will render outside of the mask, too. Lol. Also, we want to be able to set the size of the grid cells in the editor, so we should add a public field for that. public class MyUiElement : MaskableGraphic { public float GridCellSize = 40f; Next, we want to be able to use a texture for our UI elements. Looking at Unity’s own implementation, e.g. that of the Graphic (source code) base class or the default Image (source code) UI element, we can see that a common pattern is to … … define Texture/Material slots as properties, such that when the texture is changed in the inspector, we can trigger Unity UI to re-render even while in edit mode. This is done by calling SetMaterialDirty() and SetVerticesDirty(). … implement mainTexture as a default overridden property such that if no texture is provided, we return the default white texture. [SerializeField] Texture m_Texture; // make it such that unity will trigger our ui element to redraw whenever we change the texture in the inspector public Texture texture { get { return m_Texture; } set { if (m_Texture == value) return; m_Texture = value; SetVerticesDirty(); SetMaterialDirty(); } } public override Texture mainTexture { get { return m_Texture == null ? s_WhiteTexture : m_Texture; } } Next, we have to override OnPopulateMesh() to do our rendering. It takes a useful little helper object for building meshes, the VertexHelper , as its argument. It tracks the vertex indices for you, and lets you add vertices, uvs and tris without having to do lots of array arithmetic and index tracking. It must be Clear()’ed before building a new mesh. I found it useful (and you may, too) to use a little quad-making helper function, AddQuad(): // helper to easily create quads for our ui mesh. You could make any triangle-based geometry other than quads, too! void AddQuad(VertexHelper vh, Vector2 corner1, Vector2 corner2, Vector2 uvCorner1, Vector2 uvCorner2) { var i = vh.currentVertCount; UIVertex vert = new UIVertex(); vert.color = this.color; // Do not forget to set this, otherwise vert.position = corner1; vert.uv0 = uvCorner1; vh.AddVert(vert); vert.position = new Vector2(corner2.x, corner1.y); vert.uv0 = new Vector2(uvCorner2.x, uvCorner1.y); vh.AddVert(vert); vert.position = corner2; vert.uv0 = uvCorner2; vh.AddVert(vert); vert.position = new Vector2(corner1.x, corner2.y); vert.uv0 = new Vector2(uvCorner1.x, uvCorner2.y); vh.AddVert(vert); vh.AddTriangle(i+0,i+2,i+1); vh.AddTriangle(i+3,i+2,i+0); } // actually update our mesh protected override void OnPopulateMesh(VertexHelper vh) { // Let's make sure we don't enter infinite loops if (GridCellSize <= 0) { GridCellSize = 1f; Debug.LogWarning("GridCellSize must be positive number. Setting to 1 to avoid problems."); } // Clear vertex helper to reset vertices, indices etc. vh.Clear(); // Bottom left corner of the full RectTransform of our UI element var bottomLeftCorner = new Vector2(0,0) - rectTransform.pivot; bottomLeftCorner.x *= rectTransform.rect.width; bottomLeftCorner.y *= rectTransform.rect.height; // Place as many square grid tiles as fit inside our UI RectTransform, at any given GridCellSize for (float x = 0; x < rectTransform.rect.width-GridCellSize; x += GridCellSize) { for (float y = 0; y < rectTransform.rect.height-GridCellSize; y += GridCellSize) { AddQuad(vh, bottomLeftCorner + x*Vector2.right + y*Vector2.up, bottomLeftCorner + (x+GridCellSize)*Vector2.right + (y+GridCellSize)*Vector2.up, Vector2.zero, Vector2.one); // UVs } } Debug.Log("Mesh was redrawn!"); } Note that in the AddQuad() function, we set position, uv, and color! Since in the UI material, texture is multiplied with the color by default. Leaving this at default, i.e. (r=0,g=0,b=0,a=0), this will yield 100% transparent material. So all you see is nothing, and if you are wondering why, this might be it. Here we use the component’s inherited color slot. Since we want our grid to update whenever the RectTransform is resized, we should also override OnRectTransformDimensionsChange(): protected override void OnRectTransformDimensionsChange() { base.OnRectTransformDimensionsChange(); SetVerticesDirty(); SetMaterialDirty(); } This should do. Now, back to our Unity scene, we should see a grid of white squares inside our RectTransform. To change this, we can select one of unity’s default textures in our texture slot. Adjusting the size of the RectTransform or the value of our Grid Cell Size, we can see that the grid updates automatically. Going into play mode, we should also be able to drag around the scroll view’s contents and have the grid be masked correctly. CONCLUSION You can have a look at the full code example, here . Of course, we are not limited to rendering quads, either, since the basic geometry we created here consist of triangles. So any 2D mesh should be possible to draw, and in principle, it could be animated, too! Anyway, if anything in my writeup is unclear, don’t hesitate to ask questions in the comments or via Twitter, @hallgrimgames. Good luck with your project! Note: This article was originally published on the Hallgrim Games blog, and is republished here with the kind permission of the author Christopher.
  7. Hi there I'm working on a simple racing game at the moment that I like to pitch as Thumper vs. Burnout vs. Journey. In a nutshell it's a single player experience where the player races across a city in the dead of night with a time limit of one hour. The main mechanic being that driving well earns the ability to go faster, making things more challenging and opening up shortcuts and alternative routes, while mistakes (colliding with walls for example) make the player loses their highest speed and have to re-earn it. I have a grand vision for an a pounding, dynamic sound track with elements being added to the music as the player goes faster and I'm looking for someone to collaborate with on the audio effects. Here is a video of the early direction and feel of the project (it's moved on since, but this still gives a sense of the style): Contact me if you're interested in the opportunity to work on an interesting unique soundscape with me. Kind regards, Jamie
  8. So right now I am trying to figure out what my options are for building a game that at least will have a similar sandbox block presentation style that games like Terraria, Starbound, It Lurks Below, etc. have.The core parts that I am looking to achieve that related to the world are:- Relatively large map size (for example, I would like to support a map size that is the largest that Starbound has which I believe is 18 million blocks being 6000 x 3000)- Multiple layers of blocks (layer for the background, main world, vegetation, etc.)- Certain layers will support colliders, other won't (like the background really would not need a collider)- Dynamic lighting (similar to games mentioned above)- Falling blocks (like how sand works in Starbound)- 2D fluids (again similar to how it works in Starbound)- Dynamically growing blocks (like how vines can grow in Starbound)Currently I am prototyping with https://assetstore.unity.com/packages/templates/systems/terrain-engine-2d-115381 which is a promising solution and really the only asset I can find geared towards this exact style of game presentation however I want to have a fallback option in case for whatever reason I find that asset doesn't work in the end (at a minimum it will allow me to prototype a number of things quickly which is worth the price right there).If I find the asset above is not viable for everything I am going to want to do for the complete game, I don't mind having to some of the heavy lifting for the world management however there are 2 high level things that I do want any solution to provide:- manage the renderer of the blocks / tiles to the screen (I am fine managing the underlying "grid" of data the represents that world if needed)- manage the generation of the colliders dynamically (so when blocks are added / removed, the colliders are automatically updated)I think the rest of the things I would need to do I would be able to figure out is a reasonable time / am interested enough in them that researching them would not seem like too much of a chore (while I know developing a game as a solo developer I am going to have to do stuff that I don't necessarily find exciting / engaging but with this being a personal side project at the moment, I need to be able to limit that if I am going to finish this).Two options I can think of are:- Using a different tilemap solution: For example I have the Super Tilemap Editor asset that I used for a number of top down prototypes however most other tilemap assets seem to be geared towards top down (or at least that is what I see demo of for them), not sure if they would work for this kind of game.- Use Unity built-in tilemap solution as a base: Never used this so not sure how feasible it would be in using this as a based for my worlds in this kind of game.I would like to get people opinions of the above 2 options (maybe there is a different assets that I missed) or if people think I need a completely custom solution, I would like to hear the thoughts on why, thanks.
  9. Nilmani Gautam

    Cube Race : Unity 3D

  10. In this video we will add rigidbody and collider to our player.
  11. FusionCL.Net is a new wrapper around OpenCL for C#(4.7.2) - The git is online, and it is working. It's not 100% complete but you can create programs, run kernels, create membuffers and read/write them. It works fine for me on a Nvidia 1060. There are two projects on the git repo. FusionCLNative.dll - this is a C++ wrapper around opencl, you do not need to use this. FusionCL.Net - This is a C# set of classes(Namespace:FusionCL) that internally uses the native dll to create and use the OpenCL library. Like i said, not 100% complete, but it is working and usable. Only a small amount of code really, but it works well and I think is very easy to use. - So, yeah just a head's up. Free for anyone, please let me know if you run into any issues or have any requests for future commits. Cheers! https://github.com/AntDevUnity/FusionCL.NET
  12. DabbingTree

    Join my Ludum Dare team!

    I am joining a team for Ludum Dare 43, and I need a designer and an artist. We will use Unity3D for the game engine. https://crowdforge.io/jams/ludumdare/teams/2621
  13. After coming up with the name Fusion for the ide, I decided to refactor the whole project to be called Fusion. So instead of vividengine, it's fusion engine. instead of vividscript, it's fusion script. Not just names, but major refactoring of class names etc. As for the newly titled fusionscript, I am half way through a complete rewrite of the parser. Also it now has reverse polish expressions, meaning they finally work like any other language.
  14. A new entry in the devlog for 13 Ronin, a retro 2d samurai fighting game, this time it's about implementing the logic for the computer player. Happy coding! https://www.eraserheadstudio.com
  15. ERASERHEAD STUDIO

    13 RONIN - DevLog #7 - Fight or flight!

    Since I had no previous experience of coding a computer player I turned to our friend google for advice. I found a number of threads on the subject, some talked about AI, but most of them talked about reaction based solutions, but since I’m not interested in AI and rather want to mimic the feeling found in old-school fighting games I decided to go for the reaction based solution. And when I use the phrase “reaction based”, I’m referring to an implementation that selects action-based on one or several conditions e.g. if the opponent hit then block. Feeling a bit over-confident, I stopped reading and headed over to Visual Studio just to realize that this was not as easy as I had thought. Soon I had a bunch of if-statement and a code hard to follow. I refactored the code, but still I wasn’t pleased Along came Halloween and at my workplace, we had an amazing party (I was dressed as the Invisible Man). After dinner, I chatted with a colleague and talking about the computer player he asked if I was using a decision-tree for action selection. Decision trees? What’s this, yet another gap of knowledge. The name itself told me that this was something I had to read up on. So, the day after, still recovering from the party, I started reading. And oh yes, this was what I’ve been looking for. (Thanks Mikael for the suggestion) Decision trees The full definition is somewhat longer, but simplified, a decision tree is a tree structure describing conditions and results. Every node is a condition deciding upon which branch to follow until reaching the leaf and the result of the path taken. This was exactly the kind of data structure I needed to find a structure around the computer player logic Using a fluent builder I could put all conditions in a tree and let the leaves contain what actions to perform. Decision tree for the computer player. DecisionTreeNode My implementation of the decision tree is very basic, it consists of a DecisionTreeNode-class that I use for the tree as well as for the nodes and the leaves. The Condition-property is only applicable to condition nodes. It’s a delegate that when called will evaluate what child node to step into. It returns the name of the child to step into. The Result-property is only applicable to leaves. It’s a delegate with actions associated to the leaf. The GamePlayState-class contains all data needed when deciding computer action. DecisionTreeBuilder I’m quite fond of fluent coding so when building the DecisionTreeBuilder it was a natural pattern to choose. Using this pattern makes classes easy to use and code easy to read. This is how I build the decision tree var decisionTree = DecisionTreeBuilder .Begin( "Reacting", state => state.Player.IsReacting() ? "Elapsed" : "Opp new action") .AddNode( "Elapsed", state => state.Player.IsTimeToReact(state.GameTime.TotalGameTime) ? "Facing" : "Done 1") .AddNode( "Facing", state => { return state.Player.IsFacingOpponent() ? "Reachable 1" : "Reachable 2"; }) .AddNode( "Reachable 1", state => state.Player.IsWithinReach(state.Opponent) ? "Opp attacking" : "Opp approaching") .AddNode( "Opp attacking", state => state.Player.ActionToReactUpon is AttackAction ? "Defend" : "Attack 1") .AddLeaf( "Defend", state => { state.Player.ResetReaction(); state.Player.ParryHeadCut(); }) .AddLeaf( "Attack 1", state => { state.Player.ResetReaction(); state.Player.HeadCut(); }) .Parent() .AddNode( "Opp approaching", state => state.Opponent.IsAdvancing() && state.Opponent.IsFacingOpponent() ? "Idle 1" : "Advance 1") . . . .Build(); AddNode will create and append a new node to the current nodes’ children and then go into the newly created node and make it current. AddLeaf will create and append a new leaf, but not go into it. Parent will go to the parent node and make it current. Build will return the newly composed tree. The choice to use strings for names makes it easy to follow the code but also makes it easy switching between the diagram and the code. The Parent-, and Name-properties together with the GetFullName method make nice tools while debugging. Player In my game I have a HumanPlayer-class and a ComputerPlayer-class, both implementing an abstract class Player. The main difference between the Human- and the ComputerPlayer-class is how the Update-method is implemented. The HumanPlayer-class is using input from keyboard and gamepad to control the player character while the ComputerPlayer is using the decision tree. The code for using the tree looks like this: var leaf = _decisionTree.Evaluate(state); leaf.Action(state); Nice, isn’t it? Happy coding! jan.
  16. Hello, I'm currently searching for a talented and passionate programmer to create a small but great horror game that would take around 3 months to be done. About the game: The game would be a sci-fi/post-apocalyptic survival horror 3D game with FPS (First person shooter) mechanics and an original setting and story based in a book (which I'm writing) scene, where a group of prisoners are left behind in an abandoned underground facility. It would play similar to Dead Space combined with Penumbra and SCP: Secret Laboratory, with the option of playing solo or multiplayer. Engine that'd be used to create the game: Unity About me: I'm a music composer with 4 years of experience and I'm fairly new in this game development world, and I'm currently leading the team that'd be creating this beautiful and horrifying game. I decided that making the book which I'm writing into a game would be really cool, and I got more motivated about doing so some time ago when I got a bunch of expensive Unity assets for a very low price. However, I researched about how to do things right in game development so I reduced the scope of it as much as I could so that's why this game is really based in a scene of the book and not the entire thing (and also that's why it would take 3 months). Also I'm currently learning how to use Unity and how to model things with Blender. Our team right now consists of: Me (Game Designer, Creator, Music Composer, Writer), 3 3D Modelers, 1 Sound Effect Designer, 1 Concept Artist and 1 Programmer. Who am I looking for: - A programmer that's experienced in C# and with Unity. Right now the game is very early in its development (GDD is completed and all 3D Items, Music and Sound Effects are completed). If you are interested in joining, contributing or have questions about the project then let's talk. You can message me in Discord: world_creator#9524
  17. Nilmani Gautam

    Unity 3D : Cube Race

    Welcome every one from this section we are going to develop a new 3D game Cube Race
  18. Hello, I'm currently searching for a talented and passionate programmer to create a small but great horror game that would take around 3 months to be done. About the game: The game would be a sci-fi/post-apocalyptic survival horror 3D game with FPS (First person shooter) mechanics and an original setting and story based in a book (which I'm writing) scene, where a group of prisoners are left behind in an abandoned underground facility. It would play similar to Dead Space combined with Penumbra and SCP: Secret Laboratory, with the option of playing solo or multiplayer. Engine that'd be used to create the game: Unity About me: I'm a music composer with 4 years of experience and I'm fairly new in this game development world, and I'm currently leading the team that'd be creating this beautiful and horrifying game. I decided that making the book which I'm writing into a game would be really cool, and I got more motivated about doing so some time ago when I got a bunch of expensive Unity assets for a very low price. However, I researched about how to do things right in game development so I reduced the scope of it as much as I could so that's why this game is really based in a scene of the book and not the entire thing (and also that's why it would take 3 months). Also I'm currently learning how to use Unity and how to model things with Blender. Our team right now consists of: Me (Game Designer, Creator, Music Composer, Writer), 3 3D Modelers, 1 Sound Effect Designer, 1 Concept Artist and 1 Programmer. Who am I looking for: - A programmer that's experienced in C# and with Unity. Right now the game is very early in its development (GDD is completed and all 3D Items, Music and Sound Effects are completed). If you are interested in joining, contributing or have questions about the project then let's talk. You can message me in Discord: world_creator#9524
  19. I need help, I just started learning today (about programming). But I dont understand what I am doing wrong I am getting a error message: Assets/PlayerMovement.cs(10,9): error CS0117: UnityEngine.Debug' does not contain a definition forlog' I found the problem (its about the captials.)
  20. [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)
  21. 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); } } }
  22. 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.
  23. 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!
  24. 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); } }
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!