Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old September 18, 2012, 23:54   #1
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,928
Derakon is on a distinguished road
Programming Q&A

We have a wide range of developers here, of varying levels of experience and with varying types of expertise. Some of us are just starting out, or have been playing in a very specific domain (say, a certain large C program) and want to branch out. Others have more experience. It occurred to me that it would probably be a good idea to have an area where we could help train each other. So let's open this thread up to questions, and then whoever feels themselves competent can come in and give advice.

Personally my areas of greatest expertise are object-oriented development and Python, though I still remember a decent amount of C. So come on, hit me.
Derakon is offline   Reply With Quote
Old September 18, 2012, 23:59   #2
Antoine
Ironband/Quickband Maintainer
 
Join Date: Nov 2007
Posts: 1,008
Antoine is on a distinguished road
Does anyone know much about Pygame for Android? (he asked hopefully)

A.
__________________
Ironband - http://angband.oook.cz/ironband/
Antoine is offline   Reply With Quote
Old September 19, 2012, 01:01   #3
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,928
Derakon is on a distinguished road
I have some experience with PyGame in general, none with Android.

My thinking on this thread was that we'd stay somewhat removed from specific technologies and instead discuss strategies and concepts. It's more of a catchup-school for people who never got to take mid- or upper-level programming courses than it is a replacement for, say, StackOverflow.
Derakon is offline   Reply With Quote
Old September 19, 2012, 06:58   #4
Antoine
Ironband/Quickband Maintainer
 
Join Date: Nov 2007
Posts: 1,008
Antoine is on a distinguished road
Quote:
Originally Posted by Derakon View Post
I have some experience with PyGame in general, none with Android.

My thinking on this thread was that we'd stay somewhat removed from specific technologies and instead discuss strategies and concepts. It's more of a catchup-school for people who never got to take mid- or upper-level programming courses than it is a replacement for, say, StackOverflow.

I reread that post three times and all i hear is you offering to debug my Pygame code. I'll email you the source.

A
__________________
Ironband - http://angband.oook.cz/ironband/
Antoine is offline   Reply With Quote
Old September 19, 2012, 10:58   #5
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Antoine View Post
I reread that post three times and all i hear is you offering to debug my Pygame code. I'll email you the source.
Brilliant. I just laughed my cup of tea all over the place.

So, Derakon, my first question is about stats. In Angband, stats are an array which is part of the state struct: p_ptr->state.stat_ind[] ... and the individual stats are #defines.

I thought it would be helpful to define stats in an external file (excuse me but I am unfamiliar with JSON so will use Angband-style config) which could contain things like:

N:1
Label: STR
Name: Strength
Description: An entity's physical strength - important for carrying stuff, hitting things hard and opening doors.
Min: 3
Max: 40

So my question is, is it possible to read that stuff in from the file and then refer to stat[STR] in the code? Come to think of it, I wouldn't know how to do this in C either, but I'm actually interested in Python because I kind of have a hunch that Python can do this.

(Let's leave aside the question of why one would hard-code references to stats which are defined in an external file - one thing at a time!)
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline   Reply With Quote
Old September 19, 2012, 11:23   #6
Mikko Lehtinen
Veteran
 
Join Date: Sep 2010
Posts: 1,246
Mikko Lehtinen is on a distinguished road
Quote:
Originally Posted by Derakon View Post
It's more of a catchup-school for people who never got to take mid- or upper-level programming courses
Mid- or upper level? Hmm.

I'd like to read a book about beginning C programming. It would need to be well and intelligently written, so I could just read it from cover to cover leisurely, maybe taking peeks at the Angband code at the same time.

I've actually managed to code in all the game mechanics I've been able to think of, and I'm getting quite fast at it, but I sometimes have to do things in a very stupid and ugly manner. I care much more about the beauty of the game mechanics than about the beauty of the code, but still... It bothers me a bit.

Programming is only in a minor way related to my work -- text processing and web development are most useful areas.
Mikko Lehtinen is offline   Reply With Quote
Old September 19, 2012, 11:48   #7
Timo Pietilš
Prophet
 
Join Date: Apr 2007
Location: Climbing up from hole I just dug.
Posts: 4,096
Timo Pietilš is on a distinguished road
Quote:
Originally Posted by Mikko Lehtinen View Post
Mid- or upper level? Hmm.

I'd like to read a book about beginning C programming. It would need to be well and intelligently written, so I could just read it from cover to cover leisurely, maybe taking peeks at the Angband code at the same time.

I've actually managed to code in all the game mechanics I've been able to think of, and I'm getting quite fast at it, but I sometimes have to do things in a very stupid and ugly manner. I care much more about the beauty of the game mechanics than about the beauty of the code, but still... It bothers me a bit.

Programming is only in a minor way related to my work -- text processing and web development are most useful areas.
I have had some c courses, but my teacher was a nutjob that didn't have a clue about programming. To get an equivalent of "A" (not our scale) you just needed to indent your nonsense code by three spaces and make it look pretty. It didn't matter did the code actually work or even compile, just remember to indent by three spaces. And remember to never ever ask anything about your code (you ended up with even more crazy coding assignment and never got an answer to your question).

I have learned c much more by examining angband code than I ever did in that course. Not that I have learned much by examining that code. Just more.

To Q&A about angband code is how do you know which file does what and how to follow the flow of the code (flowchart??) to figure out what you need to change in order to actually change the thing you are changing.
Timo Pietilš is offline   Reply With Quote
Old September 19, 2012, 11:53   #8
Mikko Lehtinen
Veteran
 
Join Date: Sep 2010
Posts: 1,246
Mikko Lehtinen is on a distinguished road
Quote:
Originally Posted by Timo Pietilš View Post
To Q&A about angband code is how do you know which file does what and how to follow the flow of the code (flowchart??) to figure out what you need to change in order to actually change the thing you are changing.
grep is my best friend.
Mikko Lehtinen is offline   Reply With Quote
Old September 19, 2012, 11:57   #9
Timo Pietilš
Prophet
 
Join Date: Apr 2007
Location: Climbing up from hole I just dug.
Posts: 4,096
Timo Pietilš is on a distinguished road
Quote:
Originally Posted by Mikko Lehtinen View Post
grep is my best friend.
In order to use grep you need to know what you are searching. My question goes one step up from that: how do you know what to search?
Timo Pietilš is offline   Reply With Quote
Old September 19, 2012, 12:12   #10
Mikko Lehtinen
Veteran
 
Join Date: Sep 2010
Posts: 1,246
Mikko Lehtinen is on a distinguished road
I can't google up Leon Marrick's article "Caveman Guide to Angband Programming". It was really useful to me. I think it used to be in Thangorodrim, and the site seems to be down. Does anyone have a copy of the article somewhere? Let's put it back on the web!
Mikko Lehtinen 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
New to Angband programming BreathesFire Development 14 October 13, 2011 18:33
Ironman Q & A miyazaki Vanilla 1 August 24, 2009 03:23
Fear & AC-bonus miyazaki Vanilla 2 August 19, 2009 16:29
Windows Programming Question Kyle Development 5 July 29, 2009 04:52
Morgothian programming language zaimoni Idle chatter 2 April 22, 2009 10:26


All times are GMT +1. The time now is 17:13.


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