Jump to content

  • Log In with Google      Sign In   
  • Create Account

Jaap85

Member Since 01 Sep 2011
Offline Last Active Oct 27 2014 02:45 PM

Topics I've Started

The next step?

20 July 2014 - 01:18 PM

Good evening everybody,

 

A few years ago (about 2) i got back into game development after only having toyed around with it when i was a teenager. My objective is absolutely not to make any commercial quality games or even make money by developing games, i just love to try and build stuff that runs on my computer screen and games are the things which interest me most.

 

After reading a lot of posts on these forums i created my first few (relatively simple) games. Of course I started with Tic-Tac-Toe, then moved on to a really small 2D action game where you had to throw presents down chimneys (based on the Dutch concept of Sinterklaas) and finally some 2D tilebased games (an RPG and a small business simulation game). 

 

While i really enjoyed making these games, i also ran into a problem. Right now i am able to create small games (of course only to my own standards), but when i try to make something bigger, i mostly run into the problem that i lose control of my code. My code gets messy and i can no longer find all the classes, methods and objects i created. 

 

I would really like to solve this issue but i am not sure how to do this. I learned programming by reading some online tutorials and then just jumping in head-first. Another thing that really helped me was the MOOC Beginning Game Programming using C#. I would really like to continue learning to fix the problem mentioned above, but most resources available seem either too advanced for me (and therefore irrelevant) or too simple (since i am just past the beginners course).

 

Does anyone have an idea how i could procede in this situation? I realize the question is kind of vague, but maybe someone who struggled with the same issue could offer some advice.

 

Thank you very much in advance for your response!

 

 

PS. My current programming language is C# (XNA) and for the games i want to make, well let's say i prefer Civilization over Call of Duty; Football Manager over FIFA and HearthStone over WoW. I hope that says enough ;-)

 

 

 

 


Class inheritance?

29 December 2013 - 09:57 AM

Hello everybody,

 

It's been a while since i have visited this forum, good to see it is still so active.

 

I have recently picked up game programming again and i am currently working in C# (XNA). I try to create a simple flying shooter game (Raptor clone).

 

Right now i am implementing the enemies and i would like to know what the best programming standard is for implementing the different types of enemies. I have already created a class "Enemy" which holds all the functions and variables needed for the enemies (such as the movement function, etc.)

 

I will create different subtypes of enemies, which differ in (for example): image, speed, firing rate, hitpoints, and so on.

 

What is the best way to implement is? I was first thinking of creating a separate class for each enemy type, which inherits from the enemy class, but that might be cumbersome.

 

Another option could be to just use the enemy class and assign every enemy a type when it is constructed, then work with lots of switch statements in the class based on the enemy type.

 

Is this the best way? Or is there a better way to do this? I feel a better way should be possible, but i cant really figure out how yet.

 

Thank you in advance for your replies. 


Freeing up memory

26 September 2012 - 02:43 PM

Hello everybody,

I just created a small test program to see how it would worked after i compiled it. The program was created in Visual Studio using C#. The main thing it does, is adding content from a web page (by reading html source code) to a list.

At some point in the program, i try to remove items from the list (to clear memory usage). However, i run into a problem. I want to remove all items in a list that meet a certain criterium. My code is as follows:

foreach item in list:
> if item.status meets criterium
> list.remove(item)

However, this code doesn't work. The error i get is that i am not allowed to alter the list inside the for loop.

How could i fix this problem? Right now my (very simple) program uses about 2 GB of memory after running for an hour or so.

Thank you very much for your ideas and advice!


PS. if removing items of the list probably won't fix my memory issues i would be happy to hear any other ideas or tips.

Storing data

14 August 2012 - 02:35 PM

Hello everybody,

Once again i am struggling with a question i hope to find some answers for.

In my project, i work with a lot of classes, mainly containing other classes, which contain mostly strings and integers. The size of my data is approximately as follows:

x events
in each event, approximately 8 markets
in each market, approximately 100 measures
in each measure, approximately 20 variables (integers and strings).

Since both events and markets also contain a few other variables, the approximate number of variables to store for each class is about 20.000. I intend to store up to a maximum of 1.000 events, therefore storing at maximum about 20 million values.

I wonder what would be the most efficient way to be able to store this data in one session and then load them back to use them in another session. The method i thought of myself was to create a XML file for each event and store the data in that file. Unfortunately i dont have any experience with data storing or using XML whatsoever, so i just wondered if this would be a reasonably effective way to store data. Any insights in this problem would really help me.

Since i am storing the data locally and mainly for myself, data access or protection is absolutely not an issue. Storing and reading speed is also not a really large issue, as long as it takes under a minute. The most important thing to consider is that i am a really unexperienced coder who is looking for a relatively simple solution. Also it should be a flexible method which allows me to add (for example) some measures to a market or remove some variables to a measure.

Thank you in advance for your ideas and opinions.

By the way, i work in C# using Visual Studio.

C# List<t> problem when adding Classes to it

12 August 2012 - 07:40 AM

Good afternoon everybody,

i am writing a program that gathers data at certain moments in time (for example: after every 30 seconds). This data is organised into classes.

So what i want to have eventually is a List of Classes. This itself is not a big problem, since i can easily create a list. The one thing i don't get is when i add items to the list. Let's say i have the following List:

List<Market> listMarkets = new List<Market>();

That list works just fine.

Now let's say i want to add a Market to the list of markets every 30 seconds. How do i name this Market? So far i have created an array:

Market[] MarketArray = new Market[100];

Now at every time update, i create a new entry into the array and then add that to the list. This is (as far as i know) the only way to give the new entry a unique name. Is this correct or is there a simpler way?

I feel like it should be able to work without using the array and just adding the new item to the list directly (like you can do with strings), but i cant figure out how to make sure that my class has a unique name.

this might be a bit vague, but i hope anyone can help me. Any thoughts or ideas are appreciated.

PARTNERS