[crossfire] Building in C++?

Preston Crow pc-crossfire06 at crowcastle.net
Sun May 29 15:39:11 CDT 2022


Crossfire is built around objects, so I can see why making such a change 
would seem to make sense, but I'm not clear that it would really improve 
anything in particular.  The first question is what language features in 
C++ would be useful?

I was looking at making the maximum window size a runtime config option 
instead of a compile-time option (default 25x25 now). There are places 
where using a language with object constructors would make that much 
simpler since we have a bunch of hard-coded arrays now.  I don't think 
this justifies such a change.

I'm a bit concerned about security running a public Crossfire server.  
Switching to C++ would do nothing to help, but I was thinking Rust would 
be interesting.  That would be a major porting effort; essentially a 
rewrite.  Probably not worth it, especially for such a relatively new 
language.

For the server, the game is quite stable, so we would need some major 
reason to make a big change.  Most of the changes now should be tweaks 
to fix issues, often hidden bugs that are exposed when a new map tries 
something original.

Ultimately, what the game needs is not server work.  It needs more 
players and more maps.  For more players, a browser-based client would 
be awesome.  For more maps, I'm working on some on my server, which I'll 
push out eventually.

If you want to do coding, is there some possibility to build a client in 
Rust compiled to Webassembly to run in a browser?  That would be all 
kinds of awesome!

On 5/27/22 09:46, Nicolas Weeger wrote:
> Hello.
>
>
> I just pushed branch "cpp-build" which changes all .c files to .cpp files. The
> only other changes are what was required for correctly building (adding some
> casts, renaming a few variables, things like that).
>
> Functionally, everything is the same.
>
>
> I'd like to merge those changes to master, but well, I'd like to get opinions
> before.
>
>
> I don't plan on migrating to a full C++ code base with classes, inheritance &
> other things, the current code is fine.
>
> I do plan to use C++ to replace some home-grown things (lists handling mostly
> - for new code, I don't want to always have to realloc() and check size, a
> std::vector is enough for that), and to solve issues with object* items being
> free'd while still referenced (with our nice check on "count == saved_count"
> here and there urgh).
>
>
>
> Regards
>
>
> Nicolas
>
> _______________________________________________
> crossfire mailing list
> crossfire at metalforge.org
> http://mailman.metalforge.org/mailman/listinfo/crossfire
> IRC: http://crossfire.real-time.com/irc/index.html
> Discord: http://crossfire.real-time.com/discord/index.html
> Project Site: https://sourceforge.net/projects/crossfire/
> Wiki: http://wiki.cross-fire.org/
> Website: http://crossfire.real-time.com
>


More information about the crossfire mailing list