Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


nobodynews

Member Since 30 Dec 2000
Offline Last Active Yesterday, 09:51 PM

#5193303 Question with regards to my video game

Posted by nobodynews on 17 November 2014 - 02:53 PM

Each item will have certain attributes to describe the item. These attributes could include weapon type, weapon strength, and model name associated with the weapon. These attributes can either be generated randomly (based on conditions like player's level or item location) or the item could be created manually and stored in a file somewhere on the player's hard drive. In either case, at some point this information is stored in computer memory after being generated or loaded from file. So say on the computer harddrive there was a file which describes the following weapon:

 

Name: Sword of Swordliness

Type: Sword

Associated Model: swordliness1.model

Damage Modifer: 25

Cost: 5

DropRate: 3%

 

Then the merchant might have a list of items like this stored somewhere:

Sword of Swordliness

Mace of Pepperspray

Death Chicken

Harbinger of Satan

etc

 

The player would go the merchant and then the merchant file would be opened and the code would go through it and go "This merchant has Sword of Swordliness. Let me look for that in that other list, the list. Found Sword of Swordliness in that list. This item uses the model named swordliness1.model. Let me open that model and display it to the user". Then the code continues and does that for all items in that merchants list. After the user selects the items they wanted and exits, the code says "remove this merchant from memory" and that step would then go through all items that were loaded and the remove THEM from memory. The model would only be in memory when there is a reason to display it. When it needs to be displayed again it gets loaded again. Of course its usually more complicated than this. Sometimes the programmer doesn't remove stuff from memory that isn't used either on purpose or on mistake. Loading something from a file takes time so programmers like to keep stuff in memory when possible, but since memory is limited they have to figure out how to balance this.

 

Ok now all that said let me try answering your actual questions.

 

1. The source of the data is up to the programmer and there's an infinite number of ways it can be done. Anything from the game scanning its directory for files it knows how to read to all data being hardcoded in the code. The files could be html. They could be xml. They could be binary blobs of data generated by tools created by yet other programmers.

2. Probably. Depends on what engine you're using and the programmer of said engine. As I said above, most any game worth its salt wouldn't even load the model unless there was a reason to.

3. They'll be stored on the harddrive waiting until something decides to display them.

 

Question: are you using a game creation engine like Unity? If so you might want to specify the engine so you can get more specific responses.

 

edit: formatted post




#5193266 Magical mysterious impossible null reference exception

Posted by nobodynews on 17 November 2014 - 09:42 AM

First, are you sure the object 'parts' in both methods are in fact the same object? Consider this example snippit of a console program:

    class AlphaClass
    {
        public int x;
    }

    class Program
    {
        static void Main(string[] args)
        {
            AlphaClass alpha = null;
            BetaFunction(alpha);
            GammaFunction(alpha);
        }

        static void BetaFunction(AlphaClass alpha)
        {
            alpha = new AlphaClass();
            alpha.x = 10;
        }

        static void GammaFunction(AlphaClass alpha)
        {
            Console.WriteLine(alpha.x);
        }
    }

This will crash on Console.WriteLine because the alpha in BetaFunction is a different alpha from GammaFunction.




#5193181 Question with regards to my video game

Posted by nobodynews on 16 November 2014 - 08:55 PM

A lot of this depends on how realistic you want the game to be. If you want it to be very realistic you wouldn't even give the player the ability to hold 20 weapons in their inventory. It would be more like Gears of War style where you can hold a few guns and those get 'stored' on the character's back in designated spots when not in use. Less realistic methods would just draw the currently held weapon and ignore the 'inventory' entirely, unless the user is in a menu where they can see all items in their possession. This would be more like Fallout 3 (and newer). The only impact having a large inventory has in the Fallout universe is at a certain point the player would slow down if they had too much stuff.

If you're asking how this is handled from a programming perspective: it's whatever the programmer decides. Nothing is ever drawn to the screen unless the programmer accounts for it. Where do the 20 weapons go? No where. They are just a small list of data. Its similar to a shopping list in that it's all just references to the real thing... or in a game's case, references to the model and animation.

So for merchants if you have weapons you'd need to come up with the right lists. If you don't want all their inventory out at all times you have to decide what weapons you want out, when. These lists might be as simple as text files. Formatted properly, the programmer can interpret them so the game decides when the merchant can display them.

Hope this helps a little. Without more specific information it's hard to tell what you're looking for.


#5193030 Best Way to Learn 3D Computer Graphics? Help!

Posted by nobodynews on 15 November 2014 - 04:28 PM

I think most likely they meant "personal". I could see how a non-native speaker might use "private" instead of the more apt "personal". Or even a native speaker just having a brain-fart.


#5192457 Building A Game Engine + Game

Posted by nobodynews on 12 November 2014 - 12:44 PM

Call me old fashioned, but only wimps have to rely on an engine

You're old-fashioned. Seriously though, no need to resort to name calling. No one insulted you, they were just disagreeing. You don't serve your arguments very well by being so judgmental of people who do it differently than you would. As for Tim Sweeney, if he came to me back in day saying he had no experience programming and he wanted to make a game engine I'd have said "what's a game engine?" because they didn't really exist back then. Tim Sweeney got where he is by being into programming a young age and working on it for years and making more and more complex games as he went on. Back then just making a text based game was impressive because that's all anyone was making. It's easy to be enthusiastic when you have little competition and expectations were low from consumers. Not to mention he had been into computers and programming for around 20 years before Unreal was released. All that being said I think the 'build a kitchen' analogy was weak. A better analogy might be growing your own ingredients to be a chef. Believe it or not there are chefs who do this! But I wouldn't call a chef who doesn't do that a 'wimp'. I think it's macho posturing to insist there's one true way to make games and those who don't do it that way aren't good enough. If the OP wants to make engines I say go for it and if they just want to use Unity go for that too and if they start one way and switch later because they realize they'd prefer the other way, I say go for that too.


#5189816 Finished c++ primer plus and console. Now I want to make a 2D tile game!

Posted by nobodynews on 28 October 2014 - 04:29 PM

Far be it from me to tell someone who *wants* to learn Win32 to not learn it, but for a beginner who wants to make a 2d tile game? Using something like SDL or SFML makes about 10x more sense than Win32.


#5189437 Questions from a newcomer

Posted by nobodynews on 27 October 2014 - 10:36 AM

You'll have to be a little more specific. What would your role be in the creation of that kind of game? Do you want to be the lead who guides a team of people in making a game of that style/scale? Do you want to be the guy that figures out the technology behind the scenes on how to display the graphics? Do you want to be the guy that decides what those graphics looks like? Do you want to write the storylines the player experiences when playing the game? I'm guessing you want to be the visionary since you indicated you wanted to create the game rather than saying you wanted to just work on making a game for someone. Usually the lead person comes about because they either helped someone else with their games or because they made their own games. Either way you need skills applicable to the creation of a video game. These are of course usually either programming or artistic roles. Of course it's never a bad idea to know a little about programming when you're an artist or a little about being an artist when you're a programmer. If you want to go the programming route you should pick up a programming language (there's plenty of topics about that). If you want to go the artistic route you could look into modeling programs such as Blender and find modding communities for games you like so you can show off your skills as you learn how to model, for example. In any case you want to make a portfolio of completed projects. "Here's what I was able to program!" "Here's what I was able to draw!" "Here's what I was able to model!" For programming you'll likely progress from making text-only programs to 2-d graphical programs to 3-d programs. You'll learn mathematics such as trigonometry and linear algebra as you go along. Hopefully some of that is helpful.


#5186522 where are the 4 addresses of an integer

Posted by nobodynews on 12 October 2014 - 12:01 PM

What language? Probably C or C++, but I don't like being a mind reader. I believe you are trying to ask how to get the memory address of each memory element (call it a byte) in an integer, assuming that integer uses 4 bytes to compose that integer. I say "assuming" because, although it is common for int to have a size of 4, it isn't guaranteed to be. Since this sounds like homework I'm afraid I'm not going to directly answer your question. Instead, I will point out that you should consider the address-of operator operator, '&'. Once you know the address of a variable, do you know how to get the following address of that int? It would be 4 bytes following, right? What if you had 'char n' , got the address, and then got the following address? It would be 1 byte following, right? Is there a way you can get the address of an int and treat it like you got the address of a char?

 

Hopefully by understanding the answer to the first question the answer to the second will be easier to comprehend and answer.




#5186519 how to redimensione (ReDim) an array in C++

Posted by nobodynews on 12 October 2014 - 11:50 AM

You don't; not directly. You use std::vector.




#5186517 Rotating point around point in 2D

Posted by nobodynews on 12 October 2014 - 11:45 AM

 

I take this opportunity to plug complex numbers

 

Are you using complex numbers because they happen to be a pair of floats/doubles, or is there something about complex numbers that make them well-suited to this use? I'm rather ignorant of math. How is typedef'ing a std::complex better than typedef'ing some other kind of two-float class?

 

If you look at rotate_around_center Alvaro utlized the properties of complex numbers to achieve the rotation. The only use of trig was in capturing the initial angle of rotation as a complex number. You may be interested the article AVisual, Intuitive Guide to Imaginary Numbers.




#5177046 SDL Memory Leak

Posted by nobodynews on 30 August 2014 - 05:45 AM

You have two calls to SDL_CreateTextureFromSurface but only one call to SDL_DestroyTexture.




#5171412 multiple source files and global varaibles.......................

Posted by nobodynews on 04 August 2014 - 09:10 AM

My problem is with my global variables which I was trained to utilize the most.

I'm curious what you mean by this. I've only heard train and globals used together when saying you should train yourself to not use them.


#5169646 Do GL and DX 'go through' the Windows GDI?

Posted by nobodynews on 27 July 2014 - 07:52 PM

http://en.wikipedia.org/wiki/Graphics_Device_Interface#Windows_Vista

 

In Windows Vista, all Windows applications including GDI and GDI+ applications run in the new compositing engine, Desktop Window Manager which is built atop the Windows Display Driver Model.

 

http://en.wikipedia.org/wiki/DirectX

 

Direct3D 9Ex, Direct3D 10, and Direct3D 11 are only available for Windows Vista and newer because each of these new versions was built to depend upon the new Windows Display Driver Model that was introduced for Windows Vista

 

So, for at least Windows Vista and newer operating systems, GDI and DirectX are built on top of the Windows Display Driver Model, DirectX more directly. I'm not sure what Windows did before Vista, but I'm almost 100% certain DirectX bypassed GDI.




#5167522 C++ smart pointer usage

Posted by nobodynews on 17 July 2014 - 11:29 PM

I'm not sure what you did that 'broke all of [your] functions that had that vector being passed in', but you should be able to just pass in the std::vector of std::unique_ptrs as a reference. I tested it to be sure (and utilized typedefs; I'd suggest doing the same if you'd like fewer nested brackets):

#include <iostream>
#include <memory>
#include <vector>

class Planet
{
public:
    int X;
    int Y;
};

typedef std::unique_ptr<Planet> Planet_ptr;
typedef std::vector<Planet_ptr> Planet_vctr;

void Function1(Planet_vctr &alteredVector)
{
    Planet_ptr p(new Planet);

    alteredVector.push_back( move(p) );
}

void Function2(const Planet_vctr &constVector)
{
    if (constVector.size())
    {
        std::cout << "Not Empty!\n";
    }
    else
    {
        std::cout << "Empty!\n";
    }
}


int main() {
    Planet_vctr aVector;
    Function2(aVector);
    Function1(aVector);
    Function2(aVector);
}

Without delving into how you're using the pointers, I wouldn't be able to offer a suggestion on whether to use unique_ptr or shared_ptr. I found this explanation from Stack Overflowfairly coherent that might help you.




#5159360 remapping the keyboard (esp {} () )

Posted by nobodynews on 09 June 2014 - 04:39 PM

if you dont like to answer me dont answer not a problem, byt do not spamm me with useles and not interesting pseudo- philosophy

If you don't like the answers you get not a problem, but do not spam the boards with useless and not interesting pseudo-philosophy yourself. You could just as easily ignore answers that you don't like, but instead you're wasting your time arguing with people about how they shouldn't respond as they see fit because you want to ask questions as you see fit. IMO that's kind of hypocritical of you.




PARTNERS