• What do you need help with? Version 1
    5,001 replies, posted
Oh, it's an Android Minecraft client? Very nice!
Been trying to implement collision detection for a simple game. Is a 3D game but the collision detection only needs to be 2D as you can't move up or down a level as it takes place on water. So far I have simple bounding boxes to see if two ships are near each other, then if they are I want more precise collision detection but not sure what the best one to use is. Have read about AABB, OBB, Separating Axis and then a whole load of other ideas like making each triangle making up the model a plane and am at a loss of which one is best. Anyone got any suggestions of which one is the easiest to understand?
[QUOTE=Overv;26508556]I don't need any shaders, so there's no reason for me to not use built-in features. Also, pre-2.2 Android devices don't support the new Java OpenGL bindings that allow shaders.[/QUOTE] this. I'm trying to get into Android graphics (just 2D) with OpenGL ES. The fact that it's really depreciated sucks. Most tutorials use newer versions of OpenGL. And most tutorials only have guides on 3D graphics. Would using the Canvas class from Android.Graphics be a better solution?
[QUOTE=robmaister12;26521955]this. I'm trying to get into Android graphics (just 2D) with OpenGL ES. The fact that it's really depreciated sucks. Most tutorials use newer versions of OpenGL. And most tutorials only have guides on 3D graphics. Would using the Canvas class from Android.Graphics be a better solution?[/QUOTE] All Android devices running Android 2.0 or later support OpenGL ES 2.0, which gets rid of all of the deprecation you mention. What's more is that it completely forces you to use all of the new features, unlike OpenGL on the PC.
[QUOTE=Overv;26522134]All Android devices running Android 2.0 or later support OpenGL ES 2.0, which gets rid of all of the deprecation you mention. What's more is that it completely forces you to use all of the new features, unlike OpenGL on the PC.[/QUOTE] Awesome, I didn't know about that. Are there any major devices left in pre-2.0 Android though? (I'm assuming most of them have updated to 2.2, or at least 2.1/2.0)
Not really, looks like all popular pre-2.0 devices have had an 2.1 update. ([url=http://en.wikipedia.org/wiki/Comparison_of_Android_devices]Source[/url])
Does anyone feel up to explaining how I could go about achieving a nice-ish blur effect with GLSL? I've looked around a few websites, but I couldn't really make much sense of a lot of them.
[QUOTE=Chris220;26528511]Does anyone feel up to explaining how I could go about achieving a nice-ish blur effect with GLSL?[/QUOTE] do a weighted average of pixels within a circle for every fragment?
[QUOTE=deloc;26528951]do a weighted average of pixels within a circle for every fragment?[/QUOTE] Ah, like a gaussian blur? Let's see if I can get that working... Edit; I think I should give up on this for now, I don't really have a clue what I'm doing.
Okay, I'm having another problem with my scripting language. I can't figure this out at all. Every time I run my program and try to set a value to my variable hash_map I get a runtime error, VB2010's debugger gives me the following info [code] _KeyVal - [size]: CXX030: Error: expression cannot be evaluated - [capacity]: CXX030: Error: expression cannot be evaluated this: 0x00151d28 {comp=less} - comp: less [/code] on the line: [code] long _Quot = (long)(hash_value(_Keyval) & LONG_MAX); [/code] I believe the code involved is: [cpp] void Set( const std::string &name, const std::string &value ) { myVariables.insert( myVariables.end(), std::pair<std::string, std::string>( name, value ) ); } [/cpp]
[lua] function updateCells() for y = 1, yCells do for x = 1, xCells do neighbours = 0 if map[y-1][x-1] ~= nil and y ~= 0 and x ~= 0 then if map[y-1][x-1] == 1 then neighbours = neighbours + 1 end end if map[y][x-1] ~= nil then if map[y][x-1] == 1 then neighbours = neighbours + 1 end end if map[y+1][x-1] ~= nil and y ~= yCells then if map[y+1][x-1] == 1 then neighbours = neighbours + 1 end end if map[y-1][x] ~= nil then if map[y-1][x] == 1 then neighbours = neighbours + 1 end end if map[y+1][x] ~= nil and y ~= yCells then if map[y+1][x] == 1 then neighbours = neighbours + 1 end end if map[y-1][x+1] ~= nil and x ~= xCells then if map[y-1][x+1] == 1 then neighbours = neighbours + 1 end end if map[y][x+1] ~= nil and x ~= xCells then if map[y][x+1] == 1 then neighbours = neighbours + 1 end end if map[y+1][x+1] ~= nil and y ~= yCells and x ~= xCells then if map[y+1][x+1] == 1 then neighbours = neighbours + 1 end end if map[y][x] == 1 then -- Currently alive if neighbours < 3 then map[y][x] = 0 -- Death by loneliness end if neighbours == 3 then map[y][x] = 1 -- Survives end if neighbours > 3 then map[y][x] = 0 -- Death by overcrowding end else -- Currently dead if neighbours == 3 then map[y][x] = 1 -- New life end end end end end [/lua] First time using Lua and Love. Can anyone tell why this causes a crash? It seems to be [lua] if map[y-1][x-1] ~= nil and y ~= 0 and x ~= 0 then if map[y-1][x-1] == 1 then neighbours = neighbours + 1 end end if map[y][x-1] ~= nil then if map[y][x-1] == 1 then neighbours = neighbours + 1 end end if map[y+1][x-1] ~= nil and y ~= yCells then if map[y+1][x-1] == 1 then neighbours = neighbours + 1 end end if map[y-1][x] ~= nil then if map[y-1][x] == 1 then neighbours = neighbours + 1 end end if map[y+1][x] ~= nil and y ~= yCells then if map[y+1][x] == 1 then neighbours = neighbours + 1 end end if map[y-1][x+1] ~= nil and x ~= xCells then if map[y-1][x+1] == 1 then neighbours = neighbours + 1 end end if map[y][x+1] ~= nil and x ~= xCells then if map[y][x+1] == 1 then neighbours = neighbours + 1 end end if map[y+1][x+1] ~= nil and y ~= yCells and x ~= xCells then if map[y+1][x+1] == 1 then neighbours = neighbours + 1 end end [/lua] this part, but it was working before...
I would imagine map[yCells+1] == nil and your code tried to index it. Change the loop to iterate from 1 to yCells-1 or put a nil check in there and you should be fine. [editline]7th December 2010[/editline] Doesn't löve spit out errors btw?
Yeah love has handling routines a window pops up if there is a error in running the code. Now for my issue, i have a 16 bit number, how would i store that as taking up exactly 2 bytes in a file? this is what i have with the easy soultion.. [code] 01 00 00 00 01 01 00 01 00 00 00 02 01 18 00 [/code] this is converted from [code] set 257 0 set 258 24 [/code] using [csharp] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ARIS_Assembler { class Program { static void Main(string[] args) { FileInfo info = new FileInfo(args[0]); StreamReader reader = new StreamReader(args[0]); Console.WriteLine(info.DirectoryName + "\\out.bin"); BinaryWriter writer = new BinaryWriter(File.OpenWrite(info.DirectoryName + "\\out.bin")); while (reader.EndOfStream == false) { string line = reader.ReadLine(); string[] tokens = line.Split(' '); switch (tokens[0]) { case "set": writer.Write(0x01); writer.Write(short.Parse(tokens[1])); writer.Write(byte.Parse(tokens[2])); break; default: Console.WriteLine("Invalid Token"); Environment.Exit(1); break; } } reader.Close(); writer.Close(); } } } [/csharp]
I'm trying to generate a float within a range (0 to 6.2) but something's going wrong. I'm using the method [url=http://www.cplusplus.com/forum/general/14192/]here[/url], but it generates numbers from -3 to 0. What's the best way to get a random float in a range?
Is this what you want? [url]http://codepad.org/BCOY4qCE[/url] (actually, this will generate 0 - 6.1 inclusive. if you want 6.2 as a possible value, change the "62" to "63".)
[QUOTE=Vbits;26535744]Yeah love has handling routines a window pops up if there is a error in running the code. Now for my issue, i have a 16 bit number, how would i store that as taking up exactly 2 bytes in a file? this is what i have with the easy soultion.. [code] 01 00 00 00 01 01 00 01 00 00 00 02 01 18 00 [/code] this is converted from [code] set 257 0 set 258 24 [/code] using [csharp] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ARIS_Assembler { class Program { static void Main(string[] args) { FileInfo info = new FileInfo(args[0]); StreamReader reader = new StreamReader(args[0]); Console.WriteLine(info.DirectoryName + "\\out.bin"); BinaryWriter writer = new BinaryWriter(File.OpenWrite(info.DirectoryName + "\\out.bin")); while (reader.EndOfStream == false) { string line = reader.ReadLine(); string[] tokens = line.Split(' '); switch (tokens[0]) { case "set": writer.Write(0x01); writer.Write(short.Parse(tokens[1])); writer.Write(byte.Parse(tokens[2])); break; default: Console.WriteLine("Invalid Token"); Environment.Exit(1); break; } } reader.Close(); writer.Close(); } } } [/csharp][/QUOTE] Retoast for a new page, just looked at some generated code and there is double what is needed.
[QUOTE=BlkDucky;26534111][lua] function updateCells() for y = 1, yCells do for x = 1, xCells do neighbours = 0 if map[y-1][x-1] ~= nil and y ~= 0 and x ~= 0 then if map[y-1][x-1] == 1 then neighbours = neighbours + 1 end end ... snip[/lua] First time using Lua and Love. Can anyone tell why this causes a crash? It seems to be [lua]-- snip --[/lua] this part, but it was working before...[/QUOTE] Lua arrays begin with 1 as first index, and you are starting the loop with 1. So far, so good. However, you are checking map[y-1] stuffs and map[something][x-1], which leads to the index being 0. Dunno if this would result in a crash, or just the nil you are checking for. [QUOTE=Vbits;26535744]Yeah love has handling routines a window pops up if there is a error in running the code. Now for my issue, i have a 16 bit number, how would i store that as taking up exactly 2 bytes in a file? this is what i have with the easy soultion.. [code] 01 00 00 00 01 01 00 01 00 00 00 02 01 18 00 [/code] this is converted from [code] set 257 0 set 258 24 [/code] using [csharp]-- long code snip --[/csharp][/QUOTE] [csharp]writer.Write((byte)0x01);[/csharp] ?
Not being very considerate and ignoring other questions, is using a old / very old computer good practice for programming? You know, force you to efficiently use resources?
I have a weird issue with DirectX, ive checked the D3DCAPS9 and my graphics card shouldent do this For example with breen, a part of the model dissapears [img]http://dl.dropbox.com/u/4838268/fuuuu.png[/img]
[QUOTE=Tobba;26545510]I have a weird issue with DirectX, ive checked the D3DCAPS9 and my graphics card shouldent do this For example with breen, a part of the model dissapears [img_thumb]http://dl.dropbox.com/u/4838268/fuuuu.png[/img_thumb][/QUOTE] Is it clipping the near plane or something?
[QUOTE=Sake;26545386]Not being very considerate and ignoring other questions, is using a old / very old computer good practice for programming? You know, force you to efficiently use resources?[/QUOTE] Even an old computer has quite some resources, unless you mean a really old computer. But then also compilation-times would raise unnecessarily and you limit the number of newer standards and libraries you can use. You can learn to code resource-efficient programs with a modern computer just as well. Just don't do what you don't need to do.
[QUOTE=esalaka;26545661]Is it clipping the near plane or something?[/QUOTE] Nope
I need help finding a good 3d engine besides Xna to make a 3d calculator in.
[QUOTE=bootv2;26547210]anybody?[/QUOTE] What exactly happens when you try to compile your project?
[QUOTE=bootv2;26548019]linker errors, I'll try to compile and post the compile log for a sec. edit: 1>------ Build started: Project: sfml, Configuration: Release Win32 ------ 1>Build started 7-12-2010 20:09:08. 1>InitializeBuildStatus: 1> Touching "Release\sfml.unsuccessfulbuild". 1>ClCompile: 1> All outputs are up-to-date. 1>main.obj : error LNK2001: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) 1>main.obj : error LNK2001: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) 1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) 1>C:\Users\Tim\Documents\Visual Studio 2010\Projects\sfml\sfml\Release\sfml.exe : fatal error LNK1120: 3 unresolved externals 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:01.62 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== with the code: #include <SFML/System.hpp> #include <iostream> int main() { sf::Clock Clock; while (Clock.GetElapsedTime() < 5.f) { std::cout << Clock.GetElapsedTime() << std::endl; sf::Sleep(0.5f); } return 0; }[/QUOTE] Which libs are you linking against?
[QUOTE=bootv2;26548084]how do I know? I'm just guessing it are the system libs. but it does this with all of the sfml libraries.(tried graphics and sound apart from system)[/QUOTE] You'll know because you link them yourself. Project - Properties - Linker - Input - Additional dependencies Link with the SFML libraries in there. Make sure you do it for both debug and release profiles.
Ok, this is kind of more math then programming but this is a good place for it. How would I get a value so that a variable starting at 255 will equal 0 by the end of a arbitrary period of loops? The number could be 1000 ticks or 5 ticks.
[QUOTE=MrBob1337;26552346]Ok, this is kind of more math then programming but this is a good place for it. How would I get a value so that a variable starting at 255 will equal 0 by the end of a arbitrary period of loops? The number could be 1000 ticks or 5 ticks.[/QUOTE] Subtract the total divided by the number of loops from the current value? Like [lua]total = 1000 new = total numloops = 10 for i = 0, numloops do new -= total / numloops end[/lua] I haven't tested it or anything but it looks like it should work.
Thanks, looks like that works. [editline]8th December 2010[/editline] Wait no it's not. It's not influenced by the total number of loops for some reason, it's fading at a constant rate.
[QUOTE=MrBob1337;26553207]Thanks, looks like that works. [editline]8th December 2010[/editline] Wait no it's not. It's not influenced by the total number of loops for some reason, it's fading at a constant rate.[/QUOTE] You didn't use the variables correctly then.
Sorry, you need to Log In to post a reply to this thread.