Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Dwarf Fortress and learning to program something similar  (Read 6394 times)

Tolian

  • Escaped Lunatic
    • View Profile
Dwarf Fortress and learning to program something similar
« on: October 03, 2008, 05:50:20 pm »

First of all I am under no illusion that I could ever hope to match the brilliance that is DF.  I am however very much inspired by the efforts of Toady One, and for my own personal hobby I would like to create a little virtual world of my own.

I'm not a complete noob, but I couldn't call myself a 'real' programmer.  I have about 8 years experience with Visual Basic, and web-scripting languages, with a strong emphasis on data and databases.  I don't have a lot of game development experience but I figure that since I'm familiar with most of the really boring stuff such as Object Orientated coding and datatypes, I have a good foundation of knowledge to build on.

I'm after advice from some 'real' programmers, who might point me in the right direction for which language and libraries to use, and also the tools.   A lot of people say 'learn C++', but there seems to be many variations of the language, and many different compilers to use, and perhaps being spoiled by the bloated but user-friendly VB has made me reluctant to dive into the rather arcane C language.   And then there's so many different libraries, like SDL, but would it not be more beneficial to learn DirectX?

I am thinking not just about learning game-programming as a hobby, but as a distant hope that I might one day take it on as a career.  That's very long term though, and probably just a stupid dream of mine =)

For some reason, creating a 'world simulator', doesn't seem like the kind of thing that would be practical to write in Visual Basic, but then, I'm not a real 'coder', like the C++ people =)

I want to write fast, efficient, tight code with a small footprint - yet isn't bogged down with having to write 100s of lines code just to get a sprite to be displayed on the screen - or writing functions that are already written in the high level languages that I use today.

If anyone has any advice, I would be very greatful.
Logged

a1s

  • Bay Watcher
  • Torchlight Venturer
    • View Profile
Re: Dwarf Fortress and learning to program something similar
« Reply #1 on: October 03, 2008, 06:00:41 pm »

For some reason, creating a 'world simulator', doesn't seem like the kind of thing that would be practical to write in Visual Basic
It really doesn't matter what you write the "logics engine" in (so long as it isn't ASM), which is going to be most of what you'll have to code. and you already know how VB works, so I wouldn't abandon it right away...  (however if you want to borrow other people's code, C++ is a must, Lobachevsky approves of C++)
I want to write fast, efficient, tight code with a small footprint
don't we all? ;)
Logged
I tried to play chess but two of my opponents were playing competitive checkers as a third person walked in with Game of Thrones in hand confused cause they thought this was the book club.

Tolian

  • Escaped Lunatic
    • View Profile
Re: Dwarf Fortress and learning to program something similar
« Reply #2 on: October 03, 2008, 06:51:42 pm »

Can VB do the game logic as fast as C++?

Lets assume I'm writing the logic for generation of a random world in Visual Basic.  I've got some algorithms that raise pointy mounts, carve out deep seas, and run deep rivers.  Then I start populating the world with entities, lets say for the sake of simplicity they are Dwarves.

So far this is all just all in memory, no graphics drawn, just variables.

For each tick of game time, an AI procedure is ran for each Dwarf, which tells it what to do, based on his surroundings.  So for example, if he knows an elephant is close, and his personality = coward, he runs.

Visual Basic is basically comparing data vs data, multiplied by how many objects are in my Virtual World.

Would C++ do this logic part faster?  Because if it can handle logic faster, that would mean I could do more calculations per frame, basically meaning I can have a more complicated and larger world.

If they're the same, then great, I can do my virtual world in VB and not worry that it's spending cpu cycles doing something not related to my game, like polling for Windows drag-drop events or something, or talking to Microsoft Office to see if they would like to have lunch some time, or checking every object of data in my simulation to see if it's not going to break windows?

I suppose I'm getting into some really technical details here.

Logged

Dasleah

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress and learning to program something similar
« Reply #3 on: October 03, 2008, 06:57:13 pm »

Well, if you've got experience in web and databases, odds are that means PHP, which is close enough to C++ that the transition won't suffer from too many hiccups. And C++ is really the place you want to go if you want the leanest and fastest programs - there's a reason why it's so well used (and believe me, it sure as hell ain't for its documentation)

If you want to just sit down and code (which is what I recommend) then I suggest something like Python + Pygame (or Pyglet) or C# with XNA. All are free, straightforward, and will at least get you popping up a window with a main loop in under 5 minutes (hell, 5 seconds in XNA) which can take ages with straight C++. Python comes with IDLE for development, and to get XNA you have to get the C# 2008 Express Edition, which is a great free IDE, and isn't crippled in any way that would hinder you from making a game.

The documentation for both is extensive, especially XNA. It's probably the best documented Microsoft product that I've ever used, and the library for it is growing every day. Pyglet is well documented, too, better than Pygame, but isn't as widely used.

If you want to develop professional skills for pursuing a career, then I say learn a little of both. Learn Python for things like AI programming, mod scripting and networking (with something like Twisted). Learn C# because that's where the future is going, I find, and the professional market for that is booming, mostly because Microsoft has taken the rather bold step of making it free for anyone who wants to use it, so the indie and homebrew adoption will drive the market forward and these developers of tomorrow move into the industry. However, the end-game is still C++.
Logged
Pokethulhu Orange: UPDATE 25
The Roguelike Development Megathread.

As well, all the posts i've seen you make are flame posts, barely if at all constructive.