Jump to content

  • Log In with Google      Sign In   
  • Create Account


SimonForsman

Member Since 18 Oct 2005
Online Last Active Today, 09:18 AM

#5168692 How are the trigonometric functions computed?

Posted by SimonForsman on 23 July 2014 - 11:38 AM

You could calculate it using http://en.wikipedia.org/wiki/Taylor_series

If you start by doing an argument reduction: sin(n) == sin (n + x*PI) you can get fairly high accuracy quite easily.


#5168260 Is c++ good

Posted by SimonForsman on 21 July 2014 - 07:05 PM

C is certainly not "C++ without all the hard bits" ;)


Indeed, i would say that its more like C is C++ without the easy(proper strings, a sane standard library, smart pointers, etc) bits, a beginner doesn't have to use every arcane feature a language has to offer, The big problem with C++ for a beginner imo is the insane number of pure piece of a bullpoop(the new boston being one of the more popular offenders) tutorials that are flooding the internet.

If you start out by using the nice parts of the language and tackle the unsafe bits after you've covered the basics its really not that awful.

C on the other hand has no nice parts, basic input/output drops you straight in the deep end of the pool and thats probably not the best place to put someone who hasn't learned how to swim yet.


#5167864 How do you learn an API such as SDL?

Posted by SimonForsman on 19 July 2014 - 05:05 PM

After re-learning most of my programming with some console programs i would like to move on to using libraries which i can make a 2D game with such as SDL but the problem i have is... How do i learn an API? Because when i was trying to learn SDL from LazyFoo's tutorial i didn't get it because to me it kind of wasn't explained properly on what function is or what it does. How did you guys start learning SDL and other libraries?

 

I used the documentation: http://wiki.libsdl.org/APIByCategory. Once you know what to expect from a library it becomes quite easy to look in the documentation to find the information you need.




#5165260 SDL Keyboard input

Posted by SimonForsman on 07 July 2014 - 08:38 AM

 

 

Thanks for response! Your suggestion did fix my problem however now I am getting a weird bug when if I just simply move character it works fine and then suddenly it just keeps going into random direction as if SDL did not notice that I release the button (SDL_KEYUP). In order to interrupt my character from moving uncontrollably I have to tap the button twice for sdl to register the SDL_KEYUP. At first I thought my keyboard was glitched so I rebind-ed the buttons. Same thing. I checked everywhere but I think I am doing something totally wrong with event handling. Any suggestions? pastebin.com/mGv4ZLmJ (updated)

 

If you are using this code: https://github.com/gratholio/sdlscroller as your base: please don't. it is making a huge mess of things.

the sdl_setup::begin method gets a single event from the queue and stores it as mainevent (which is then returned by all calls to GetMainEvent) and clears the renderer(big wtf), it also discards the return value from SDL_PollEvent, there is no way to use that wrapper correctly since the wrapper itself is completely broken.

 

Just use standard SDL instead.

 

[source]

 

while(!quit) {

    SDL_Event event;

    while(SDL_PollEvent(&event) != 0) {

        quit = event.type == SDL_QUIT;

        //handle the rest of the events here       

    }

    update();

    render();

}

 

Thanks a lot! Now it works perfect. I was actually following "Lets Make an RPG C++/SDL" tutorials on youtube but it appears that the code is exactly the same as the link you provided. Can you suggest a good resource to learn from or I should just stick to lazyfoo?

 

 

The Lazyfoo tutorials are fairly high quality so they would be a good choice, i would recommend avoiding video tutorials (videos are a bad format for tutorials).

 

Video lectures however work great, these are worth watching(Not game specific):

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/video-lectures/




#5165175 SDL Keyboard input

Posted by SimonForsman on 06 July 2014 - 09:30 PM

Thanks for response! Your suggestion did fix my problem however now I am getting a weird bug when if I just simply move character it works fine and then suddenly it just keeps going into random direction as if SDL did not notice that I release the button (SDL_KEYUP). In order to interrupt my character from moving uncontrollably I have to tap the button twice for sdl to register the SDL_KEYUP. At first I thought my keyboard was glitched so I rebind-ed the buttons. Same thing. I checked everywhere but I think I am doing something totally wrong with event handling. Any suggestions? pastebin.com/mGv4ZLmJ (updated)

 

If you are using this code: https://github.com/gratholio/sdlscroller as your base: please don't. it is making a huge mess of things.

the sdl_setup::begin method gets a single event from the queue and stores it as mainevent (which is then returned by all calls to GetMainEvent) and clears the renderer(big wtf), it also discards the return value from SDL_PollEvent, there is no way to use that wrapper correctly since the wrapper itself is completely broken.

 

Just use standard SDL instead.

 

[source]

 

while(!quit) {

    SDL_Event event;

    while(SDL_PollEvent(&event) != 0) {

        quit = event.type == SDL_QUIT;

        //handle the rest of the events here       

    }

    update();

    render();

}




#5163457 Cross Platform C++ Database library?

Posted by SimonForsman on 28 June 2014 - 09:53 AM

I see your point regarding security. I'll go with the server and add a little encryption between the client and server. But still, how does one get hands on the MySql source? I followed the links, tried with Bazaar, no success!

 

The mysql source can be found here:

http://dev.mysql.com/downloads/mysql/

 

Select "Source code" as your platform to get the source code (Same thing goes for all the connector libraries etc, just select source code as your platform if you don't want a binary package)




#5163157 How to download a website as ms word with the pictures inside

Posted by SimonForsman on 26 June 2014 - 10:43 PM

You should probably be aware that a html document that you give a .doc extension is still a html document, not a word document and thus it can't include images (it can link to images but those images will have to be downloaded separatly) (Other office suites might also have trouble opening those files as they won't be in the expected format)

 

A far better solution is to actually generate a word document using for example: http://phpword.codeplex.com/ (It is very easy to use)

 

 

If you absolutely insist on using renamed html documents you will have to make an archive (zip for example) containing all the required files (images, stylesheets, etc) or to use data uris (<img src="data::image/png;base64,{base64encodedimagedata}"/>) but i don't know if word supports those. (it might work in newer versions of word (Microsoft added partial support for it in IE8 and made it semi decent in IE9)




#5161593 Question for Experts, especially for Beginners: Motivation, how NOT to lose it?

Posted by SimonForsman on 19 June 2014 - 05:13 PM

Okay, a big question to everyone who has produced a successful game (I'll let you decide what "successful" means).

How do you NOT lose Motivation?

 

Simple question, but I know the answer is probably complicated. I have learned many programming languages, many programmers go to me for help. But I actually have a problem staying motivated on a project!! So, for all you experts out there, how do you manage to keep your motivation, at least long enough to finished a half decent game?!

 

I'm sure I'm not the only programmer, beginner or not, who has a tough time staying motivated and on track making a game!

 

Looking forward to your answers, and I really hope this will help other programmers, beginners and not, to learn a good way to stay motivated!

 

Keep the scope small and don't work alone (Its far more fun to work with friends)




#5160132 Tips for a Beginner

Posted by SimonForsman on 12 June 2014 - 02:53 PM

So ever since I was around 12 I've wanted to make Video Games. Not stuff like FarmVille or stuff similar to that, but an actual game with a story and such. Well I'm 17 now, and I feel like I'm way too late to start learning how to program. 

 

Basically, I just need to know if I'm too late to get into Game Development and if not, some direction on where I should start. 

 

Maybe some general information on what I should know getting into this, and how to motivate myself to actually follow through. 

 

Also one more thing, do you need a fancy degree and a lot of education to get into the industry? Like, I'm not completely opposed to working for a big company, but I'd rather do stuff my own way. So any information regarding Education, and whether or not you need a degree and stuff would be helpful!

 

Thanks,

Wesley

 

It is never too late or too early to learn something.

 

Getting a degree can make it easier to get your first job but its not strictly required. Most companies will pick the guy with a degree over the one without a degree if everything else is equal but in the real world everything else is never equal, a solid portfolio will blow most fresh graduates out of the water.

 

I would recommend getting some education though(even if you don't complete a proper degree), it can be very difficult to catch up on your own and if you are going to work full time with something else while learning and building a portfolio it will be even harder.




#5159004 Drastic performance loss

Posted by SimonForsman on 07 June 2014 - 08:36 PM

are you doing an optimized build ?

 

You are creating new arrays on the stack on each function call (create them outside the function and pass them by reference)

 

It is also a good idea to move the clientstate calls outside the function, enabling and disabling things isn't free and you seem to be doing so for each tile you draw (even though all tiles seem to have vertex array and texture_coord array enabled)

 

if you are drawing rectangles only you can use a fixed square vertex array and only re-bind the texture coordinate array for each tile to further speed things up. (you can change the shape and size of the rectangle  by scaling it)




#5158923 writing own graphics api or library

Posted by SimonForsman on 07 June 2014 - 11:08 AM

I knew they are constructed like wrote code almost all graphic cards can read them.

but i really dunno they can read instructions of almost all graphic cards.

is this idea right?

 

1. applications use library or api > library or api use common instructions for almost all graphic cards > video drivers > graphic cards

 

or

 

2.  applications use library or api > library or api can use instructions of almost all graphic cards with video drivers > graphic cards

 

if 1. idea is right, how do I learn common instructions? or 2.idea is right, can i use huge instructions with knowledges for almost all graphic cards.

 

I reallllly want to know that ...wacko.png

 

There are no common instructions (atleast not between manufacturers and GPU generations and most of the low level documentation is proprietary).

OpenGL and Direct3D both specify an interface that the GPU driver has to support and it is then up to the GPU manufacturers to implement support for those APIs in their drivers.

 

If you make your own low level API you will have to write your own drivers for every single GPU you intend to support. (or somehow convince Intel, AMD and nvidia to support your API)




#5158848 Homing missile problem

Posted by SimonForsman on 06 June 2014 - 10:41 PM

 

 

an API that uses degrees (which is a bad thing)

Yes, SFML has this problem. Hundreds of conversions needs to be made every frame which will in turn be converted back (to radians) in order to pass on to OpenGL.

 


Actually, glRotate also uses degrees, so maybe SFML and SDL are just trying to be transparent here and OpenGL is where the nonsense stems from. The only thing glRotate can possibly do with the angle is compute its sine and cosine. If it were up to me, OpenGL would allow you to pass in the sine and the cosine, and if we wanted to have a version that takes an angle, it would be in radians.

 

 

Well, glRotate belongs to the old transformation stack which is depracated, these days you can (and should) pass whatever it is you want to pass directly to the shader.




#5158769 Is there any way to generate a word doc from a html file

Posted by SimonForsman on 06 June 2014 - 01:50 PM

with html you can't.

 

You can however do it using PHP, Python, C# or some other programming language on the server backend (There are plenty of libraries around that lets you generate word and excel documents (primary in the newer .docx and .xlsx formats)

 

C#: http://www.codeproject.com/Articles/660478/Csharp-Create-and-Manipulate-Word-Documents-Progra

PHP: http://phpword.codeplex.com/

PHP (alternative library): http://www.phpdocx.com/documentation/tutorial

Python: https://pypi.python.org/pypi/docx/0.2.4




#5157864 Model Copyrights

Posted by SimonForsman on 03 June 2014 - 10:50 AM

 

HI,
 
I have a question to ask, i guess this is the right place to do so.
 
I am developing a 3d game and want to use characters from another game. I know that this is a copyright infringement so I plan to modify them. The question is , where does a character in the process of modification reveals himself as another character, or, how much modification should I do so that any resemblance cannot be considered copyright infringement
 
For example, If suppose the original models are green and have short hair, and i make them blue with green and big noose, is that ok from the point of copyright law?

 

 

If you base your model on an existing model then your model is a derivative work, if the original work is protected by copyright you will need a license that gives you permission to do whatever it is you are going to do with it, regardless of how big or small your changes are.

 

If your changes are big enough to make your own work unique it will also be protected by copyright (so others who also get permission to modifiy and distribute the same original work can't legally make the same modifications you did).

 

Making really extensive changes can make your crime harder to detect but it doesn't change the legality of the issue

 

There are plenty of permissivly licensed humanoid models (and even permissivly licensed motion capture data for humanoids) available that you can use as a base for your own work, use those instead.




#5157579 Programming for software intermingling(?)

Posted by SimonForsman on 02 June 2014 - 11:55 AM

I would consider myself intermediate in the strictest terms. I've never used c++ to control other software so that is the most difficult portion I see. As of all this back and forth, 'Api's' was the word I apparently was looking for lol. Learning the correct Api's will be my focus moving forward. Any good resources for Api's through c or c++?

 

The documentation for whatever API you intend to use tends to be a good start.

 

From what i understand you don't actually need to "control" other software though, it sounds as if all you need to do is read the contents of those .dat files and generate new files based on their contents.






PARTNERS