View topic - Synced data, libraries, coding, and data storage



All times are UTC + 1 hour


Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: 03 Nov 2007, 19:43 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
A lot of people have complained about springs internals, some have even gone as far as starting a brand new engine to start from scratch (Command Engine/OSRTS).

So it isn't a very good idea to worsen this issue by treating the whole engine like a playground.

Libraries and includes are being added that affect the entire engine and external projects, increasing the number of dependencies required to compile things and increasing the compile time too.

Some of these such as lua are a necessary addition, but others are not.

What's more this lack of proper organisation is a potential danger, and could lead to code that is prone to causing desyncs and crashes, or is just horrendous spaghetti code that's hard to follow.

So to start with I suggest the very very basic principle that fnordia first put across when the engine was open sourced for anyone working on the engine.

1) Do not mix synced and unsynced data.

By synced data I mean classes such as:

Unitdef
WeaponDef
Moveinfo
Featuredef


Including handling of:

Lua Gadgets
AIs
pathfinding
los and radar


etc, these define things that should be the same on all client and are critical to the game state.

By UnSynced data I mean:

Widgets
OpenGL data/routines
sfx
GUI states
networking


2) Only add #include directives where they're needed

If I am doing AI I should not have to compile a dependency that has absolutely nothing to do with AI. Why does my los code need to know what a weapondef is? Why does my tdf parser need to know the maximum number of players a game can have? Why does my networking class need to know howto load dds textures into ram?

This can increase compile time and its bad organisation. So much so its now affecting projects outside of spring. As an AI developer every few weeks I find that my project ends up including more and more headers, not because I have added more dependencies but because people have been careless and added their #include statements anywhere without due care to attention.


1) Do not mix synced and unsynced data.
2) Only add #include directives where they're needed

This just shouldn't be happening. This is an RTS engine not a calculator app. A lot of this isn't even spring organisation, its simple common sense good coding practices.


Last edited by AF on 03 Nov 2007, 23:40, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: 03 Nov 2007, 19:49 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
+1

feel free to help fixing it

stuckied until I get around to finishing my coding standards/practices document


Top
 Offline Profile  
 
 Post subject:
PostPosted: 03 Nov 2007, 22:41 
Spring Developer

Joined: 24 Jun 2007, 07:34
Location: 50┬░ 56' N, 11┬░ 35' O
+2

BUT:
networking - Is unsynced now and I can't think of a reason to change that.
AIs - Is synced now but I think it would work better (=safer, easier) when its would be unsynced (and working like a regular player)


Quote:
2) Only add #include directives where they're needed

The problem are not only the header files. Lots of code is all spread around in the engine. Nearly every class i mess around with has some code inside which (in my opinion) doesn't belongs there, sometimes the same code is even doubled in different classes.


Top
 Offline Profile  
 
 Post subject:
PostPosted: 03 Nov 2007, 23:38 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
Agreed, and although there's a lot of stuff that's wrong atm, we should all keep it in mind for future code. Ill modify the post to shift networking to unsynced.


Top
 Offline Profile  
 
 Post subject: Re:
PostPosted: 18 Mar 2008, 20:44 

Joined: 13 Jan 2008, 21:34
Location: Wisconsin, USA.
Tobi wrote:
+1

feel free to help fixing it

stuckied until I get around to finishing my coding standards/practices document


Any progress on this? :-)


Top
 Offline Profile  
 
PostPosted: 18 Mar 2008, 20:45 
Malcontent
User avatar

Joined: 27 Feb 2006, 22:04
Location: Hurrrrrr.
It is or was somewhere in the bowels of buildbot.no-ip.info iirc, unless that was an older one.


Top
 Offline Profile  
 
PostPosted: 09 Sep 2008, 21:16 
User avatar

Joined: 07 Sep 2008, 23:01
Would code reviews, "cage cleaning", writings of unit-tests, code documentation and other efforts aimed at increasing the quality and maintainability of the code be accepted or even appreciated in this project?

Such work won't directly create any new functionality/features what so ever, but makes it easier to create/add such things in the future.

I can also imagine that such efforts to some extent addresses the problems AF are mentioning.

(And also, they are a brilliant opportunity to familiarize oneself with the code...)


Top
 Offline Profile  
 
PostPosted: 09 Sep 2008, 22:28 
Spring Developer

Joined: 01 Jun 2005, 10:36
Location: The Netherlands
I would definitely appreciate it :-)

(It's what I was doing over 50% of the time when I was more actively coding...)


Top
 Offline Profile  
 
PostPosted: 10 Sep 2008, 11:02 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
I would appreciate it too. and zes zou are right i think, its a good thing to familiariye with the code.


Top
 Offline Profile  
 
PostPosted: 11 Oct 2008, 16:16 
Moderator

Joined: 22 Aug 2006, 15:19
http://spring.clan-sy.com/wiki/Debugging_sync_errors


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.