Procedural content generation (PCG) is of great interest to game design and development because it generates game content automatically. Among many serious challenges in PCG, the content quality improvement, controllability and dynamic difficulty adjustment (DDA) of game content in real time are three major issues in non-adaptive and adaptive content generation. Motivated by the recent learning-based PCG framework and existing PCG works, we present novel online game content generation and real-time DDA approaches to seamlessly address these issues. In this thesis, we employ learning-based methods to produce quality yet controllable game segments called constructive primitives (CPs). As a result, a complete quality game level can be generated online by integrating relevant CPs via controllable parameters regarding geometrical features and procedure-level properties. By means of CPs, we also propose a DDA algorithm that controls a CP-based level generator to rapidly adjust the content difficulty based on players' real-time game-playing performance. For a proof of concept, we apply our approach to platform and first-person shooter (FPS) games. Extensive experimental results suggest that our approach efficiently produces controllable yet quality game content in terms of a number of generic quality measurements and adaptable content for DDA in real time as shown in extensive simulations and a user study.