Jump to content

  • Log In with Google      Sign In   
  • Create Account


Dubya

Member Since 11 Dec 2011
Offline Last Active Aug 10 2014 02:47 PM

Posts I've Made

In Topic: Program Concept Help Needed

07 January 2013 - 09:10 PM

Mercurialol: The idea of the three dimensional array would be an x- y-axis with a z component representing depth.  This was my original thought for creating a three dimensional space that could represent a galaxy.  My concern is that every single [x][y][z] space would represent a Solar System which would include several planets, and each planet includes several territories.  With so much space for the galaxy, this could add up to a lot of memory.

 

Magnus Westin: This is an awesome suggestion, and I've never heard of octree.  I took some time to read the wiki article you provided at work today, and it definitely seems like it would be more efficient from a memory standpoint.  If I understand correctly, the first octree would be the galaxy, with the eight octants serving as maybe sectors, then subsectors, then planets, then territories.  I'll keep researching!

 

Poigahn: The level of randomization would strictly be limited to throwing in solar systems for a starting point.  From there, I'd like to have total control as to creating new solar systems of our own invention, as well as maintaining income, etc.  I'm not looking at having multiple users over a LAN, but it's something that might be useful.  Do you have any documentation I could read to research this?

 

Thanks for the replies!


In Topic: To Start Anew?

12 December 2011 - 10:15 PM

Some questions about how far I've gone with C++, so I thought I'd include a description of the text game I had worked on for a little over a month I'd say. The game is called Gangland, I imagine most people are familiar with games where you buy a drug from one dealer and try to sell it at a profit somewhere else (I'm still not crazy about centering the game on drugs, and I actually considered converting it to a space smuggler setting or something like that. Anyway, it was just to challenge myself and I never intended it to be public or anything so I kept the drug theme haha). At this point, it has a class "Dealer" which includes the dealer's name, city, and several arrays that include his chances to have a certain drug on any given day, base price, a random price adjustment, quantity of each drug. Essentially, each dealer has a base percent chance of having a drug in stock, and a base quantity. The game cycles through the entire array using a for loop, determines with a random number whether the dealer has the product, and, if so, rolls again to add base quantity with the random quantity.

The game has menus that include: Travel (to a city), Visit (one of four dealers within a city), Gas (visit the gas station), Check Supplies (menu of items, money, total car mileage, gas tank, etc), Quit. I figured time by having every action take x number of minutes and breaking minutes into hours -> days -> months -> years. Each dealer has his own trigger for getting a new line of products. The first guy refreshes his stock every day, but others may only refresh every week or so. I also have booleans to prevent the player from traveling to all the cities or all the dealers. Essentially, my plan was for the player to develop relationships with the dealers who would then introduce them to new dealers. Travel between cities takes its toll on your money, the condition of your car, etc. I also wanted to implement law, and I was in the process of adding a city class which would track the local economy and police presence, among other things. All the menus and game options have been checked for errors; i.e. you can't fill your gas tank past full and you can't have less than 0 gallons, you can't buy anything unless you have sufficient money, and you can't buy anything unless the dealer has it in stock.

All this is included in 1060 lines of a single .cpp file. When I started the "beta" project, I wanted to have files included in main. However, I'm not sure I really have any idea what should be in my main .cpp and what should be included from another file. I also wanted to implement some inheritance to dealers, perhaps having sub-classes like "Small Time Dealer" and "Cartel Member" and so on. Hopefully this gives a little idea of what I've done with C++ so far. Thanks for all your posts so far. I'm beginning to feel motivated to start learning again.

In Topic: To Start Anew?

11 December 2011 - 02:53 PM

The problems you are having aren't related to language, but of setting up a project. You want to get SFML working in a code::blocks project, which isn't too difficult IF you know what you are supposed to be doing.

Let me point you to a project I made using SFML in my blog:
http://2dgamemaking....is-started.html

You'll see some snapshots of where I setup the compiler settings and the linker settings for SFML (and other libraries). I use SFML, but I would suggest you stick to SFML 1.6 since it's fully stable.

The main points from the link above is making sure, after setting up a simple console application, in the Project->Build Options window:

In the linker setting, you want to make sure you include, in other linker options the -lsfml options I listed.
What this means is, your project will be using the SFML libraries when it links. Compiling is the act of taking a single source file, and compiling it into machine code, but linking is the act of taking all the compilers output (including libraries, which is a combination of many compiled files) and tying it all together into a single binary executable.

In the Search Directories, under the Compiler tab, you want to make sure you include the folders that hold the include folders for SFML. This is so the compiler knows where to look for the files you #include
Also in Search Directories, under the Linker tab, you want to point to the directory where the SFML libraries are located. Typically it's in the bin/lib folder, and the libraries end in .a or .dll (occasionally you'll see .lib extensions).

Once you do that, continue in that post, and there's some example code of setting up a simple SFML window.

Good Luck.


OMG! I remember playing SmashTV! I used to play the 1-player/2 controller setting on Nintendo. Good stuff. I'm going to take a look at your link and give it a shot. Though it might be a couple days, I'll post back with results. Thanks for the link!

I do need to learn how to set up projects. I imagine that will be an issue regardless of what language I use. The text game I wrote was all in one .cpp file, which might suggest how limited my knowledge is when setting up a program. I started to re-write it using .h files for my classes, but honestly didn't have the motivation to re-write the whole thing. Maybe something worth re-visiting?



In Topic: To Start Anew?

11 December 2011 - 02:25 PM

I'd look into C# or python. You've learned enough programming that the jump won't be too much of a step backwards and you'll quickly appreciate how much pain C++ has put you through.


I've been wondering about this. I actually don't think of C++ being hard, but I'm starting to think it's because I don't have anything to compare it to. Just as you said, I might make a switch and then realize how rough C++ can be. It seems like Python is really popular, but would C# be an easier conversion considering my C++ experience? On a side note, major noob question, is C# pronounced "C number"?

I was reading about Roguelikes, and I did see quite a few of them are written in Python. I think I'm really leaning towards a switch here. It's not like I couldn't switch back to C++ in the future. In fact, my understanding is that Dwarf Fortress was written in C# and converted to C++.

Does anyone have suggestions for learning programming? I really learned a lot from writing my text based game. Did anyone try using a specific program idea to help learn the skill?

PARTNERS