Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Oct 2005
Online Last Active Today, 07:03 PM

#5216045 Saving old gamestates

Posted by SimonForsman on 12 March 2015 - 07:23 AM

Personally i would skip the copying for a system like this and instead make the old game states immutable. then you can quite easily have multiple threads update the game state (all can read the previous state without synchronization since it is immutable and as long as you don't try to update the same object from multiple threads you can do unsynchronized writes aswell.

#5215024 curious question, how good is Source engine?

Posted by SimonForsman on 06 March 2015 - 03:18 PM

Now that Source 2 is (or going to be) free for content developers (what about game developers?), I would like to ask if some of you have experience with Source. How does it compares to Unity/Unreal in terms of perfomance, features, tools and ease of use?


That seems like a fairly pointless question, Source 2 hasn't been released yet and Source is 11 years old now, at this point it would pretty much be all speculation, feature wise i would expect it to be on par with the competition though (anything else would be silly)

#5212950 Best tutorials for beginner to expert Unity Java?

Posted by SimonForsman on 25 February 2015 - 01:50 PM


Java Unity

Unless there was a really big announcement that I missed, that isn't a thing. 


JavaScript is supported. And there are lots of books and web sites that cover it.


Java and JavaScript are radically different, related only by name as people tried to cash in on another language's popularity. 



Strictly speaking its not JavaScript either, UnityScript is alot closer to JScript.Net and treating it like Javascript is a pretty bad idea. Alot of valid javascript code is invalid in Unity and you should always prefer to use static typing and generics(if necessary) in Unity rather than relying on dynamic typing like you would with JavaScript (it is significantly slower).


Personally i would recommend using C# instead since it is more commonly used. (more resources available and more people who can help you if you get stuck)

#5210165 Bad practice: GLfloat vs float?

Posted by SimonForsman on 11 February 2015 - 05:54 PM

As I work more and more on my application, adding classes, method, and etc, I noticed something.

Whenever I need a float variable, whether its a class attribute or a pass in param, I am defaulting to making it a GLfloat type.


I started doing this because all the OpenGL methods would take in GL**** type variables. But is this a bad thing to do? Am I limiting myself in anyway?


Should I be type casting variables to there GL**** type equivalent? Even if its not necessarily GLfloat, EG GLuint or GLvoid


That really depends on how you intend to use them, the size of float, double, int, long, etc are implementation defined and can vary between platforms and even between compilers on the same platform, in c++ the only guarantee you have is that double is atleast as big as a float and a long double is atleast as big as a double.


OpenGL however specifies that GLhalf is exactly 16 bits, GLfloat is always exactly 32 bits, and GLdouble is always 64bits, if you are targeting multiple platforms it is a very good idea to ensure that your datatypes are consistent (otherwise your rendering output can differ greatly between platforms) even though most compilers today will use 32 bits for float and 64 bits for double there may be exceptions.

#5210014 Exception while loading a file with content in Java

Posted by SimonForsman on 11 February 2015 - 06:53 AM

You are loading multiple(block.length * block[0].length) integers between each loadScanner.hasNext() check, this will cause an exception if there are fewer integers than expected in the file.

#5208592 Unity basic Script question

Posted by SimonForsman on 04 February 2015 - 04:13 AM

        myInt = MultiplyByTwo(myInt);

What is this line doing ?


and what is "return"



it sets the value of myInt to the value returned by the "MultiplyByTwo" function.


The multiplybytwo function works like this


//this a function named MultiplyByTwo that returns an integer
//the first int on the line specifies the type of data the function will return)
//MultiplyByTwo is the functions name
//and it takes one integer parameter that will be named "number" inside the function (int number)
int MultiplyByTwo (int number)
int ret; //create a temporary integer variable named "ret"
ret = number * 2; //set the value of ret to number * 2 //remember, number has whatever value we pass to the function (in your example it has the same value as myInt)
return ret; //return the value stored in ret.

#5208575 Trying to test a sever using my public IP

Posted by SimonForsman on 04 February 2015 - 02:36 AM

Hi. thanks for all the help.


I'm going to set the lap top with  a static IP and then port foward to that IP for the server app.


I was kind of hoping that I could getaway with not doing any thing to the network, like port forward.


I guess whats going on is its connecting to the router and then it does not know which computer to send the data to.



I say this because when using the loop back IP the clien can connect. It only fails when I pass in bogus IP address, that errors are being reported back.


Im really not sure why the client reports connected.


You may also need to enable NAT Loopback on your router (if it supports it, not all do) to be able to connect to a computer on your LAN from within your LAN using your public IP (Many routers will only forward traffic coming from the outside by default)

#5204853 Porting my game to Linux

Posted by SimonForsman on 16 January 2015 - 09:00 PM

1. Yes

2. It depends, if you stick to the LSB(you have to statically link any non LSB libraries, or replace them with a LSB equivalent) your game will run on all LSB compliant distributions (Using the LSB SDK is highly recommended), if you don't it is pretty difficult to say, it will most likely work on most debian based distributions atleast.

#5204362 what kind of questions should I expect in a web developer Interview

Posted by SimonForsman on 14 January 2015 - 07:59 PM

When it comes to payment:

Recruiting is very expensive, an interview process tends to consume a considerable number of manhours, hiring the wrong person is a very costly mistake and your salary is not the only cost your employer will have for you. they also need to have office space for you, hardware, software licenses, insurances, etc, a hundred dollars more or less each month on your salary will most likely not make much of a difference if they think you are the right person for the job so it isn't worth underselling yourself, knowing your worth and convincing others of it may be tricky if it is your first job though.


You should also remember that the interview is for both parties, you should use the interview to find out if you actually want to work there, their current websites are ancient(titleconnect.com is fixed width 750px, table based with a classic asp/vbscript backend, most likely built in the late 90s) and are in desperate need of a complete rewrite (a job that could be both fun and challenging if their plans for the future in that area are ambitious enough or a boring way to kill or stall your career if they prefer to update and maintain the junk they have or just replace the frontends with something friendlier to modern devices).

#5204214 Code appearance, is it really important?

Posted by SimonForsman on 14 January 2015 - 08:54 AM

Thanks to everyone who replied at this. Seriously I never thought that code clarity was that important, and I also learned a lot of stuff about code, so I hope everyone else find this post as useful as I do.

I think that I have to learn all the methods of the libraries that I'm using, because what I usually do when I am coding is write the algorithm in pseudocode in my mind and then I kind of traduce it to Python or the the language I'm using.

Maybe someone knows a book or something about how to achieve better code.


You don't really have to learn all the methods of all the libraries you're using(for some languages that is pretty much impossible due to the scope), just try to get an overview of what functionality they contain and keep the documentation close at hand.


your original example is a bit flawed aswell, the two pieces of code do different things, the first one can take the same number multiple times, the second will pick 5 different numbers.


if you want to generate a list of 5 random numbers between 0 and 9 with possible duplication (same as your first code) you can do:

Numbersrandom = [random.randint(0,9) for _ in range(5)]


and if you want to generate a list of 5 random numbers between 0 and 9 without duplication you can do:

Numbersrandom = random.sample(range(10), 5)


for larger ranges you can also use xrange(which returns a generator rather than a list) instead of range to speed things up

#5204009 Code appearance, is it really important?

Posted by SimonForsman on 13 January 2015 - 02:04 PM

I want to know if it really matters at the of the day, how your code looks like or how you wrote it.

For example, I made a program to a friend who laughed at me because I wrote this(Python):

Numbers = [1,2,3,4,5,6,7,8,9,0]
NumbersRandom = []
For i in range(5):
X = random.randint(0,9)
Print (Numbersrandom)

Instead of this:

Numbers = [1,2,3,4,5,6,7,8,9,0]
Numbersrandom = random.sample(Numbers,5)
Print (NumbersRandom)

Both programs print a list of five random numbers, so what do you think about it? Is it the big deal or not?


for a small program, no its not a big deal


For larger programs however things like that will add up to alot of unnecessary complexity, more complexity increases the risk of new bugs being introduced in the code, makes new features harder to add and makes existing bugs difficult to find.

#5203650 how make games in c++

Posted by SimonForsman on 12 January 2015 - 05:26 AM

yes I programmed Hello World


but how make games in c++


book tutorial serves


C++ does not have any functionality for rendering graphics in its standard library, you will need to use whatever APIs your target platform provide (or a higher level cross platform library such as SDL or SFML) for that.


At the most basic level a game consist of a loop that:

1. checks for user input.

2. Updates the game state

3. Draws a representation of the game state to the screen.


I'd recommend taking a look at SDL or SFML (both work on all major desktop operating systems and are reasonably easy to use)

#5203267 Adding third party libraries to version control

Posted by SimonForsman on 10 January 2015 - 08:18 AM

When the repository of your submodule gets moved by its owners, suddenly all your commits get broken. Even when you add a new commit to fix it it does not repair your older commits and you can have fun with learning git filter-branch, if you even feel retroactive editing on old commits is appropriate.

I read it may help to have a simple high level repository only storing submodule commit ids and treat your code like all libraries by keeping it in a submodule, but this adds busywork the whole time you use it.


The easy solution is to clone the library repository and maintain your own, just keep the official repo as a remote to pull updates from (its easy to change a remote if it moves)

#5201868 Lowest android device to target?

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

Where are these dashboard figures?

you linked to them in your first post.

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