Home > Article > Backend Development > Xnova (ogame) source code interpretation for PHP web game learning (1)_PHP tutorial
1. Introduction
xnova (ogame) is one of the most popular war strategy web games in the world, and it is also the target of imitation by most similar web games. You only need a web browser and no need to download a client to play online games.
What kind of game is Xnova?
You are a ruler across galaxies, using different strategies to expand your power. You'll start your career on a planet of your own, where you use available resources to build an economic and military base. Through scientific research you gain access to new, advantageous technologies and new weapons systems. As the game progresses you will immigrate to multiple planets, form alliances with other players, do business with other players or start wars. No matter what you want to do, Xnova can help you do it!
Xnova is a game of the same type and theme as the popular web game OGame (Galactic Empire). OGame is the target of plagiarism from many domestic Three Kingdoms-themed webgames (BTW, I hate the Three Kingdoms).
Disclaimer: The source code I am learning to use is an open source project. It is prohibited to be used for commercial purposes, otherwise you will be responsible for the consequences!
The original copyright belongs to the Xnova development team!
The Iron Captain version is modified based on Xnova v0.8e!
This version has stopped updating and we do not provide any technical support!
What this site provides for download is an improved version of this system!
The source code download address of this website: http://www.jb51.net/codes/180759.html
Our learning process is carried out in the order of program execution. Before looking at the source code, we first studied the basic tutorial of PHP.
If you don’t know PHP, please learn the basic PHP tutorial first, or a C foundation is better!
It is best to install PHP debugging tools. I use Zend studio 5 and Zend Debugger 5. It should not be difficult to use them, and you can find them with Google. Finally, prepare a cup of hot tea and you can start work.
2. Entrance (index.php)
This file is the entrance to the game. It has only a few lines of code and its functions are clear at a glance: first determine whether the file size of config.php is zero; if so, redirect to the install/ directory to perform the installation operation; otherwise, redirect to login. .php displays the login page. The source code is as follows:
if (filesize('config.php') == 0) { header('location: install/'); exit(); } header('location: login.php');