Jump to content

  • Log In with Google      Sign In   
  • Create Account

Lactose!

Member Since 16 Oct 2013
Online Last Active Today, 09:07 PM

#5199191 Chess moves

Posted by Lactose! on Yesterday, 06:18 PM

Could you fit all possible chess moves on a 5TB external hard drive, excluding repeating states and stalemates? And then use that as a lookup table for an unbeatable AI?

No. There's just too many moves.




#5198940 better way of loading images? SDL2

Posted by Lactose! on 18 December 2014 - 08:25 AM


So basically, for loading images, pointers are pretty much great? I guess I can carry on using them then

Pointers are a powerful tool, and they are well suited for this (and other) uses.

However, like most other powerful tools, they can also be used in horrific ways. In software development, they are often the source of bugs that can be both hard to track down and application-fatal.

 

You should definitely consider spending time on learning how pointers work, if you don't understand them right now.

You might also want to look into the newer pointer "versions", which aim to make development easier and less bug-prone. These pointer types are called "smart pointers".




#5198488 SDL2.0 Character Jumping & Gravity

Posted by Lactose! on 16 December 2014 - 03:26 AM

Pasting the error message (along with the line it's complaining about) would be preferable to a screenshot of the error message.

 

Based on lordconstant's code, I would guess it's complaining about the player.y variable.

Your sprite code seems to indicate you don't have a y variable for your sprites, but you do have a rect.y variable. Try that.

 

That said, I would second the suggestion that you look at some tutorials, like the lazyfoo one that was already linked. It will guide you through a lot of these initials issues you're likely to face/question.




#5198203 Do the programming department add collision to areas if the character cannot...

Posted by Lactose! on 14 December 2014 - 04:29 PM

Short answer:

It depends.

 

Longer answer:

For games with 3D movement and collision detection, collision data is usually not hard coded (live in the code as pre-determined values) at all. Instead, collision data lives in the data files loaded while playing the game. This can be e.g. a mesh that's used to represent collision surfaces (potentially with different materials or other ways of distinguishing behaviour).

The collision data is usually not a 1 to 1 representation of the visual data. The collision data is usually a lot simpler -- think boxes and planes instead of intricately detailed corners.

 

This is often the case for pure 2D games as well, but 2D games tend to be less performance heavy, and can often-times afford more detailed collision data (e.g. pixel perfect collision).

 

The extent of collision data will vary from game to game. Some games probably have collision in areas you're never able to reach, because it was put in and there was no reason (performance not critical or time not allowing) to remove it again. This is especially true if the components are made by e.g. the art department, and later placed by level designers. The art assets might have included more collision data than was strictly speaking required, due to not knowing in advance how the assets were going to be used in every scenario.

 

Other games might have a much more aggressive stance, pruning away all unneeded collision data in order to reduce file/memory usage, performance, or other causes.

 

Something you might see, from the code side, is hard-coded limits to how high and/or low you can go. This can e.g. be used if you happen to fall through the floor, hitting the hard-coded limit might signal "kill the player and respawn him somewhere safe", basically as a "just in case" measure.




#5197885 Strange SDL Display Problem

Posted by Lactose! on 12 December 2014 - 05:02 PM


  #ifndef MANAGER_H
    #define MANAGER_H
 
    class Manager
    {
    public:
        Manager() {}
    };

I don't see an #endif. Verify that it's there.




#5197673 how to pass global struct into my class function?

Posted by Lactose! on 11 December 2014 - 04:13 PM


structs aren't variables they are like classes without functions.

Emphasis mine.

 

Structs can have functions, just the same way classes can.

The difference between classes and structs is that classes default to private for members, while structs default to public. This also applies to inherited objects.




#5197040 Can anyone give a small developer any tips on how to make a small game

Posted by Lactose! on 08 December 2014 - 03:48 PM

I suggest you start with the FAQ and take it from there. It might be able to help answer some of your questions.




#5195717 Crash with <unable to read memory> error

Posted by Lactose! on 01 December 2014 - 09:29 AM

Because your code just results in a pointer to something which is invalid (you haven't created an instance yet). It hasn't been set to anything, and you try to access it.

You should be able to do this:

GameMap *Map = new GameMap;
Map->CreateMap(5, 5);

 

Remember to delete the Map instance when it's no longer needed, to avoid leaking memory.




#5195518 Unity or C++?

Posted by Lactose! on 30 November 2014 - 12:04 PM


Choose one of the above options.  I, personally, would recommend the first one but the second is very popular.

To be fair, option 2 includes looking at kitties on the internet. That's hard to turn down!




#5194805 SDL Pausing game help?

Posted by Lactose! on 26 November 2014 - 12:21 PM


is paused already in the sdl library?

No.

 

His suggestion is to create a bool variable called "paused".

Toggle the variable when Escape is pressed.

Check the state of the variable in your update loop to determine what updates.




#5193157 Building A Game Engine + Game

Posted by Lactose! on 16 November 2014 - 06:43 PM


Its undefined because you haven't assigned a value to it. In reality it will be some value that was left in the stack from a previous local variable in some other function call.

While the question is simple, the correct answer is quite a lot more complicated than that (although more information would be required to accurately answer a specific "version" of the question).

The short answer is "It depends on where the line of code is written", followed by a number of different scenarioes with different rules & logic for the corresponding value.




#5193138 member access into incomplete type

Posted by Lactose! on 16 November 2014 - 03:21 PM

In other words, in the object.cpp, this:

const char* getSomething(){

needs to be changed to this:

const char* object::getSomething(){



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

Posted by Lactose! on 15 November 2014 - 03:20 PM


It's certainly a private choice,

Did you mean "viable" or something similar? I'm having a hard time understanding this as it is written.




#5191215 Thread-post never made ... almost

Posted by Lactose! on 04 November 2014 - 04:32 PM

I have a rubber duck at my desk for this exact reason. If I'm stuck, I explain the problem to the duck and half the time figure out the solution in the process.

AKA rubber duck debugging.




#5190238 Match-3 Program Question

Posted by Lactose! on 30 October 2014 - 04:03 PM


the programmer seems to think there should be a more efficient way to detect matches.

Most likely, this is true.

Most likely, this does not matter at all.

 

Unless there are cases which the code does not handle correctly, or if the code's efficiency is a real (measurable) problem, notions like "it can be done better" should be filed away for the sequel. Your goal is to finish and ship the game, not to rewrite pieces of code until the end of time.

 

As is often the case, perfect is the enemy of good [enough].

---

EDIT: If there are real problems (measurable or use cases where it fails), posting details on those specific areas would be required for further feedback.

EDIT 2: Ninja skills are definitely improving today.






PARTNERS