Jump to content

  • Log In with Google      Sign In   
  • Create Account


Lactose!

Member Since 16 Oct 2013
Offline Last Active Today, 02:46 PM

#5172967 Getting direct acces to vector<unique_ptr<My_Class>> but ther...

Posted by Lactose! on 11 August 2014 - 06:16 PM


I feel that map will be slow.

If you found a solution that works for you, great!

 

However, this kind of reasoning is something you should avoid. Whether you feel, think or guess something is slow is highly irrelevant. The compiler might do all kinds of magic to make any assumptions you have invalid, or your assumptions might be wrong from the get-go.

 

If you think something is too slow, profile it. That'll tell you if it actually is too slow, or if your bottleneck is elsewhere. If the bottleneck is somewhere else, all your optimizations, time spent and hair loss due to tearing at your own skull scalp might be for nothing.

If the code is too slow, then profiling before and after changes will tell you if the change actually made it better or worse. In a lot of cases, "clever optimizations" from a programmer can cause the application to run slower.

Of course, this isn't to say that e.g. algorithm knowledge is bad or wasteful -- high level changes related to algorithms are probably one of the best ways of optimizing something, and knowing whether an algorithm is O(n) or O(n^n) can matter a lot.

 

Also, another quote which might be of relevance:

Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.

- Donald Knuth

 

And, just to re-iterate: the only way to know which parts are critically in need of optimization is by using some sort of profiling tool.




#5172619 Intersting Game Idea

Posted by Lactose! on 10 August 2014 - 10:47 AM

If you want to make games yourself, put that game idea away for a while and start smaller. A lot smaller. Pong complexity is what you'll be focusing on for quite a while.

See the FAQ for more details.

 

If you want to get a team to join you, you'll need to bring more to the table than just an idea. Be it art skills, programming, level design abilities, etc.

While it might seem a bit harsh, you would probably benefit from reading this as well.

 

Making games is difficult, and will require a lot of time. If you stick to it, you can achieve quite amazing things, either on your own or as a part of a team, but the likelyhood of you basically starting from nothing and pursuing a dream project with no prior experience AND finishing it are practically zero.




#5172576 Getting started

Posted by Lactose! on 10 August 2014 - 04:17 AM

The FAQ might also nudge you along the path to your goal.




#5172575 Where do I start?

Posted by Lactose! on 10 August 2014 - 04:14 AM

I would suggest starting with the FAQ.

It should help you a bit further on the way.




#5171157 Where should I start? (2D Game Programming)

Posted by Lactose! on 02 August 2014 - 12:38 PM

 


Java will most likely never be secure enough to make video games due to the fact that .JAR files are very VERY VERY VERY easy to decompile and hack

 

Not necessarily true. You might want to google up the term "obfuscation".

 

Code obfuscation, in this case, would be an example of security through obscurity.

I would advise against relying on security through obscurity.

 

Other than that, Eck posted valuable information.




#5170740 use of pointers

Posted by Lactose! on 31 July 2014 - 05:50 PM

I also remember pointers clicking more in my mind when I thought them as addresses or directions for an object.

I thought about data types as e.g. boxes, and pointers as a paper with the directions to the box on it.

int myInt;

--> an int sized box with myInt written on it. int sized because it needs to be big enough to store whatever int I want to put in it.

 

int *myIntPointer = &myInt;

--> a piece of paper saying "the box in the kitchen on the top shelf".

 

Somewhat unrelated, hovering the "pointers" tag of this thread gives some fairly entertaining suggestions.




#5170659 Very new, where should I start?

Posted by Lactose! on 31 July 2014 - 12:09 PM

You should start with the FAQ, if you haven't already.

 

Other than that it depends on what you want to do. Certain languages/frameworks/libraries might be better suited for certain things.




#5170200 Just Lost Intellisense in VS2012

Posted by Lactose! on 29 July 2014 - 06:44 PM

Try deleting/renaming the SOLUTIONNAME.suo file.

 

Other than that, http://stackoverflow.com/questions/13375961/visual-studio-2012-intellisense-sometimes-disappearing-broken seems to have a few suggestions (1 of which you mentioned, but several others you didn't).




#5168918 Need a little guidance.

Posted by Lactose! on 24 July 2014 - 11:27 AM


There is literally a poster here who has a Web site about creating games with Java.  Helpful and very much the person you need.  I'm blanking on the username and can't find the Web address.

Glass_Knife -- http://www.indiegameprogramming.com/ ?

 

Also, this thread: http://www.gamedev.net/topic/659060-what-now/




#5168497 projected lines

Posted by Lactose! on 22 July 2014 - 04:40 PM

Oh my god I can't believe that worked!

 

(EDIT: Chat room humour.)




#5167491 Functions

Posted by Lactose! on 17 July 2014 - 04:04 PM

With your current code, you can only call askYesNo1() from inside main. You can't call askYesNo2().

This is because main hasn't heard about askYesNo2() yet -- it comes after, after all!

 

You can keep the order you want, and still make main able to call askYesNo2() by forward declaring it higher up, like so:

 

char askYesNo1()
{
    // ...
}
 
char askYesNo2(); //Declaration, just lets rest of code know that a function with this signature exists and can be called
 
int main()
{
    return 0;
}
 
char askYesNo2() //Definition, containing the code that will actually run
{
    // ...
}

 

How you order functions is just for organization.




#5167457 Need advice for developing a game?

Posted by Lactose! on 17 July 2014 - 12:56 PM

You should check out the FAQ.

 

That should get you started, and you can ask more specific questions after :)




#5167028 Theoretical Tile-Based Question

Posted by Lactose! on 15 July 2014 - 11:44 AM

There are several ways. You can use masking within a pixel to indicate collision or interactable areas, like megadan says.

 

For the collision issue, you can also solve it using math, in order to figure figure out all kinds of things apart from just "is this tile full-on collision?".

You might have a tile which is flagged as "collision starting from bottom left, going upwards in a 45 degree angle to the right". The actual collision for the tile's pixels can then be determined by a simple linear formula: mx + b, with m being the slope and b being the start offset.

 

You might also then have collision which is only checked if the player is below (or above, or from the left/right), which would allow you to pass through the collision in some directions. Collision does not need to be "nothing can ever penetrate this square tile" -- although it can be. It depends on what you need/want.

 

In both cases, you need to do more checking that just on a tile level. You'll want to store and check a more finely detailed position.




#5166452 Javascript Won't Run with Tutorial GitHub Code

Posted by Lactose! on 12 July 2014 - 01:49 PM


In fact, mistaking Java for JavaScript is like mistaking 'Ham' for 'Hamster'.




#5165103 Animating With Separate Image Files

Posted by Lactose! on 06 July 2014 - 01:55 PM

If this code is executed once per render loop, the image will NOT be drawn 1 frame every 7 frames. This is what causes the flicker.

This is because if CurrentFrame is 6 upon entering this code, it will be incremented to 7. It will then bypass all the other ifs, and go to the == 7 part.

Here, it will be set to 0 (so that it runs 1 next loop), but it will not do any drawing this loop.

You can fix this by doing a separate if check right after incrementing, that sets it to 1.

 

However, there is a lot of (almost) identical code here. You could change all of the above (with the fix I mentioned) into the following:

SDL_RenderClear(MainRend);
SDL_RenderCopy(MainRend,BackdropTex,NULL,&BackdropRect);
 
SDL_RenderCopy(MainRend,gAidan.StandTex[gAidan.CurrentFrame],NULL,&gAidan.StandDstRect[gAidan.CurrentFrame])
 
gAidan.CurrentFrame++;
gAidan.CurrentFrame %= 7;
 
SDL_RenderPresent(MainRend);

If this looks a bit like magic, ask and I'll explain what's going on.






PARTNERS