Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


SimonForsman

Member Since 18 Oct 2005
Offline Last Active Yesterday, 06:26 PM

#5201717 Is it possible to overwrite apps on Android when developing?

Posted by SimonForsman on 04 January 2015 - 05:55 AM

When developing an app for android and testing it on my device always get an error message when I try to install my game if I already have a version of it on the device. So I always have to first uninstall the app, and then install the new one. This is very tedious when you are in rapid developing and testing a lot. It would be so much smoother if you could just install the new version and have it overwrite the old one. Is this possible somehow? Maybe some setting that can change this?

 

Activate developer mode and USB debugging on your phone, don't manually install the app(just run it from your IDE) and it will overwrite properly each time, alternatively you can just raise the version number before each deployment (you don't need to uninstall before installing a newer version)




#5201235 making a serious game in flash

Posted by SimonForsman on 02 January 2015 - 01:34 AM

The Binding of Isaac was a pretty big game made in Flash with ActionScript 2, and you can read a postmortem on Gamasutra.

 

On page 3 and page 4 there's a sections entitled "Performance and Feature Issues with ActionScript 2" and "Too Big in Scope for Flash" that are pretty relevant to your question.

 

 

Hope that's helpful! smile.png

 

It might be worth mentioning that AS3 is significantly faster than AS2 (JIT compilation was added with AS3 and the difference is massive (AS2 was quite awful, even things like the length of your function/variable names had a measurable performance impact), most of the fla/swf size issues can be worked around by splitting things up and loading them at runtime, AS3 also added the GameInput classes (for dealing with gamepads, joysticks, etc) and a whole bunch of other nice features, a pre-made native extension for steamworks exist on github (fresteamworks), There are still issues with Flash (such as awful/non-existant support outside of Windows and OS X for example) but i wouldn't dismiss it based on a postmortem for a game that was made using an ancient version of the platform.




#5199193 Is it possible to use Dart lang for Apach server?

Posted by SimonForsman on 19 December 2014 - 07:35 PM

It sounds like the OP wants to use a Dart client with a PHP server and communicate between them, which would mean that the server really is irrelevant.




#5198291 Is Java a good Language for Games?

Posted by SimonForsman on 15 December 2014 - 05:39 AM

        I am quite experienced with Java, i made several bukkit plugins and a few complex programs. I already have almost 2 years with Java as my main programming language. From my point of view i am quite ready to start game development. So here is my question. Is Java a good programming language for game development?

         I already read a lot of articles that there is no "special language for game programming" and that you should use the one your more comfortable with. But In my expirience making programs with java and deploying them was quite awful, i had to create a launcher with launcher4j and this wasnt working always also there were some permance issues(maybe my fault) but Java doesnt and compatibilities with the JRE.

        I tried C# with XNA Framework and it was quite intresting because of my experience with java and Java and C# similarities it was quite easy for me. So I should stick with Java with Slick2d to make a 2D game or I should use C# with XNA? Although i dont know hows XNA deployment.

Thank you

 

Here are some useful tips for Java performance: 

 

1) Avoid dropping references inside your game loop and try to allocate outside it when possible, re-use objects from a pool instead of reallocating inside your game loop. (The garbage collector is a huge source of Java performance issues, you want to keep it from running inside your game loop and the only way to do that is to not generate any garbage), if you generate garbage while the app is loading you can attempt to force the gc to run before entering the main loop by abusing weak references, sleep, and the system.gc() method (The spec doesn't guarantee that it will work but in practice it works on most JVMs, just make sure you limit the number of attempts made)

 

2) Strings are immutable, a new string will be created and the old one garbage collected if you modify a string, use stringbuffers if the text has to change inside your game loop and stringbuilder to assemble longer strings.

 

3) Always reserve space in your containers when you create them (this avoids expensive allocations/re-allocations when you fill them with data), use the right container for the job (Linked lists have horrible cache performance and are almost always the wrong choice) (edited for clarification)

 

4) trig operations in Java require a precision that x86 cpus fails to match outside the -pi/4 - pi/4 range, Java will do a very accurate and fairly expensive argument reduction for values outside that range on x86, the further you stray from the accurate range the slower those calls become so it helps to keep angles within the -PI - PI range (instead of the 0 - 2*PI range or -infinity - infinity range)

 

5) Native calls are quite expensive in Java, if you have to use native functionality you should write or use a fairly high level native library rather than wrapping low level native functions directly.

 

6) Don't use dynamic dispatch if you don't need it, even though it is cheaper than in native languages it usually isn't free.




#5196212 Accurately estimating programming cost?

Posted by SimonForsman on 04 December 2014 - 03:15 AM

The easiest way to estimate the cost of any project is to break it down into smaller parts and then make an estimate for each part based on your experience with similar tasks in other projects.

 

If you are buying services you should ask the contractors for an estimate and check their references.




#5196071 Weird stuff happening when stepping through a threaded code

Posted by SimonForsman on 03 December 2014 - 08:33 AM

 

first of all, your code is not thread safe, calling AddNewPath, GetPath, IsJobDone or RemoveJobresultAt while your thread is running is likely to end badly.

 

Multiple instances of AstarManager will also share data but run their own threads (again, without synchronization this will result in wierd bugs, if you are entering the update method multiple times then you are most likely creating multiple instances of AstarManager)

 

 

Edit: You havn't solved anything, Calling the thread twice only made the race-conditions more likely to occur, your code still isn't thread safe and thus can explode pretty much at any time. (Whenever you call a static method on AstarManager there is a small chance that it will blow up in your face as they modify data that the update loop assumes remains unchanged during an iteration)

 

 

My intention is to call the AstarManager once and never more than once. and then through the life duration of my software I would add jobs and remove them when they are done.

 

My understanding is that my code is thread safe unless I call AstarManager more than once. which I will not do.

 

just out of curiosity. what do I have to do to make my code thread safe? what am I doing wrong?

 

 

To make your code thread safe you should remove all statics(they make things far more complicated and don't really serve any useful purpose in this case) and ensure that all data manipulation is either synchronized or strictly controlled.

 

consider this method:

public static void AddNewPath(Node StartingNode, Node TargetNode, Map map, bool DisableDiagonalPathfinding, int JobNumber)
{
    for (int i = 0; i < AstarJobsList.Count; i++) //lets say that AstarJobsList.Count is 8 here
       //your main thread is happily running this loop, it is on its last iteration and i is 7 (still perfectly ok).
        // your update thread completes a job and removes it from the AstarJobsList (this doesn't look good)
        if (AstarJobsList[i].JobNumber == JobNumber) // AstarJobsList[i] no longer exists, booom !
            throw new ArgumentException("A job already exist with this JobNumber: " + JobNumber, "JobNumber");
        AstarJobsList.Add(new AstarJob(StartingNode, TargetNode, map, DisableDiagonalPathfinding, JobNumber));
}



#5196067 How does NVidia CP work?

Posted by SimonForsman on 03 December 2014 - 08:03 AM

It doesn't, it is basically a driver hack and nvidia has a list of games for which a given hack(such as AO) works, support for new games is added with driver updates. (nvidia added AO support to starcraft 2 wings of liberty in the R265 driver for example)




#5196066 Weird stuff happening when stepping through a threaded code

Posted by SimonForsman on 03 December 2014 - 07:46 AM

first of all, your code is not thread safe, calling AddNewPath, GetPath, IsJobDone or RemoveJobresultAt while your thread is running is likely to end badly.

 

Multiple instances of AstarManager will also share data but run their own threads (again, without synchronization this will result in wierd bugs, if you are entering the update method multiple times then you are most likely creating multiple instances of AstarManager)

 

 

Edit: You havn't solved anything, Calling the thread twice only made the race-conditions more likely to occur, your code still isn't thread safe and thus can explode pretty much at any time. (Whenever you call a static method on AstarManager there is a small chance that it will blow up in your face as they modify data that the update loop assumes remains unchanged during an iteration)




#5195089 Health bar graphics instead of text

Posted by SimonForsman on 27 November 2014 - 08:09 PM

I want to make my game display a health bar instead of plain text, how would I properly go about this? 

 

that depends on how you want it to look, the easiest would probably be to draw a quad/rectangle that is: maxwidth * (currenthp / maxhp) wide




#5194799 SDL Pausing game help?

Posted by SimonForsman on 26 November 2014 - 12:03 PM

I know this might sound stupid but what is the best way to go about pausing my game by pressing esc. I need it to pause everything then resume once i repress that key. Many thanks!

 

set paused = true when esc is pressed, don't update your game state if paused is true.




#5192891 How to repost coldfusion post variables in a 3rd page

Posted by SimonForsman on 14 November 2014 - 02:39 PM

if cold fusion supports sessions you can use that to store data, if not you can always have a form with hidden fields containing all the data on page2.




#5190878 Vertically scrolling underwater game, what to use as background?

Posted by SimonForsman on 03 November 2014 - 04:59 AM

 

I'm working on an endless-runner-game type game where the player has to catch coins and avoid bombs. It's underwater in the ocean and the scrolling direction is downward. The player moves towards the ocean floor, except it's like an endless pit and he will never actually reach the ocean floor.
 
The problem is that I don't know what to display as a background, because in open water there are no plants or rocks. wacko.png With a horizontally scrolling game this is easier because you can show plants or the floor moving. The enemies slowly move upward ofcourse, but I don't think that's enough to convey the downward scrolling motion...
 
Any tips or ideas will be much appreciated. Or does anyone know any underwater vertically games like this that I can take a look at?

 

 

I would put things like fish, cliffs, etc in background.




#5181344 Can you explain to me this code !

Posted by SimonForsman on 18 September 2014 - 01:26 PM

it will run & i know it is simple but why when i type 55
the result:
Man, learn to type a number. Good job! (why i get this result )
why i the result not  dead("You greedy bastard!")
Sorry Lysy but when i type the numbers i get many questions

if "0" in choice or "1" in choice:
    how_much = int(choice)
else:
    dead("Man, learn to type a number.")
the first line in that part checks if the text you've entered contains "0" or "1" , if it does it will try to convert the text to a number and assign it to the how_much variable , it the text doesn't contain 0 or 1 it will run the dead function with "Man, learn to type a number." as its parameter.

"55" doesn't contain 0 or 1 so it will run the dead function which prints the parameter "Man, learn to type a number." followed by "Good job!" and then it exits.


#5179020 C++ starter

Posted by SimonForsman on 09 September 2014 - 12:23 AM

i have 1 very big question to ask. ok i am only 15 and been so into programming since i was 12 and i know this is what i love. but i am not a very good at teaching my self through books or video but i have tryed so hard and  i have learned so much but it never seems like i know enough. like i am always going to be a beginner. so should i just give up and wait till i go to college for game dev and learn there or keep going on like a snail and learning really slowly and feeling like i know nothing all the time?


I've been programming for 20 years now, i still learn new things almost every day and there is a metric crapton of stuff that i still don't know.

Keep your projects small and try to add a few challenges to each project you make, if you havn't made any graphical games yet i'd recommend starting by making a pong clone (it covers the basics without complicating things).

You may allready know enough to solve some problems and you will never know enough to solve all problems, as long as you keep moving forward you will eventually get to a point where you know enough for someone to pay you to write code (and when it comes to learning nothing beats working 40+ hours / week with other professionals)


#5178163 GDI+ support on linux

Posted by SimonForsman on 04 September 2014 - 03:41 PM

As far as I know GDI+ is a Windows-only API, anyway I've read around that one might write his code in GDI+ and be able to port it to linux with something like this:
 
Is this true? Does anyone have experience of GDI+ applications that can also run on linux?


https://www.winehq.org/docs/winelib-guide/winelib-introduction

Yes it is sort of true, if your windows binary will run with wine then your windows source code will most likely compile using winelib aswell (Making porting quite a bit easier)




PARTNERS