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!


Waterlimon

Member Since 28 May 2011
Offline Last Active Today, 03:46 PM

#5207275 Second programming language...

Posted by Waterlimon on 28 January 2015 - 03:33 PM

Learning Lua could be useful too, since you can use it as a lightweight scripting language with C++ and the language is quite compact/elegant so it should be easy to learn.




#5207064 How to easily detect walls within a sight map? (FPS - Eye of the Beholder st...

Posted by Waterlimon on 27 January 2015 - 10:33 PM

In this particular case, easiest solution would be to add a function getReverseDirection() to return north on south, west on east etc.

 

Then your checks would just become a check to see if the reverse direction is not wall and another check to see if at least 3 of the 4 surrounding cells ARE wall.

So 1. check each direction if there is a wall, and increment a counter by 1 (count surrounding walls)

2. check that the direction behind you is not a wall

3. If in 1 you counted 3 walls (or 4 I guess), then because of check 2 it follows youre facing a dead end

 

 

I often try to use integer vectors (int x,y thrown in a class) to represent directions (0,1 / 1,0 / -1,0 / 0,-1) since its easier to do things like "get the reverse direction" or "get the adjacent position to player" using nothing but math (with enums you end up with a lot of conditional logic). Also I usually have an easy way to iterate over all directions (simple way to do that is to just have a vec2 allDirections[4]; around to use in a for loop)




#5202642 What are the currency standards in different countries?

Posted by Waterlimon on 07 January 2015 - 01:13 PM

Another thing you should consider is that in some countries the same amount of money (converted to USD) might buy you less so you might want to actually charge less in some countries:

http://www.gamasutra.com/blogs/GurinderSingh/20140721/221454/One_simple_Hack_to_Crack_IAPs_in_the_Developing_World.php

 

I dont know about the actual question, I would expect it to be similar everywhere.

 

What you can do is use the 18.99 instead of the 19.00 but make the cents use a smaller font like 1899. I dont know if there are any regulations regarding the visual form of the price.




#5202401 a better fix your timestep?

Posted by Waterlimon on 06 January 2015 - 04:42 PM

Another example of where this will fail is if you had a player standing on a vehicle driving in some direction.

 

If they two entities are not synced, they will jitter relative to each other. This will be especially visible if the camera is following the pair (since they should be perfectly static in that case were it not for the lack of sync which will make them jitter around)

 

Theres really no benefit compared to storing the preupdate 'logic state' (lets call this 'render state', that you build from the logic state before updating the logic state) and rendering that multiple times while the game state is being updated (taking camera changes into account) when it comes to render quality/smoothness (since all game objects will still be updating at the same fixed rate, just unsynced)

 

I have to say that your method has the benefit of not having to maintain a separate render state and logic state and still be able to render faster than game updates (in case camera moved during game update or such). Though in some cases youd want to keep the render and logic state separate for reasons other than faster render rate, so youd lose the benefit there.

 

IF you fix the synchronization problems (carefully choosing what chunks of objects to update in the 'sub updates', if you had two islands in the game for example you could probably update those separately) then to me this seems like a valid approach.

 

 

Im not sure whyd you use this though because the sync issue might make it more complicated than the alternatives, and the only real benefit seems to be smaller memory use (and even that only if you dont need to maintain separate render and logic state which might not be the case) which didnt seem to be a huge concern for your game based on the dynamic allocation thread.




#5201619 Linking Words as Conditional Statments

Posted by Waterlimon on 03 January 2015 - 04:15 PM

I cant make out much sense out of this, but I feel these would be more useful in describing the properties of the system at a meta-level, something similar to unit tests or asserts or such, which would help the compiler to detect errors (or resolve ambiguities) or optimize. Basically throwing extra information at the compiler about relationships between pieces of code or data.

 

Eg you might give specific examples on what output the code should give for some input, or describe something in multiple different ways (provide multiple algorithms and the compiler chooses which one to use based on usage patterns etc?)

 

IMO there is little point in trying to find connections between real world human stuff and code, and often the opposite is more beneficial since thinking of the program in terms of real world concepts can cloud your mind since what applies in the real world probably doesnt apply in code even if you are trying to model the real world in some way.




#5198339 Displaying fleets on the galactic map (warp)

Posted by Waterlimon on 15 December 2014 - 09:51 AM

When the fleet is stationed at a planet, the user wants the fleet associated with the planet and planet associated with the fleet:

Fleet <=> Planet

 

This is trivial by displaying them together. If you have a global list of fleets, make sure you can easily discover the planet its on and same for list of planets (again trivial).

 

When a transfer is planned, the user wants the following:

Source <=> Fleet <=> Destination

 

The source needs to be known given the fleet because the user can cancel the transfer still and this changes the state of the source as well as the destination.

 

When a transfer is in progress, the user wants to know:

Fleet <=> Destination

 

The source is irrelevant because whether the transfer exists or not is irrelevant to its state in the present and in the future because you cant cancel transfers in progress (the destination is relevant because its state will be changed when the transfer is complete)

 

So I would say that during planning, you could display something like

 

[RealPlanet (source)] -> RealFleet -> [VirtualPlanet (destination)]

near the source planet (so when you look at the source planet, you see that the real fleet that exists there is about to transfer to the destination planet (the virtualplanet could be a stylized representation of that planet, a pair of coordinates, a planet name, a button you can hover over to show the actual destination planet wherever it is...)

and

[VirtualPlanet (source)] -> VirtualFleet -> [RealPlanet (destination)]

near the destination planet to show that you have planned a transfer there, with virtual 'links' to the fleet and source planet in case you need to change something

 

During transfer you would remove the stuff near the source planet and remove the [VirtualPlanet (source)] from near the destination planet, only leaving the VirtualFleet symbol thingy.

 

Visually it could be like

 

(earth) Fleet1> -> [(Moon)]

[(earth) Fleet1>] -> (Moon)

 

looking at source (earth) and destination (moon) respectively. Basically everything that is located somewhere else is made 'virtual' (represented by [brackets] here)

 

Visually it would make sense to direct these incoming and outcoming fleet indicators such that they point toward the dest/src planet if possible, because the user probably maintains some kind of spatial map of the world in their head and uses this spatial map to remember what is going on where, so the spatial information is important in both quickly remembering where the fleet was going (without reading the details) as well as why ('oh yeah I have this massive celestial clash going on with that pirate faction in the top right corner of the universe, so this fleet must be going there') (this would allow you to even hide the source/dest details if the screen is too cluttered since the directional information should help the user remember that information to some extent)




#5198032 New steps to take to improve my programming skills

Posted by Waterlimon on 13 December 2014 - 02:21 PM

What you need is:

-API to create window and other OS interaction like I/O (win32 is lowest level youll get I guess on windows, but I suggest some nicer API to wrap the functionality so its not so ugly, like GLFW or something like SFML for simple games, SDL is popular too I think)

-Buttons and interaction with them using either some UI library, or by coding your own using a graphics API (OpenGL, DirectX) + input using the above mentioned OS interaction API

 

This is assuming C++

 

If you were to use a graphics API (or the higher level libraries like SFML, SDL) to make your own UI, you would create a window, then possibly initialize some sort of graphics device/context/whatever and use the functionality provided to draw some boxes in a loop and then do some basic programming to code the interaction based on mouse/keyboard input from some other API.

 

Dont know how you would initialize an UI library, but using one should make it much easier to input/output textual/numerical information (which is very tricky to code yourself)

 

Using C++ cross platform means that you implement OS specific code separately for each platform. Cross platform libraries do this so you dont have to (but if you dont use cross platform libraries you might have to lets say implement the same functionality using lib A for windows and lib B for mac)

You would then compile a separate executable for each platform (and the correct platform specific code will be compiled because it was set up that way).

 

I wouldnt worry about cross platform for now. Just find a library/API for your language of choice that can get buttons on the screen (+whatever APIs you need to support it) and that should be enough (Im assuming it also allows effective manipulation of those buttons through code...)




#5195407 Simulate turning radius of a car

Posted by Waterlimon on 29 November 2014 - 05:09 PM


So I am stuck what you mean by "use matrices and vectors"!?

 

You mentioned trigonometric functions so I immediately reacted by telling you to use vectors and matrices, because usually theyre enough.

 

I believe you would somehow multiply the car matrix with another matrix that has been offset and then rotated... I usually think about matrices in terms of working in the 'object space' of an entity and then moving the matrices from object to world space and the other way. So first youd calculate the object space rotation matrix for turning the car about a point (left/right of rear axel), then do something like carMatrix.toWorldSpace(localMatrix) to find the new matrix for the car.

 

I tend to use quite a lot of trial and error because im not that familiar working with matrices and get the order wrong...




#5184967 n-dimensional noise generation

Posted by Waterlimon on 04 October 2014 - 10:00 AM

You could also try to do it by setting the seed of the RNG. For example, you could use the hash function given by Alvaro to set the seed (the default_random_engine seems to have a method to set it)

 

Using something simple like x*width + y might work fine too. (you can combine this with another value which is the same for the entire map or texture, this would be the seed of your map/texture)

 

This means that after setting the seed, youll get the same exact sequence of numbers every time. This is useful if you need more than one random number per coordinate. So instead of a single random number that is the same every time, you can get as many as you want and theyll be the same every time.

 

Im not sure if this has performance implications or if it causes issues with the distribution of the random numbers generated.

 

Something like:

void genStuff(x,y)
{
    gen.seed(hash(x,y))
    for 1 to 100
    {
        float random=line(gen)
        *Do fancy generation logic using random*
    }
}



#5184964 Should i prioritize CPU or Memory usage?

Posted by Waterlimon on 04 October 2014 - 09:47 AM

What you want is for your program to work as intended and not have any negative effects on the system.

 

Too high CPU/GPU use means it doesnt work. Too high memory use means it doesnt work.

 

But thats not all. You also need to take into account the context. If your program uses all of the RAM, it might work, but what if the user wants to run another program too? What if the user has a different amount of RAM than another user? What if the user doesnt want your program to constantly use the HDD because it wears it out or prevents the user from doing video capture or whatever? What if the user has a laptop and too much processing makes the battery run out fast or forms too much heat?

 

So for your map loading example, you want to make it adjustable. Youre probably not on a console, so every user and their machine is different. Thats why we have graphics options in practically all games (and a lot of them).

 

For the stuff that doesnt make sense to be adjustable, you need to predict what kind of resources the application will use and how much, and try to balance it all out so that nothing ends up being a huge issue.

 

Generally this is easy, since one of the approaches is usually easier than the others, so you can just use that one and come back to it later if required. If the approaches are vastly different in every aspect, it is more difficult since choosing the wrong one could be a complete waste of time (since you might need to reimplement the whole thing, not just make a small addition or tweak). For those situations you just need to have experience and know your projects requirements and make an educated guess.




#5184534 Funniest line of code ever ?

Posted by Waterlimon on 02 October 2014 - 04:12 AM

I would much prefer the use of arrays instead of separate variables for the animations, because there IS a mathematical relationship between them, and using separate variables hides that knowledge from the compiler.

 

ANIM* runAnims[4];

ANIM* idleAnims[4];

 

The same thing bugs me with many other things like vectors of all types, whatever they represent. If an array of variables isnt represented as an array or equivalent, theres bound to be repetition.

 

Though here something that mapped a direction vector to an animation would be nicer. But that is easy to implement by providing a unitDirectionToArrayIndex(vector<2> dir) helper function.




#5183720 Making a shot harder to pull off.

Posted by Waterlimon on 29 September 2014 - 07:06 AM

Do something funny like making the players weapon jam every time he is about to get a heartshot in a situation where you dont deem it acceptable.

 

Or change the game design on a larger scale to not make it such a problem.

 

Or add some random element to make it not successful most of the time (your arm is shaking and the gun is shaking all by itself and the bullet is shaking while flying because turbulence and the enemy is shaking while trying to avoid being hit and the heart is rapidly shifting position because adrenaline).




#5183702 ROBLOX/Other Games Programming(Lua)

Posted by Waterlimon on 29 September 2014 - 04:54 AM

Used to play roblox, now just use their forums as a tool of procrastination.

 

 

 


I actually came here to ask for some useful sites or tips to get me started. Yes I want to use Lua for more games, not just ROBLOX. I do have a semi good understanding of Lua, I just need some extra assistance. 

 

Ive seen many people go for the Lua based game engine LÖVE.

 

It seems to be limited to 2D, but has all the things a game engine should have (hardware accelerated sprite rendering with shaders, physics, threading, networking, bunch of utilities...)

It also seems possible to use LuaJIT (not sure if its enabled by default) so I guess it will also be faster than roblox for the Lua-side code.

 

So you could use that.

 

 

You should also learn at least the basics of some other language (probably C#, C++ or Java) simply because they are so popular and if you understand them, you will gain a better understanding of how any programming language (including Lua) works in general. For example you could just read through some C++ online tutorial to the point where you know what pointers are and make some silly console application.

 

Another thing that might be useful is to check the official Lua documentation. Especially the reference manual, since it seems to offer a good explanation of the workings of Lua (since as a dynamic scripting language there is some magic going on to map the Lua script to how the computer works at a low level).

 

And of course, keep googling and reading about things you want to do in whatever game you are working on, be it the general structure of your code, some GUI design issue or a difficult decision of how to implement jumping.

 

You still might find that you want to keep scripting in roblox because you get free hosting and a lot more publicity for your stuff than if you make an independent game (unless you are serious about it and are able to gather a community of your own around it).




#5181893 simple crafting system

Posted by Waterlimon on 21 September 2014 - 09:20 AM

I have always disliked crafting system where you supposedly have to discover a recipe to use it (=look it up on the wiki because theres no logic to the crafting ingredients required to make something)

 

So I personally would prefer a very transparent crafting system. Basically an ingame list of all craftable items, structured logically. And highlight items you might want to craft (relevant to current situation), AND items you can craft or almost can craft (you have the ingredients in inventory).




#5181767 Point based physics engine

Posted by Waterlimon on 20 September 2014 - 02:18 PM

Ok I see, so you want basically a grid based (3D) game with physics?

 

What I was thinking is that give each 'point' a float position to make the physics smooth.

 

However, you could still have the physics rely on the grid cells - a point may only interact with neighboring grid cells.

 

 

I did something similar for a 2D grid game, because I wanted the player to be able to stand anywhere, not just at the center of a grid cell. But the collision detection still worked based on grid cells (the player was 1 grid cell sized square)

 

 

What I did was to have a normal grid for the world (you know, grass in this cell, stone here etc.)

And each moving entity had:

-Float position, velocity

-Integer position (grid position)

And the physics applied velocity to the float position, which was rounded to get the grid position (so it can find neighbor cells to do collision detection, like if in a cell above ground, limit the float position from going too low into the ground).






PARTNERS