Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old February 21, 2018, 04:44   #51
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,858
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by droof View Post
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.
What an interesting library! I have wondered about if you could do something like this with C so it's fun to find out someone has. Why people think a weak type system is a feature is beyond me though, it introduces a whole class of errors into your code that you can only detect at runtime.

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.
__________________
"Physician, heal thyself."

Last edited by takkaria; February 21, 2018 at 13:18.
takkaria is offline   Reply With Quote
Old February 21, 2018, 05:23   #52
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,906
Donated: $40
Pete Mack is on a distinguished road
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.
Pete Mack is offline   Reply With Quote
Old February 21, 2018, 14:03   #53
droof
Apprentice
 
Join Date: Dec 2013
Posts: 71
droof is on a distinguished road
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.
droof is offline   Reply With Quote
Old February 22, 2018, 04:42   #54
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
Quote:
Originally Posted by droof View Post
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.
Well, that's the case of "doctor, it hurts when I do that"

Quote:
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?
Just use ints. As for strings, don't use wchar_t, these things are indeed a headache (they can be 16 bits or 32 bits). Strings in C are bad, that's just how it is.
t4nk is offline   Reply With Quote
Old February 22, 2018, 05:52   #55
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,906
Donated: $40
Pete Mack is on a distinguished road
There really shouldn't be any int to pointer conversion in Angband (except in the really old-school winapi.) When there is such conversion, always use size_t as the integer type. That's pretty much it.
Pete Mack is offline   Reply With Quote
Old February 22, 2018, 13:04   #56
mixer
Scout
 
Join Date: Dec 2011
Posts: 25
mixer is on a distinguished road
The different languages

As a long time programmer I give a little insight into your troubles. C was originally designed for very low level, just above machine code, for writing operating systems in. Along came C++ which built on C and with the thinking behind other languages like smalltalk i.e. object orientated, but again not really meant for writing user facing programs. After this people had Visual basic, then java and c#. These are all before we get into scripting languages like python.
So for C manipulation of memory was a primary point and the fore runner languages had no type checking, so C was better.
C++ is still a low level language but follows a different concept, object, rather than the functional style C.
Converting from C to C++ is interesting and converting from C++ to C is even more fun. I have done both in my lifetime.
The best language to write Angband from scratch would in my opinion be C# or Java. They are nearly the same and are easy to follow and code in.
I would not suggest we move the development of Angband to either as legacy code is painful to unpick. If you want to improve things then write front ends in a language that can use the current code. Personally, I don't have the time or energy to do so.
mixer is offline   Reply With Quote
Old February 25, 2018, 21:20   #57
droof
Apprentice
 
Join Date: Dec 2013
Posts: 71
droof is on a distinguished road
I have some success with using data types limited to int, uint, char, uchar and the cptr and vptr pointer types. Slowly I'm getting better at this, very slowly.

I've played a bunch of Z+Angband and Debian's patched Zangband 2.7.5. Z+Angband has more modern features, but I'm not having much fun playing it. I don't like Z+Angband.

What captures my imagination in Zangband is exploration and the possibility of a quest centric game, more like how a skyrim or world of warcraft would play. Right now, quests are rare, but I can tweak the game so that towns have multiple castles and a selection of multiple quests. I would also be interested in adding more houses with mini-games, like the casino.

The problem I have with Z+Angband is that most quests are kill quests, requiring me to clear out levels while searching for all hidden doors and find that last monster. These quests are no fun for me and they are always too high level for my character, so I'm often forced to level up in the main dungeon.

Zangband 2.7.5 is much more open-ended in quests. Hunt down a bounty, make a delivery, discover a place or retrieve an item, as a player I can pick my own quests and complete them however I feel like. Meanwhile I discover more of the world and find interesting sites on the map like ruins, camps and clearings. Each with their own dangers and rewards. Increasing the number of quests here could work and having the character advance through the quests. The rewards probably need re-balancing then. I'd add more mini-games. Maybe porting over some of the friendband speech and town themes to give the game more personality, because now it's just "some world with towns with blubbering idiots". Shouldn't be too difficult to improve on that and I have the util code anyway

Z+Angband has more modern features, but if I'm going to make small changes while learning C and enjoying the playthroughs, I'd have to pick old Zangband instead. I don't think I can achieve that with small changes in vanilla Angband, not yet at least.
droof is offline   Reply With Quote
Old February 27, 2018, 01:28   #58
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,858
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by droof View Post
I have some success with using data types limited to int, uint, char, uchar and the cptr and vptr pointer types. Slowly I'm getting better at this, very slowly.
Ah I forgot about those weird types that old bands have – I got rid of all of them when I was maintaining V. If you search and replace cptr with const char * and vptr with void * you might find the code easier to work with.
__________________
"Physician, heal thyself."
takkaria is offline   Reply With Quote
Old February 28, 2018, 22:25   #59
johnretroreload
Rookie
 
Join Date: Feb 2018
Posts: 20
johnretroreload is on a distinguished road
Good points indeed, especially 2.7.5 vs Z+
I felt the same, for me zang was always about exploration, freedom and progression through quests (variety).
I never liked the forced progression as you say with quests when introduced v2.0+
I really look forward to your changes given your comments so far. Let me know if I can help.

Quote:
Originally Posted by droof View Post
I have some success with using data types limited to int, uint, char, uchar and the cptr and vptr pointer types. Slowly I'm getting better at this, very slowly.

I've played a bunch of Z+Angband and Debian's patched Zangband 2.7.5. Z+Angband has more modern features, but I'm not having much fun playing it. I don't like Z+Angband.

What captures my imagination in Zangband is exploration and the possibility of a quest centric game, more like how a skyrim or world of warcraft would play. Right now, quests are rare, but I can tweak the game so that towns have multiple castles and a selection of multiple quests. I would also be interested in adding more houses with mini-games, like the casino.

The problem I have with Z+Angband is that most quests are kill quests, requiring me to clear out levels while searching for all hidden doors and find that last monster. These quests are no fun for me and they are always too high level for my character, so I'm often forced to level up in the main dungeon.

Zangband 2.7.5 is much more open-ended in quests. Hunt down a bounty, make a delivery, discover a place or retrieve an item, as a player I can pick my own quests and complete them however I feel like. Meanwhile I discover more of the world and find interesting sites on the map like ruins, camps and clearings. Each with their own dangers and rewards. Increasing the number of quests here could work and having the character advance through the quests. The rewards probably need re-balancing then. I'd add more mini-games. Maybe porting over some of the friendband speech and town themes to give the game more personality, because now it's just "some world with towns with blubbering idiots". Shouldn't be too difficult to improve on that and I have the util code anyway

Z+Angband has more modern features, but if I'm going to make small changes while learning C and enjoying the playthroughs, I'd have to pick old Zangband instead. I don't think I can achieve that with small changes in vanilla Angband, not yet at least.
johnretroreload is offline   Reply With Quote
Old March 12, 2018, 09:34   #60
johnretroreload
Rookie
 
Join Date: Feb 2018
Posts: 20
johnretroreload is on a distinguished road
Continuing development on 2.7.5 learning from Z+

Anyone interested in this project?
johnretroreload is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Angband 3.5-dev Magnate Vanilla 70 July 2, 2012 16:47
Escape key bug in Angband dev version 21 Dec 2011 revision 700d8c8 Shockbolt Development 2 January 7, 2012 10:12
Looks like a new Angband Dev Blog is up. (17.8.2011) CJNyfalt Vanilla 23 August 20, 2011 16:46
angband-dev@oook.cz down? d_m Development 2 August 4, 2010 16:47
New to Angband Dev shinobibear Development 10 June 10, 2010 18:11


All times are GMT +1. The time now is 00:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.