When you first start the game, you are in protection for 3 days. During this time, you will not be attacked by any other players. Take advantage of this time to prepare your base, by leveling up as quickly as possible. Completing the campaign chapters will earn you additional coins and alloy, which will help you level up faster. Use crystals on droid (get 3-4 if possible). Focus your upgrade on resources and only build minimal amount of army needed to complete the chapters. Most chapters will gift you a hero, which will help you get through most of the chapter.
Starting the 3rd day, start focusing your upgrades on turrets and walls. Make sure to upgrade the turrets and walls as much as possible. There are other discussions for best layout of base and combination of turrets.
Hopefully when your protection period is over, you will be ready to engage in battles with other players. In case you are not ready, don't worry too much. Losing a battle will put you back in protection for a few hours. However, you will lose medals, coins, and alloy, which will slow you down.