Jump to content

Some big questions about how 0 a.d. works.


Recommended Posts

Hello,

I've got a couple of questions and I'm not getting the right results searching for it. I found one thing which is a blog about the development of a game called banished. I'm trying to teach myself how to program and well I'm really new to this. One example of a question I have is that when I look at the repository on github, all these different languages are used. How do they all work together? I mean it's "one" game in the end. Somehow they blend into eachother. Or are used in different ways.

Also, I'm interested in how you got to make it multiplayer. I came across a reddit topic in which was said that one person was working on sharing how to do it, but that there are no good resources on how to make a game multiplayer. One book all in all which was very vague about it apparently. But you manage to pull it off. The part where I got stranded was a small game through pygame and wanting to make that multiplayer. But I came to the conclusion that apparently it was impossible. Even though things like PodSixNet seem to exist, they seem to kind of mimic it. Not actually pulling it off completely which in my mind is 2 different PC's connecting together.

And where does all the art go?

Yeah well I've got some more but I'm kind of intimidated by the repository and kind of hesistant to try and look on my own.

I'm also surprised that I haven't found related questions like this at all. All very technical and such but not "the big ones" lol.

I think this is really a great game to try and want to learn from, or maybe correct me if I'm wrong. I figure if it is open source there aren't any company secrets or technologies that remain unshared, that's what I thought at least.

Link to comment
Share on other sites

Hello and welcone to the forums @ImportantBookWorm

2 minutes ago, ImportantBookWorm said:

I look at the repository on github, all these different languages are used. How do they all work together?

It depends if you mean the game or in general :). If you mean the game we mainly have two languages. JavaScript and C++. Python ShellScript and perl are only used for external tools.

JavaScript is used for AI, Random Map Generation, GUI interaction, and What we call Simulation. For simulation it's only for the not performance critical part of the code.

C++ is used for the rendering engine performance critical code multiplayer.

Multiplayer implies a lot of things so can you be more specific about what you want to know.

10 minutes ago, ImportantBookWorm said:

And where does all the art go?

The art is in mod folders binaries/data/mods/***

11 minutes ago, ImportantBookWorm said:

I'm also surprised that I haven't found related questions like this at all. All very technical and such but not "the big ones" lol.

Usually people are interested in contributing, modding or playing not so much making new games :)

 

Link to comment
Share on other sites

I found this tutorial - it might be helpful for understanding the concepts:

https://gamedevelopment.tutsplus.com/tutorials/building-a-peer-to-peer-multiplayer-networked-game--gamedev-10074

The way this is usually done is that each computer calculates the game separately, and the information sent to each other are the player actions (player commands) only - each computer then calculates the results of these actions on its own. Computers also will send each other hashes of the game state to ensure their calculations are in sync and all players are experiencing the same game.

This is the gameplay part - you obviously will need a networking layer too.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Right, this information already gave me a lot of leads how I can investigate this further. However I am quite curious about how Javascript and C++ communicate? And why was chosen for these 2 languages? Well I understand C++ for the performance part. But Javascript is a surprise to me. Isn't that only for web? Thanks.

Edited by ImportantBookWorm
Link to comment
Share on other sites

They communicate through a system of interfaces. 0 A.D. uses an entity component system (ECS) each components defines an interface. We use firefox's JavaScript engine to run Javascript. It was chosen a long time ago. With some digging you will find some relevant threads :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...