Configuration and operation are key to the successful deployment of a renewable energy integrated microgrid. Considering that wind generator, photovoltaic array, and storage battery may belong to different investors in market-oriented operation modes, game theory can be used to tackle the conflict between the overall optimal operation of the microgrid and the maximum profit of each investor. To handle the tradeoff among multiple investors and the uncertainties in wind and solar power, this article develops a new two-layer game model, where a planned output game and a capacity allocation game are considered. The inner layer is a master-slave game to optimize the planned renewable energy output, which is used to predetermine the operation strategy of the microgrid under the initial capacity allocation. In the outer layer, based on the optimized planned output obtained from the inner layer, a noncooperative game and a cooperative sequential game dominated by wind-photovoltaic cooperative alliance are formed to determine the optimal capacity allocations. The equilibrium solution, achieved from the iterative optimization between inner and outer layers, determines the optimal capacity allocation of the microgrid. The effectiveness of the proposed model is verified using a case study of a wind/photovoltaic/battery/gas microgrid.