I think the problem with C++ is that the language is huge. Different teams use different subsets of the language, which makes sharing or transferring code between teams more difficult.
I have most problems in C with int-to-pointer-to-int situations. I get segfaults for wrong type conversions in multiple places in code. Then I have to deal with multiple data types for integers and strings, that's a headache. What's wrong with just using 1 int data type and 1 string data type that'll work on most common systems for most common situations and make life in coding a bit easier?
For the configuration vs scripting for modules, scripting is easier to implement, but more difficult to maintain. Configuration is easier to maintain, but more difficult to implement depending on the amount of allowed flexibility. Maybe something like YAML or ToML could bring more readability and flexibility to the config files while standardising the config parser. I still think independent room generators or multiple independent AI "personalities" are better off in scripting, but not necessarily Lua.
Z+Angband dev
Collapse
X
-
dynamic calls are OK in certain limited cases, especially if they allow call-by-name (which is currently done in a crummy way in CPP x-list.h files. It's vastly better than case statements (or lua) but it is not optimal.Leave a comment:
-
Okay then, maybe this will make coding in C a little easier. Forget embedded languages and scripting languages. How about Cello from libcello.org?
It's native C. Usage is drop-in and optional. No embedding or rewriting anything. No additional language. It enables higher level programming in C with dynamic types, eliminates direct usage of pointers, functions accept and return dynamic types and it offers easy object list manipulation. In other words, it allows me to treat C like Python without Python, or like javascript with underscorejs.
Cello is non-standard and would have to be compiled alongside the code. Unless it's included in the codebase and make file, compiling would be more difficult because of this library.
I'm not sure what the benefits of Cello are over C++ though, and it has many disadvantages (no-one else uses it, it's ugly, only compatible with 2 compilers). You can do a lot of this stuff in C++ with much more readable syntax.Last edited by takkaria; February 21, 2018, 13:18.Leave a comment:
-
Yes. Configuration wherever possible.
There are two places where C really gets in the way: the Object code as I mentioned before, and the event listening code, which is really quite ugly.
Leave a comment:
-
Okay then, maybe this will make coding in C a little easier. Forget embedded languages and scripting languages. How about Cello from libcello.org?
It's native C. Usage is drop-in and optional. No embedding or rewriting anything. No additional language. It enables higher level programming in C with dynamic types, eliminates direct usage of pointers, functions accept and return dynamic types and it offers easy object list manipulation. In other words, it allows me to treat C like Python without Python, or like javascript with underscorejs.
Cello is non-standard and would have to be compiled alongside the code. Unless it's included in the codebase and make file, compiling would be more difficult because of this library.Leave a comment:
-
That's something you know best and I can only guess at. Most of the complexity is from Angband itself, but how much complexity is from pointers and limited data types?
Obviously if you were writing a new game, you wouldn't start from here: you'd make different design decisions, you'd have less 'flavour' to retain, and yes, you'd choose a different language. I'd probably write it in Rust if I was going to start from scratch now.Leave a comment:
-
So in summary, T-Engine is a Lua API for rogue-like modules.
Angband is moving to rogue-like modules by text file configuration. Configuration over scripting.Leave a comment:
-
Maybe so, but it's the language Angband is written in. As Derakon indicates, any project that starts off as a complete redo of many thousands of lines of code is so ambitious as to be almost certain to fall short.
A much easier route is to start by making small changes, getting more ambitious as you better understand the language and the codebase. If starting from current V, my ongoing efforts to move stuff from C code out to the text datafiles should help with that.
Note that I'm not suggesting no change for the sake of no change. It's just that I've been doing Angband coding for 12 years or so now - starting from pretty minimal knowledge of C. Feel free to ignore me though - learning from one's own mistakes is usually more effective
And I agree that C can be learned. Troubles with C for me are mostly pointers, pointer to data type conversions and 32-bit / 64-bit compatible code. In other languages I never had to think about these situations.
It is difficult and I have to figure out a lot of stuff myself. This work requires dedicated developers and plenty of developers who would code games won't endure that much. I know plenty of developers who are not this ambitious.
That's something you know best and I can only guess at. Most of the complexity is from Angband itself, but how much complexity is from pointers and limited data types?Leave a comment:
-
I don't think Python would make it a whole lot easier, except for the new object code, which was horribly plagued by stray pointer issues. A lot of complexity in Angband is language-independent.Leave a comment:
-
A much easier route is to start by making small changes, getting more ambitious as you better understand the language and the codebase. If starting from current V, my ongoing efforts to move stuff from C code out to the text datafiles should help with that.
Note that I'm not suggesting no change for the sake of no change. It's just that I've been doing Angband coding for 12 years or so now - starting from pretty minimal knowledge of C. Feel free to ignore me though - learning from one's own mistakes is usually more effectiveLeave a comment:
-
Speaking as someone who tried to rewrite Angband in Python, more or less: it is a ton of work. Especially if you want to do a clean rewrite, rather than just re-implement C code in a different language.
Ultimately, it turned out that I don't care that much about Angband that I was willing to see the project through. I still feel bad for the people here that contributed to the project, only to see it die on the vine...Leave a comment:
-
I think the C language is a barrier for new developers to try working on their ideas for a new variant. It was for me back in 2013. Maybe Lua isn't a good language either for creative feature coding, but there are plenty of alternatives. For example, Python is gaining popularity and is replacing Lua in some game engines and IoT platforms. Python is also used for education and serious work.
If we want variants that offer something unique and different from what we've seen before, then that requires coding and changes to core functionality. Text files only extend or theme what's already in place.
With text parsers maybe we can get new stories in D&D. With scripting, someone should be able to turn D&D into Pathfinder.Leave a comment:
-
Oh gods yes. The way it was done in 3.0 was WORSE than the initial and temporary hack of turning it into a giant case statement in V3.1. It just added a second language AND extra boilerplate. Parsing text files is so much cleaner all around. So is generating code with CPP where necessary.
Leave a comment:
-
As a practical matter, yes, it has been used successfully... but the so has Visual Basic.
[1] ... and you're absoultely, right T2/Angband was not using Lua as a higher level scripting over a high-perf C engine. It was just "let's write C in Lua" (T2) or "let's use Lua to avoid doing a parser for dice-arithmetic" (Angband)... which is pointless and awful.Leave a comment:
-
Lua is used by game engines. Scripted story sequences, scripted levels, complex quests, new game modules, total conversions and in case of Doom 3 I think it was even used for artificial intelligence monster behaviour.
But Angband is a game, not a game engine. It's not like anyone could write a total conversion mod in Lua for Angband, instead that gets hacked into the code in C.
If Angband was really a game engine and Vanilla Angband was a Lua module for the game, then that would a different story. That would be like the T-Engine.Leave a comment:
Leave a comment: