Jump to content

  • Log In with Google      Sign In   
  • Create Account

SimonForsman

Member Since 18 Oct 2005
Offline Last Active Today, 02:53 PM

#5176597 C/C++ tilt sensor for Android/iOS

Posted by SimonForsman on 28 August 2014 - 12:06 AM

Qt has recently added support for mobile platforms, and has a C++ sensor API.
 
If you aren't already using Qt, you almost certainly don't want to include the giant collection of libraries that is Qt, but luckily, Qt is opensource under LGPL and GPL, so you could look to see how they do it, separate out their sensor code, wrap it in its own separate LGPL'd library, and then use that - dynamically linking to it, so the rest of your closed-source commercial product isn't hampered by the licensing.
 
Or you could just examine it, to see what API function calls they use, and then write your own wrapper (or better yet, submit a patch for SDL so others can benefit) by reading the API documentation.


The LGPL is incompatible with Apples TOS (for the app store) and dynamic linking isn't much of an option on iOS(it is possible but apps using dynamic linking will be rejected by Apple). so using LGPL code in mobile cross platform applications is a pretty bad idea unless you intend to only support jailbroken iOS devices.


#5175787 MMO Gap issue

Posted by SimonForsman on 24 August 2014 - 06:57 AM

My recommendations.

1) Make old content easier or less time consuming as you add new content to the game.
2) Non linear progression, if a player can get to a competetive level reasonably quickly it won't matter all that much if veterans have a slight advantage.


#5174151 Dendy games copyright

Posted by SimonForsman on 16 August 2014 - 03:49 PM

Okay. What if a make a game in pixel-style with a dog, ducks and 8-bit music and add some gameplay features? Is it good?


Starting with the goal of making a game as similar to <insert famous game title here> as legally possible is a pretty bad idea unless you are prepared to defend yourself in court (Nintendo can sue you if they think you've gotten too close to their property, if you can't afford to defend yourself it won't even matter if they are right or wrong)

You are really asking how close to a fire you can stand without getting burned but noone here knows how big and hot that fire is and thus the recommendation is simply: Don't play with fire.


#5173257 Is it possible that I just simply lack the required intelligence?

Posted by SimonForsman on 12 August 2014 - 08:39 PM

I've been trying to use JMonkey Engine 3.0 to develop a simple tower defense game. I am only using cubes, and you select on a tower and press c to give it ammo. The bullets are just simple lines. There are so many problems in my code. I've been studying a java for about 8 months, and I am starting to feel discouraged. I'm actually following an exercise from my book, and I am confused as heck. The reason why I say that is because I can't seem to figure out how to debug my code. There's stupid stuff like when the cube-shaped enemy reaches the base, and it's z position is less than zero it will disappear, but it doesn't. I've been stuck on this for days.
 
Could I get any friendly and honest advice? Thanks biggrin.png


First of all, no you do not lack the required intelligence, 8 months is no time at all when it comes to programming and there really is no such thing as a "simple tower defense game" (Its not normally the type of game we would recommend for beginners due to the complexity involved).

I would recommend getting familiar with whatever debugger your IDE includes (here is a guide for eclipse: http://www.vogella.com/tutorials/EclipseDebugging/article.html ).

If you still struggle you could post the relevant code here and ask for more specific advice.

I believe pretty much everything is screwed up. Should I just post all of my written code? And thanks for making me feel better biggrin.png


Its probably best if you only post the classes / methods that you are having trouble with as more people will be able/willing to help if they don't have to read through massive amounts of code first, (You could put a zip with your full code on some online filehost and link to it aswell though if you want people to be able to help you debug things)


#5173253 Is it possible that I just simply lack the required intelligence?

Posted by SimonForsman on 12 August 2014 - 08:22 PM

I've been trying to use JMonkey Engine 3.0 to develop a simple tower defense game. I am only using cubes, and you select on a tower and press c to give it ammo. The bullets are just simple lines. There are so many problems in my code. I've been studying a java for about 8 months, and I am starting to feel discouraged. I'm actually following an exercise from my book, and I am confused as heck. The reason why I say that is because I can't seem to figure out how to debug my code. There's stupid stuff like when the cube-shaped enemy reaches the base, and it's z position is less than zero it will disappear, but it doesn't. I've been stuck on this for days.
 
Could I get any friendly and honest advice? Thanks biggrin.png


First of all, no you do not lack the required intelligence, 8 months is no time at all when it comes to programming and there really is no such thing as a "simple tower defense game" (Its not normally the type of game we would recommend for beginners due to the complexity involved).

I would recommend getting familiar with whatever debugger your IDE includes (here is a guide for eclipse: http://www.vogella.com/tutorials/EclipseDebugging/article.html ).

If you still struggle you could post the relevant code here and ask for more specific advice.


#5172109 Java and JOGL for serious Game development?

Posted by SimonForsman on 07 August 2014 - 01:53 PM

Ok, so I'm running OpenGL 3.0, one of the first things I do in code is check my GL version number to make sure it is compatible through GLEW:

	if(!GLEW_VERSION_2_1)
	{
		cerr << "OpenGL version 2.1 or higher required" << endl;
		return false;
	}
When I compile my shaders I get the error:
 
error: 'in' qualifier in declaration of 'position' only valid for function parameters in GLSL 1.10.
 
> in vec3 position;
 
Even though the GLSL version should be at least 1.20.8 according to this: (for OpenGL 2.1)
 
http://en.wikipedia.org/wiki/OpenGL_Shading_Language#Versions
 
This is what is causing my headaches, I'm not sure if this is an error on my part or an error with GLEW.


It is most likely an error on your part, the in qualifier is only valid in the global scope (with some restrictions) and in function parameters, i would guess that the error is caused by you using the in qualifier in a local scope. (Allthough its just a guess, i havn't seen your code so ...)


#5172077 php problem,how to make download button not show on word document

Posted by SimonForsman on 07 August 2014 - 11:45 AM

I have a php website, that when you click download as ms word, it downloads the page as a ms word document, the only proplem I have is that the button is showing in the word document, how can I make it not show on the word document.
 
the php code to make the word document when I click download is
 
if(isset($_POST['submit_docs']))
 {
 header("Content-type: application/vnd.ms-word");  
header("Content-Disposition: attachment;Filename=word.doc");  
  }
 
the html code is
 
<input type='submit' class='no-print'  value= 'Download as MS word' name= 'submit_docs' >


First of all. You are not downloading a word document, you are giving a html document a .doc extension and changing the content-type header to trick the clients browser into downloading(or open with a document plugin) instead of displaying the document normally. (This is incredibly bad practice, there is no guarantee that future versions of MS-Word or competing wordprocessors will read those files correctly).

You should grab PHPDocX(The community version is free): http://phpdocx.com
or PHPWord : phpword.codeplex.com
to generate properly formed word documents instead.

If you absolutely insist on sending .html files to the user with an incorrect file extension http headers to trick the clients OS and/or browser into launching a potentially incompatible program/plugin to open it you can set a variable after you've set the headers: i.e $skip_buttons = true; and then just do a check before the markup for the button:

<?php if(!$skip_buttons): ?>
<input ..../>
<?php endif; ?>


#5170769 Protect Against Speed hack

Posted by SimonForsman on 31 July 2014 - 08:24 PM

If this is for a multiplayer game you can simply have the server enforce your rules(if you use matchmaking and the players host the actual game it gets harder(as it is quite tricky to prevent the hosting player from cheating). If a player moves too fast or runs through walls your servers should correct their position or kick them out. (don't try to do cheat prevention on the client, it is impossible)

If it is for a singleplayer game there is nothing you can do to stop cheaters and there is no reason to try either (If someone enjoys cheating in a single player game preventing it would only make the game less fun for that player)


Cheats that provide additional information to the players (wallhacks, maphacks, etc) are harder to prevent but you can reduce their efficiency by not giving the clients information unless they need to show it to the player.

For cheats that assist the player with gameplay related tasks (aimbots etc) you don't really have any good options, anti-cheat solutions that scan the players system for known cheats can mitigate the problem but they require insane amounts of effort to maintain and a simple votekick and/or record/report solution would be far better.
 

Why have I never seen anyone asking "How do I implement in-game cheats?" in these forums?

Probably because it is often trivial to do, (most in game cheats simply change a few variables when the player performs an undocumented action (holds down specific keys, enters a specific command in the in game console, etc)


#5170494 College or Solo?

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

If you don't allready know how to program i would highly recommend going to school, a CS education at a community college can be reasonably cheap (and you probably have a decent one close to where you live). If you insist on going to a game school you should pick one that offers a proper CS program (Digipen does that, the scam schools normally does not)

Learning by yourself is definitely possible but it requires more effort and will make landing your first job a bit harder, going indie and making a living is extremely difficult and definitely not recommended unless you have a solid backup plan and money to burn.


#5169529 What is a potatoese?

Posted by SimonForsman on 27 July 2014 - 10:48 AM

Let me ask the remainder of the question, what rendering is used for Firefox? (thanks for the links, but I wouldn't spends hours or days looking at the source files just to be able to tell)

 

Firefox uses C++ GTK+ and OpenGL on Linux atleast




#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();

}






PARTNERS