Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Questions about Unity 2d

Discussion in '2D' started by kicknbrit, Oct 5, 2018.

  1. kicknbrit

    kicknbrit

    Joined:
    Oct 5, 2018
    Posts:
    4
    Hey guys! So I used unity a while ago and have a bit of experience, but I have spent most of my time developing with Love2d and lua.

    I started a project where there is an authoritative server interacting with players in a top-down 2d setting a while ago, and after too many large projects falling short I realized if I want this project to be successful I need to rewrite the project using a OOP language.

    In love2d I would just write all the code for every part of the game but in unity, I am not exactly sure what parts to code and where.

    So here's what I need to know--------------

    How would I implement the server sending unit/tile updates to the client, and creating new units and tiles,

    How do I connect C# scripts to units and tiles and create code to handle all data received from the server,

    How would I go about accessing sockets and HTTPS,


    And finally how could I implement a top-down tile-based rendering style in unity

    -------------

    I just need someone to point me in the right direction.
     
  2. hamberge

    hamberge

    Joined:
    Aug 30, 2015
    Posts:
    36
    Well I can kind of help you with the last question. Or at least give you some partial answers, since I am something that involves a top down tile based system.

    For a tile based rendering system, you want to use the grid component. It has a lot of useful functions for aligning things to a grid. You can use a tilemap object as well if you want to make a tile-based background or background layers. Typically, if you add a tilemap to a scene, it will add its own grid as a parent.

    Tilemaps even implement collision and allow for tile animation. However, tiles (the constructs you need to use to display tiles) do not really allow for complex scripting themselves. To do scripting based things, you'd have to use something other than tilemap.

    For me, I use tilemap for things that only get displayed, like a background, a gridline overlay, etc. For more complicated things, I have a GridMap class that allows me to register objects to it and has an internal representation of a map that corresponds to the grid. The internal representation stores whatever objects I register to the map. Then all such objects can refer to map coordinates, with the gridmap doing conversion to world coordinates based on the grid.
     
  3. kicknbrit

    kicknbrit

    Joined:
    Oct 5, 2018
    Posts:
    4
    hmm. Okay. Thank you I will look into the grid component