I've been working on this for a long time. It wasn't very hard to make, but it's hard to understand how this works. Sometimes I even didn't understand my own code anymore. But it works
I've released the MultiThreadSimulation Emulator base some time ago, which already had a "Calls" system. I found out with that system you have so much possibilities in PHP. Even more than C# because PHP doesn't have type checks (int, string etc).
What is this?
This has a much better version of the "Calls" system, which I now call Threads (Although in C# they are different). I made an AsyncSockets TcpSocket class based on this. Just look in it and you'll see what I mean
How does this work?
You first have to understand "threads" from other languages, for example C#. The C# code is converted to OpCodes, which you can see in Reflector with Reflexil. Those codes are converted to other level codes, but it's about those opcodes now. PHP is a single threaded language, which converts PHP Code to a list of opcodes and runs them. Now threading is the switching of those list.
PHP:
Thread 1:
Opcode1
Opcode2
Opcode3
Opcode4
Opcode5
Opcode6
It runs the 6 opcodes
Now MultiThreading in C# works like this:
Thread 1:
Opcode1
Opcode3
Opcode5
Thread 2:
Opcode2
Opcode4
Opcode6
These 2 threads are combined into one list opcodes (1, 2, 3, 4, 5, 6)
Do you understand how multithreading works now? You have a list of threads, then from all the threads one opcode is ran.
Now my system in PHP works like this: the "threads" are list with functions. It switches all those threads and runs one function. You shouldn't call functions directly from another function, but add it to the threads list so it is ran when it is the turn of the thread.
I based my sockets on this by adding a function to the "functions" list, for example with receiving, every time there is no data to check if there is data.
If you really want to understand it please look into my code.
Download Link: Async Sockets in PHP.rar
Now please make a PHP emulator with this. I'm not going to continue my MS (MultiThread Simulation) Emulator because I don't have time for it. When I have more time I might go back to Emulators but with all the shit going on about the new crypto and the new CEO who might change Habbo I don't want to make an Emulator.



. I'm not going to continue my MS (MultiThread Simulation) Emulator because I don't have time for it. When I have more time I might go back to Emulators but with all the shit going on about the new crypto and the new CEO who might change Habbo I don't want to make an Emulator.




