ZED Online - a fork of the Zod Engine

Post here about the Z remake "Zed Online" by DaMarkov

Moderator: Brad

APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-11, 16:06

DaMarkov wrote:
2019-01-10, 23:40

For example if your computer 10.0.0.1 would go to google.com. It would send a packet to google's IP address and port 80 (for http) and write into the packet as the recipient address IP 10.0.0.1 and some port (usually something in the range 40000 to 50000). Let's say 45678, the port only is unique for your machine. Your router sees the packet and changes the recipient address to your WAN IP and it might also change the port.

The router keeps a table of the changes. Something like:
10.0.0.1:45678 <-> Google's IP : 80 + more information if the port changed

When google's response arrives the router looks into it's table and figures out for which machine (IP) and for which port the packet is destined, changes the receiver's address & port and forwards the packet to the local network.

That's how it is possible to have 3 computers accessing the same IP & port with the same WAN IP without conflicts. At least for outgoing connections.
For incoming connections the router has no idea what to do, so one basically needs to tell it ahead of time how to forward the packets.
In that example about google.
My laptop 10.0.0.1:45678 wants to reach www.google.com.
Router rewrites adress 10.0.0.1:45678 to "my WAN adress:portXYZ" and writes this changed adress to packet for google.
When response from google arrives, there should be adress "my WAN adress:portXYZ" in the packet.
So in the router's table I would expect:
10.0.0.1:45678 <-> "my WAN adress:portXYZ"

Because all three laptops can communicate with google in the same second, so the table 10.0.0.1:45678 <-> Google's IP : 80 wouldn't make a lot of sense.
Or did I miss something?

I am very thankful for your explanation in a form understandable for a common person. In literature written for professionals and in full detail I am lost after few sentences and I miss the main point which I am trying to figure out.
DaMarkov
Captain
Captain
Posts: 141
Joined: 2018-12-20, 16:17
Are you a spam bot?: No
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by DaMarkov » 2019-01-11, 20:29

APC wrote:
2019-01-11, 16:06
DaMarkov wrote:
2019-01-10, 23:40

For example if your computer 10.0.0.1 would go to google.com. It would send a packet to google's IP address and port 80 (for http) and write into the packet as the recipient address IP 10.0.0.1 and some port (usually something in the range 40000 to 50000). Let's say 45678, the port only is unique for your machine. Your router sees the packet and changes the recipient address to your WAN IP and it might also change the port.

The router keeps a table of the changes. Something like:
10.0.0.1:45678 <-> Google's IP : 80 + more information if the port changed

When google's response arrives the router looks into it's table and figures out for which machine (IP) and for which port the packet is destined, changes the receiver's address & port and forwards the packet to the local network.

That's how it is possible to have 3 computers accessing the same IP & port with the same WAN IP without conflicts. At least for outgoing connections.
For incoming connections the router has no idea what to do, so one basically needs to tell it ahead of time how to forward the packets.
In that example about google.
My laptop 10.0.0.1:45678 wants to reach www.google.com.
Router rewrites adress 10.0.0.1:45678 to "my WAN adress:portXYZ" and writes this changed adress to packet for google.
When response from google arrives, there should be adress "my WAN adress:portXYZ" in the packet.
So in the router's table I would expect:
10.0.0.1:45678 <-> "my WAN adress:portXYZ"

Because all three laptops can communicate with google in the same second, so the table 10.0.0.1:45678 <-> Google's IP : 80 wouldn't make a lot of sense.
Or did I miss something?
If 3 computers access google at roughly the same time you would have 3 entries in the table. Something like:

10.0.0.1:45678 <-> your WAN IP:12345 <-> Google's IP : 80
10.0.0.2:46765 <-> your WAN IP:12346 <-> Google's IP : 80
10.0.0.3:50123 <-> your WAN IP:12347 <-> Google's IP : 80
BallWin
General
General
Posts: 252
Joined: 2006-10-24, 02:24
Location: Russia
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by BallWin » 2019-01-11, 21:35

I mentioned that I recently downloaded the Zod Engine for revision. In my opinion there is some disorder. I wanted to split the engine into functional modules.
This was done.
The result is a set of libraries (in compilation order):
  • QZod_DnSeparate files with minimal dependencies that are required in many places
  • QZod_DnMap everything that relates to the building level
  • QZod_DnSoundEngine sound processing
  • QZod_DnSettings module with global settings
  • QZod_DnGui interface elements
  • QZod_DnEffect all game effects
  • QZod_Dn Objects objects (works, equipment, guns, etc.)
  • QZod_DnClientServer is clear from the title
Image Image
As you can see in the screenshot, Zod Engine now has only one main file. All necessary modules are connected to it in the header as:

Code: Select all

#include <lib_qZod_DnSeparate/common.h>
#include <lib_qZod_DnMap/qzod_map.h>
#include <lib_qZod_DnSoundEngine/qzod_soundengine_old.h>
#include <lib_qZod_DnSettings/qzod_settings_old.h>
#include <lib_qZod_DnGui/zgui_main_menu_base.h>
#include <lib_qZod_DnEffect/zod_effect.hpp>
#include <lib_qZod_DnObjects/zobject.h>
#include <lib_qZod_DnClientServer/zclient.h>
#include <lib_qZod_DnClientServer/zserver.h>
#include <lib_qZod_DnClientServer/zplayer.h>
#include <lib_qZod_DnClientServer/zbot.h>
#include <lib_qZod_DnClientServer/ztray.h>
I believe that it will be easier to maintain and develop individual modules. It's still the Zod Engine. With minimal changes. And it works.
APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-11, 21:49

DaMarkov wrote:
2019-01-11, 20:29
If 3 computers access google at roughly the same time you would have 3 entries in the table. Something like:

10.0.0.1:45678 <-> your WAN IP:12345 <-> Google's IP : 80
10.0.0.2:46765 <-> your WAN IP:12346 <-> Google's IP : 80
10.0.0.3:50123 <-> your WAN IP:12347 <-> Google's IP : 80
Thank you. Now it is clear for me.

.........

BallWin are you able to compile it to zod_engine.exe and zod_map_editor.exe?
Do you used zod_src-2011-09-06.zip?

........

When starting Zod_engine it writes "...cannot load resource music_arctic and music_city..."
Is it prepared just for future to add there the files which user likes? (To be listened in arctic and city battle?)
DaMarkov
Captain
Captain
Posts: 141
Joined: 2018-12-20, 16:17
Are you a spam bot?: No
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by DaMarkov » 2019-01-11, 22:43

BallWin wrote:
2019-01-11, 21:35
I mentioned that I recently downloaded the Zod Engine for revision. In my opinion there is some disorder. I wanted to split the engine into functional modules.
This was done.
[...]
I believe that it will be easier to maintain and develop individual modules. It's still the Zod Engine. With minimal changes. And it works.
I understand that the Zod engine has some spaghetti code (for example SDL input->zplayer->event handler->zplayer->zhud->portrait->sound engine).
But what do you mean "functional modules". Are there some some parts of the Zod engine that don't work? So far I got everything to compile and work right out of the box.

In any case, very nice work on restructuring the engine!! Do you plan to release the restructured Zod engine somewhere?

EDIT:
APC wrote:
2019-01-11, 21:49
When starting Zod_engine it writes "...cannot load resource music_arctic and music_city..."
Is it prepared just for future to add there the files which user likes? (To be listened in arctic and city battle?)
Yes, exactly. The Zod engine tries to load these files. If it can not be loaded it will use a different music file for arctic and city levels.
BallWin
General
General
Posts: 252
Joined: 2006-10-24, 02:24
Location: Russia
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by BallWin » 2019-01-12, 13:54

The project in its current state is loaded here https://yadi.sk/d/iNqfUvTDwwq2Ww
or GitHab repo https://github.com/BallWin/Qt_ZodEngine.

IDE - QtCreator https://www.qt.io/download
I think it's easy to migrate to another IDE.
DaMarkov wrote:
2019-01-11, 22:43
I understand that the Zod engine has some spaghetti code (for example SDL input->zplayer->event handler->zplayer->zhud->portrait->sound engine).
But what do you mean "functional modules". Are there some some parts of the Zod engine that don't work? So far I got everything to compile and work right out of the box.
No. This expression defines a block with a set of functions to perform a single main task. Nothing else. I believe that spaghetti code is unavoidable in research. That's life. :|
Of the errors can be noted that OpenGL mode works strange. I have not done a detailed code review. I just fixed a few little things. I found the parameters mixed up in memset. Also, parameters with type (char) were assigned a value greater than the maximum possible (= 200, etc.). The types of these parameters have been replaced with uint_8. Nothing more.
DaMarkov wrote:
2019-01-11, 22:43
In any case, very nice work on restructuring the engine!! Do you plan to release the restructured Zod engine somewhere?
I don't have any big tasks. I already have experience when "big plans" ended in nothing... I want to take some small steps. As I mentioned, I'm only interested in single player mode. At the moment, the company is a set of maps in a text file. When the engine starts, it playback these levels in non-stop mode. I want to see a pop-up screen with the game results after completing each map. I want to see a video before starting each card in the original campaign. All this can be done without major changes ZodEngine.
Of course, new maps and new campaigns require a good editor. I don't think it can be done on STL and wxWidgets. For these purposes, IDE QtCreator fits very well.
Then you can think about new units, smooth road loops, new landscapes in the end.
APC wrote:
2019-01-11, 21:49
When starting Zod_engine it writes "...cannot load resource music_arctic and music_city..."
Is it prepared just for future to add there the files which user likes? (To be listened in arctic and city battle?)
Already answered :cheers:
APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-12, 22:31

BallWin wrote:
2019-01-12, 13:54

I don't have any big tasks. I already have experience when "big plans" ended in nothing... I want to take some small steps.
Smart approach.

Is the AI programmed only in zbot.cpp, zbot.h and zbot_events.cpp?
Do I understand correct for each AI_unit the AI just takes some nearest target from targetlist and that's all? The units just spread to all direction this way?

At least for the 20 original SP missions could be AI done in scripted form with AI_file for every mission. I mean something like in old "Sudder Strike" game, where AI just looks if some areas on maps are enemy units in some amounts and reacts according to that situation. Also scripted placement of produced defensive guns would result in placement it on more crucial places.
APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-13, 00:51

I encountered surprising (for me) bug during Zod-Engine MP gameplay on Nighsoft server. Some players are able to place 2-3 guns in one moment in zone where they need. It seems they must produce that guns at first, then hold it in storage (not placed) and then place it on border zone where they are producing gattling.
It should be tracked and improved somewhere in the code. I consider it annoying. It is a pity I don't know whole procedure; it would be easier to trace that bug.

In old Z was limit 4 guns per zone. Is that limit also for Zod Engine? (I have seen the guns production continued also after fourth gun, but I have never tried if it would be possible to place fifth manufactered gun.
BallWin
General
General
Posts: 252
Joined: 2006-10-24, 02:24
Location: Russia
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by BallWin » 2019-01-13, 14:02

for APC
While I was not looking at how AI actually works. I will deal with AI later (much later). Probably it is possible to ask the DaMarkov. :)
APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-13, 21:13

About the gun placement bug which I described. I tested possibilities and I was able to place only 4 guns and only to the zone which produced it. Production of fifth gun results in nothing.
Contrary to Z_DOS here it is possible to have produced all four guns in 1 zone without placement, just prepared. I was used to in old Z that gun must be placed before next gun is finised, otherwise the next gun will just waste production time.
APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-14, 08:24

I noticed another illogical issue in ZOD Engine.
Player can repair completely destructed factory by crane. But damaged factory is it not possible to repair and player is forced to suffer reduced production speed. This is exploitable against AI in singleplayer and also by human opponents in MP.
I suggest one out of three solutions:

A) There should be some auto-regeneration of damaged factories on very slow pace. I prefer this solution, it is not exploitable neither in SP nor in MP and it is simple.

B) There should be added "unit" to the production list of all factories - TNT autodestruction of factory. Manufacturing time similar to Grunts, to prevent misuse as very fast scorched earth policy.

C) Crane could have possibility to repair damaged factories.


Crane is avaliable in all forts (contraty to original Z_DOS). I think this addition would just improve gameplay. The damage to the factory shouldn't be irreversible.
APC
Sergeant
Sergeant
Posts: 65
Joined: 2008-11-07, 16:18
Location: SLOVAKIA

Re: ZED Online - a fork of the Zod Engine

Post by APC » 2019-01-14, 10:06

There are now two live successors of (2010-2011) ZOD Engine. DaMarkov's ZED Online developed on Sourceforge and BallWin's Qt_ZodEngine developed on GitHub.

I don't say it is wrong to have separate projects. But there is an issue of doublework and it should be solved.

A) You can merge your projects to one. Both of you are in initial stage of branch (2010-2011) ZOD Engine. But each prrogrammer has his own vision, programming customs, speed of work. I think it wouldn't be comfortable for you.
B) You can inform each other about bugs found and repaired in original ZOD Engine and also about code used to repair it. It could save a lot of doublework and existence of two different ZOD Engine remakes, each of them with different set of bugs.

_______________________________

BallWin created more understandable structure of the source code and repaired mixed memsets of some parameters in OpenGL functions.
DaMarkov added SHIFT-key waypoints additional (perfect!), hotkeys optional, traced some bugs about music and about units_count bar, he improved MapEditor - debugged especially about bridges.

Listed missing features and annoing bugs should be solved in both projects. Other additions (input of game_name instead of IP_adress, handling of MP players, counting of battle statistics during match) are issues specific to each project.
DaMarkov
Captain
Captain
Posts: 141
Joined: 2018-12-20, 16:17
Are you a spam bot?: No
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by DaMarkov » 2019-01-14, 14:41

APC wrote:
2019-01-13, 00:51
I encountered surprising (for me) bug during Zod-Engine MP gameplay on Nighsoft server. Some players are able to place 2-3 guns in one moment in zone where they need. It seems they must produce that guns at first, then hold it in storage (not placed) and then place it on border zone where they are producing gattling.
It should be tracked and improved somewhere in the code. I consider it annoying. It is a pity I don't know whole procedure; it would be easier to trace that bug.
I thought Z DOS had the same behavior that one can store up to 4 guns. I think it's quite helpful, I usually construct a lot of howitzers and it's good that I don't have to react immediately when one is constructed. So I'm not sure if I should consider this a bug or a feature.

APC wrote:
2019-01-14, 08:24
I noticed another illogical issue in ZOD Engine.
Player can repair completely destructed factory by crane. But damaged factory is it not possible to repair and player is forced to suffer reduced production speed. This is exploitable against AI in singleplayer and also by human opponents in MP.
I suggest one out of three solutions:

A) There should be some auto-regeneration of damaged factories on very slow pace. I prefer this solution, it is not exploitable neither in SP nor in MP and it is simple.

B) There should be added "unit" to the production list of all factories - TNT autodestruction of factory. Manufacturing time similar to Grunts, to prevent misuse as very fast scorched earth policy.

C) Crane could have possibility to repair damaged factories.

Crane is avaliable in all forts (contraty to original Z_DOS). I think this addition would just improve gameplay. The damage to the factory shouldn't be irreversible.
In ZED Online I patched this in a recent commit (will be available with version 0.1.1). Players can attack and destroy their own buildings.
In Z DOS in multiplayer destroyed factories repaired themselves after about 1 minute, so it was always faster just to destroy the factory and wait a little while.
The ZOD engine allows for buildings to this auto repaired. I think the right way, would be to have this stored in the map files along with building_health.
On certain maps autorepair makes sense on others maybe not so much (for example Bridge games).

Regarding the crane, in ZED Online the crane is not available in forts with 1-3 stars (since this is the behavior of Z DOS). So, it's basically in the hands of the map maker.

APC wrote:
2019-01-12, 22:31
Is the AI programmed only in zbot.cpp, zbot.h and zbot_events.cpp?
Do I understand correct for each AI_unit the AI just takes some nearest target from targetlist and that's all? The units just spread to all direction this way?
At least for the 20 original SP missions could be AI done in scripted form with AI_file for every mission. I mean something like in old "Sudder Strike" game, where AI just looks if some areas on maps are enemy units in some amounts and reacts according to that situation. Also scripted placement of produced defensive guns would result in placement it on more crucial places.
BallWin wrote:
2019-01-13, 14:02
for APC
While I was not looking at how AI actually works. I will deal with AI later (much later). Probably it is possible to ask the DaMarkov. :)
In the ZOD engine only the files zbot.cpp, zbot.h and zbot_events.cpp are relevant for the AI + the recent added heatmaps for gun placement if one uses the new AI.
The AI is quite involved and to be honest I didn't read that part of the code yet.
By AI_file do you mean the original CPU files in the level folders? Sorry to disappoint you, but the only information these files contain (unless I am missing something) are the starting position/units and initial commands of the AI units. No scripts, no complicated behavior.
But maybe it would be a good idea to have some kind of script language for the AI. Something simple as in the original Starcraft might work.
APC wrote:
2019-01-14, 10:06
There are now two live successors of (2010-2011) ZOD Engine. DaMarkov's ZED Online developed on Sourceforge and BallWin's Qt_ZodEngine developed on GitHub.

I don't say it is wrong to have separate projects. But there is an issue of doublework and it should be solved.

A) You can merge your projects to one. Both of you are in initial stage of branch (2010-2011) ZOD Engine. But each prrogrammer has his own vision, programming customs, speed of work. I think it wouldn't be comfortable for you.
B) You can inform each other about bugs found and repaired in original ZOD Engine and also about code used to repair it. It could save a lot of doublework and existence of two different ZOD Engine remakes, each of them with different set of bugs.
A) seems to be impossible right now. ZED Online so far only works under Windows and I have recently added a player for the cutscenes porting this to Linux has a low priority for me right now.
B) Excellent idea! Of course, what someone considers a bug another persons sees as a feature. @BallWin should we create something like a Google Docs spreadsheet where we write down what bugs we fixed/things we changed?
Something like: Players can not attack their own building | Fixed in ZED Online commit [...] | Released in version 0.1.1
Then we would have a list of all the changes and as long as every change is tied to a commit id it should be easy for us to transfer these changes in our own projects.

I have a big question regarding the repair facilities:
When I repair a tank and during the repair the enemy takes the flag of the repair shop.
Does the tank that is at this very moment inside the repair shop belong to the enemy who captured the flag or does the tank still belong to me?
And if is still belongs to me, did it get repaired?
I know how the ZOD engine handles this case, but does anyone remember what happens in Z DOS in this special case??
User avatar
SteelGhost
Corporal
Corporal
Posts: 44
Joined: 2017-09-19, 00:28
Are you a spam bot?: No

Re: ZED Online - a fork of the Zod Engine

Post by SteelGhost » 2019-01-14, 19:54

DaMarkov wrote:
2019-01-14, 14:41
I have a big question regarding the repair facilities:
When I repair a tank and during the repair the enemy takes the flag of the repair shop.
Does the tank that is at this very moment inside the repair shop belong to the enemy who captured the flag or does the tank still belong to me?
And if is still belongs to me, did it get repaired?
I know how the ZOD engine handles this case, but does anyone remember what happens in Z DOS in this special case??
I think in DOS Z the repair sequence would just get interrupted, and some later version changed it so that taking the territory will steal the vehicle inside. I'm not entirely sure, maybe I should test it again.
Image Z Wiki - Contribute now!
BallWin
General
General
Posts: 252
Joined: 2006-10-24, 02:24
Location: Russia
Contact:

Re: ZED Online - a fork of the Zod Engine

Post by BallWin » 2019-01-14, 21:05

APC wrote:
2019-01-14, 08:24
B) There should be added "unit" to the production list of all factories - TNT autodestruction of factory. Manufacturing time similar to Grunts, to prevent misuse as very fast scorched earth policy.
Brilliantly! At threat of capture of plant by the opponent it will be possible to destroy it! Excellent opportunity. Mr will work. In SP the AI can be taught this trick.
APC wrote:
2019-01-14, 10:06
A) You can merge your projects to one. Both of you are in initial stage of branch (2010-2011) ZOD Engine.
The main problem with this-different OS which is being developed. I don't use Windows. I have an old laptop with Windows XP. It has remained just since those times (2010-2011). No problems installing Qt Creator (Qt5) c Windows and compile it there Q_Zod Engine. But I do not plan to install Windows (and still do not know what version to install).
DaMarkov wrote:
2019-01-14, 14:41
ZED Online so far only works under Windows and I have recently added a player for the cutscenes porting this to Linux has a low priority for me right now.
Can I learn more about the cutscenes player? I'm just writing a player for the files .JV to transcode the original clips of the game in normal avi format. The description of the original format found here https://wiki.multimedia.cx/index.php?title=JV. The rollers necessary for the original campaign.
DaMarkov wrote:
2019-01-14, 14:41
B) Excellent idea! Of course, what someone considers a bug another persons sees as a feature. @BallWin should we create something like a Google Docs spreadsheet where we write down what bugs we fixed/things we changed?
Something like: Players can not attack their own building | Fixed in ZED Online commit [...] | Released in version 0.1.1
Then we would have a list of all the changes and as long as every change is tied to a commit id it should be easy for us to transfer these changes in our own projects.
I agree with you. At the moment, when changing the source code of the Zod Engine, I added the //TODO label next to it. Many ides are able to search for that tag and display each of these places. However, the replacement is NULL on null ptr, it had to make more than 500 corrections... such a small change I have not noted. I could give you the password for the Github branch. You could form a Windows branch nearby. Then we will receive the list of changes automatically.
DaMarkov wrote:
2019-01-14, 14:41
I have a big question regarding the repair facilities:
When I repair a tank and during the repair the enemy takes the flag of the repair shop.
Does the tank that is at this very moment inside the repair shop belong to the enemy who captured the flag or does the tank still belong to me?
And if is still belongs to me, did it get repaired?
I know how the ZOD engine handles this case, but does anyone remember what happens in Z DOS in this special case??
In this situation, the repair of equipment is interrupted. Technology does not change its owner. Possible equipment gets damaged inside enemy repair.
SteelGhost write correctly.
Post Reply