Greetings to all in my period of life, in which I decided to take up my long-held dream. Creator's illness, or how to create my own virtual matrix, didn’t leave my mind exactly as much as I can remember. And so, after so many deferred attempts, having gathered a lot of knowledge and experience, I am glad that I take this matter seriously.

My knowledge

  • HTML, CSS
  • Javascript, Jquery, Ajax
  • PHP, OOP
  • Mysql
  • Laravel Framework

matrix

Go to the point. I want to create a huge virtual city, medieval times, that will live their lives, regardless of me. I can’t afford 3D graphics, because everything will be in the form of regular graphs and numbers, and then I’ll come up with a visual shell for all of this.

The city will have small neighborhoods in which it is necessary to realize the growth of vegetation and the activity of a certain fauna.

Residents in the beginning will create in the amount of 1000 pieces. Everyone should have their daily routine, position on the map, financial operations, production and resource costs. I implement the script for unforeseen circumstances in the form of relationships, weddings, diseases, births, desires, and so on.

An important part of the implementation will be the economy - a primitive economy. Prices of goods and services will be set depending on demand and quantity.

So questions

First of all, I need absolutely any information that can help me. I will be very grateful if you direct me to what to study and what will be useful for the realization of this goal.

Question - Since my city can be divided into logical calculations on the economy, the behavior of residents, the growth and activity of the fauna, and so on, I think, and if I do not divide these processes on different servers. One server will calculate the growth of trees, the movement of deer through forests, the number of fish in the lakes, while the other server will calculate the economy. There will be some intermediate server that will collect information from the servers and transfer to the user. What do you think about it? And how would you implement communication between these servers?

Question - As you know, there is one problem with scripting languages ​​like PHP, they die immediately after execution. And I need something that will work constantly and be engaged in a constant calculation. The first thing that comes to my mind is CRON.

I propose to simplify the whole thing for understanding to the level of Tamagotchi. There is a little man in MySQL. This man has a Field Hunger. Every second, this hunger should increase. When the hunger character is full, he must stupidly send me an email. How can I check him every second for hunger? What do you recommend?

Again, bring specifics! I want to create a world that will live its life. Take for example the Cities Skyline. If I launch the game before going to work, I will know that life is flowing there. What is at this moment, a certain character in the game woke up, got into his car, went somewhere, etc.

Closed due to the fact that the question is too general for participants Vladimir Martyanov , Alexey Shimansky , D-side , andreymal , Air Jan 15 '18 at 16:15 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Learn normal languages ​​like pros. - Vladimir Martyanov
  • 7
    You have a good (from the point of view of knowledge) question, but it is too general for this resource ... I recommend finding some kind of forum and trying to solve the problem there, gradually breaking everything down into simpler steps and solutions. - test123
  • @ Vladimir Martianov, and why php not a normal language? In its sphere of application (web) - there will be better pluses. - Klimenkomud
  • 2
    Virtually any application in any language can work in and of itself. it can be run for example from system startup scripts, i.e. together with the server. or during debugging just in the console. And this application will constantly consider what it needs or sleep, if nothing is required. it can write the entire state to the database and / or to some cache like memcached or just to files. If clients come, they can work out the same php, which will receive the current state and give it to the client, then it will be completed. but if the client needs to be constantly updated, then websocket is better - Mike
  • four
    And he practically does not depend on the language if he dies after execution or not. just so the web servers are built (and not always) that they run the script and then it ends. But you can easily run the same php in the console and it will work constantly. And by the way, for example, there is NodeJS in it. By default, a web server is built into the engine itself, and your application itself is constantly running web servers. Another thing is that it is really better to write intensive calculations in C, because it is compiled and much faster than any interpreted language - Mike

0