• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=diwako;44796196]Anyone have some experience in creating Android apps? So far I've set up eclipse with the android SDK, created an AVD which I can start. Yet when ever I run the Project as Android Application nothing happens. Anyone got an idea?[/QUOTE] In my experience, the emulators take a [i]long[/i] time to start up. The shortest time I've ever had one start up was ~5 minutes, the longest took over half an hour and I ended it. You're probably going to be better off trying to put it on your phone and booting it there if you can.
So I have a small recursion problem. I have a function that performs perfectly iteratively (non-recursively, with a loop). What it does, is it takes the average of adjacent elements in a Sequence, and returns them in a new Sequence. In other words.. Seq = {1, 3, 5} return = {(1+3)/2, (3+5)/2} return = {2, 4} Here's the implementation iteratively. [code] private static Sequence<Integer> smooth(Sequence<Integer> s1) { Sequence<Integer> retSeq = s1.newInstance(); Integer copy = null; for (int i : s1) { if (copy == null) { copy = i; continue; } retSeq.add(retSeq.length(), (copy + i) / 2); copy = i; } return retSeq; } [/code] Here're the methods available. [IMG]http://puu.sh/8LppO.png[/IMG] [IMG]http://puu.sh/8Lpr6.png[/IMG] Here's my attempt at it, but I can't wrap my head around it. [b]*Edit: I know it's not even recursive -- which is where I'm having some problems. .-.[/b] [code] private static Sequence<Integer> smooth(Sequence<Integer> s1) { Sequence<Integer> copy = s1.newInstance(); copy.transferFrom(s1); Sequence<Integer> retSeq = s1.newInstance(); if (s1.length() == 2) { retSeq.add(retSeq.length(), (copy.remove(0) + copy.remove(1)) / 2); System.out.println("|s1| == 2"); } else if (s1.length() > 2) { int tmp = copy.remove(0); retSeq.add(retSeq.length(), (s1.remove(0) + copy.remove(1)) / 2); retSeq.add(retSeq.length(), smooth(s1).remove(0)); s1.add(0, tmp); } return retSeq; }[/code] Any help?
Okay I've got a new 3d graphics programming assignment due in 2 weeks, this time I can use openGL. [quote]Marking Criteria Object Animation 15 Animation 5 Interaction 5 Collisions 5 Object Drawing 15 Camera/modelview transformations 5 Perspective transformations 5 Vertex attributes 5 World Generation 10 Terrain or Dungeon (BSP/ray cast) Texturing 10 Colour 5 Bump / Normal 5 Lighting 15 Diffuse 5 Specular 5 Ambient 5 Visible Surface Detection 10 Backface culling 5 z-buffering 5 Playability 10 Documentation 15 [/quote] Anyone have a good read on OpenGL to get me started? My idea is to make a plane game like 1942 but 3D, where the plane flies over the terrain adjusting it's height while avoiding getting blown up by enemies. I've already written code to generate terrain from a height map so that's some of the work already done, and the actual game component will be a piece of cake. What I need help with is using OpenGL. [editline]14th May 2014[/editline] Also what could be the cause of this error? [quote]Error 5 error LNK2001: unresolved external symbol _gluPerspective@32 F:\3407ICT Graphics Programming\assignment2\Project\Terrain.obj Graphics [/quote] Never mind I didn't link glu32.lib
Has anyone ever worked with [url=http://keplerproject.github.io/orbit]Orbit[/url] before? I'm more or less following the example they give, and for some reason it's not letting me use input HTML elements, even though they most definitely use them in the example. [b]Edit:[/b] nevermind, figured it out. forgot to call orbit.htmlify on the functions used in rendering, now i know the importance of such functions. [b]Edit again:[/b] would that be a question for the web development board?
CAn someone explain to me how order of growth works out?
[QUOTE=pyschomc;44809032]CAn someone explain to me how order of growth works out?[/QUOTE] [url=http://www.ccs.neu.edu/home/jaa/CSG713.07F/Information/Handouts/order.html]This looks resourceful.[/url]
[QUOTE=Pat.Lithium;44806285]Okay I've got a new 3d graphics programming assignment due in 2 weeks, this time I can use openGL. Anyone have a good read on OpenGL to get me started? My idea is to make a plane game like 1942 but 3D, where the plane flies over the terrain adjusting it's height while avoiding getting blown up by enemies. I've already written code to generate terrain from a height map so that's some of the work already done, and the actual game component will be a piece of cake. What I need help with is using OpenGL. [editline]14th May 2014[/editline] Also what could be the cause of this error? Never mind I didn't link glu32.lib[/QUOTE] [B]OpenGL[/B] [I]For starters:[/I] [url]http://open.gl/[/url] [url]http://www.arcsynthesis.org/gltut/[/url] [url]http://www.opengl-tutorial.org/[/url] [url]http://www.swiftless.com[/url] [url]http://learningwebgl.com/[/url] (WebGL) OpenGL SuperBible, Sixth Edition Interactive Computer Graphics: A Top-Down Approach with Shader-Based OpenGL [I]Advanced:[/I] GPU Gems 1 : [url]http://http.developer.nvidia.com/GPUGems/gpugems_part01.html[/url] GPU Gems 2 : [url]http://http.developer.nvidia.com/GPUGems2/gpugems2_part01.html[/url] GPU Gems 3 : [url]http://http.developer.nvidia.com/GPUGems3/gpugems3_part01.html[/url] ShaderX7
Decided to try and learn F# again, writing a parser. This works but isn't there a better way of checking the string for tokens rather than using recursion w/bunch of if-else's [code] let keyW = ["if";"then";"else";"elif";"end";"while";"for";"write";"return";"break"] let oneOps = ["=";"(";")";"<";">";"/";"*";"+";"=";"!";"&";".";";"] let twoOps = ["==";"<=";">=";"!=";"||";"-=";"+=";"";"";"";] let rec checkForToken (str:string) (lst:List<string>) = if lst.IsEmpty then "invalid" else if str.StartsWith(lst.Head) then lst.Head else checkForToken (str.Substring lst.Head.Length) lst.Tail let rec tokenize (str:string) (res:List<string>) = let keyRes = (checkForToken str keyW) if not (keyRes.Equals "invalid") then tokenize (str.Substring keyRes.Length) (keyRes :: res) else let oneRes = (checkForToken str oneOps) if not (oneRes.Equals "invalid") then tokenize (str.Substring oneRes.Length) (oneRes :: res) else let twoRes = (checkForToken str twoOps) if not (twoRes.Equals "invalid") then tokenize (str.Substring twoRes.Length) (twoRes :: res) else res [/code]
Currently writing something in Javascript, I'm having trouble with my canvas, my images do not want to display for some reason. Can someone please take a look at my code and see why exactly it is that my images don't show up on the mapArray? Please note that I'm a total beginner at Javascript ^^ Javascript: [url]http://pastebin.com/bD5QJabs[/url] HTML: [url]http://pastebin.com/UpLbDPGR[/url] Thanks :)
I found the reason why the core OpenGL functions weren't working for me. Turns out I didn't have "-framework OpenGL" in the linker flags. But now I have another seemingly uphill battle with my IDE. It has an "extra linker options" which I happily included but it seems that whenever anything is detected in that box it seems to also like adding an unnecessary "-n" flag to the compile, which just causes the whole thing to fail. I think my main problem is using Xamarin (an IDE designed mainly for C#/mono) for C++, but it does say it supports C++ development so does anyone have an idea what I can do?
So I'm writing a networked text adventure kind of game with ASCII graphics. I want more than 16 colors, I could write my own console but is there anything else I could do? Maybe an alternate console. I looked at Mintty, didn't like the GPL license. Any ideas?
How exactly do you guys handle arguments to your program? For instance: [CODE] $ myProgram { compress | decompress } { INPUT-FILE | -p } [ OPTIONS ] [/CODE] Do you guys just run a good bit of tests (conditions and loops) to verify and take care of arguments or do you normally use some special method to take care of it?
[QUOTE=Stonecycle;44818520]How exactly do you guys handle arguments to your program? For instance: [CODE] $ myProgram { compress | decompress } { INPUT-FILE | -p } [ OPTIONS ] [/CODE] Do you guys just run a good bit of tests (conditions and loops) to verify and take care of arguments or do you normally use some special method to take care of it?[/QUOTE] I usually just loop through each argument checking if it equals a switch. If it does, I just use the next argument in the sequence as that switch's value. For example: [code] //parameters String input = null; String output = null; boolean verbose = false; try { //loop arguments for (int argument = 0; argument < args.length; argument++) { switch (args[argument]) { case "-i": { input = args[++argument]; break; } case "-o": { output = args[++argument]; break; } case "-v": { verbose = true; break; } } } //check arguments if (input == null || output == null) throw new Exception(); } catch (Exception ex) { //invalid arguments System.err.println("Invalid arguments specified"); return; } [/code] You'd be able to do: [code] java -jar somejar.jar -i "C:/Users/Blah/Desktop/something.txt" -o "C:/Users/Blah/Desktop/something_else.txt" -v [/code]
So I quit programming for quite a while and want to get into it again, I did C# and XNA, but want to try something different now, I was thinking about Unity, what do you guys think?
[QUOTE=HiddenMyst;44815417]I found the reason why the core OpenGL functions weren't working for me. Turns out I didn't have "-framework OpenGL" in the linker flags. But now I have another seemingly uphill battle with my IDE. It has an "extra linker options" which I happily included but it seems that whenever anything is detected in that box it seems to also like adding an unnecessary "-n" flag to the compile, which just causes the whole thing to fail. I think my main problem is using Xamarin (an IDE designed mainly for C#/mono) for C++, but it does say it supports C++ development so does anyone have an idea what I can do?[/QUOTE] The C++ support leaves much to be desired in my experience, it's why I still use Windows, for Visual Studio. That said, some people seem to like Xcode though I've never tried it, from what I've heard it's code completion and such is pretty decent since it uses LLVM/Clang. [QUOTE=Staneh;44819051]So I quit programming for quite a while and want to get into it again, I did C# and XNA, but want to try something different now, I was thinking about Unity, what do you guys think?[/QUOTE] If you liked XNA there is now MonoGame which is more or less compatible as an option too... [QUOTE=Stonecycle;44818520]How exactly do you guys handle arguments to your program? For instance: [CODE] $ myProgram { compress | decompress } { INPUT-FILE | -p } [ OPTIONS ] [/CODE] Do you guys just run a good bit of tests (conditions and loops) to verify and take care of arguments or do you normally use some special method to take care of it?[/QUOTE] What language are you using, I only ever implement this myself in simple cases else I'll just use a library to do it for me since I generally can't be bothered to try and parse strings.
[QUOTE=Stonecycle;44818520]How exactly do you guys handle arguments to your program? For instance: [CODE] $ myProgram { compress | decompress } { INPUT-FILE | -p } [ OPTIONS ] [/CODE] Do you guys just run a good bit of tests (conditions and loops) to verify and take care of arguments or do you normally use some special method to take care of it?[/QUOTE] It depends on the language. Golang has a [url=http://golang.org/pkg/flag/]standard library package[/url] which handles most cases in a declarative way. If you don't have that luxury, and don't want to pull in dependencies on non-standard libraries for the purpose, then conditions and loops get the job done and are relatively clear.
[QUOTE=reevezy67;44814743]Decided to try and learn F# again, writing a parser. This works but isn't there a better way of checking the string for tokens rather than using recursion w/bunch of if-else's [code] let keyW = ["if";"then";"else";"elif";"end";"while";"for";"write";"return";"break"] let oneOps = ["=";"(";")";"<";">";"/";"*";"+";"=";"!";"&";".";";"] let twoOps = ["==";"<=";">=";"!=";"||";"-=";"+=";"";"";"";] let rec checkForToken (str:string) (lst:List<string>) = if lst.IsEmpty then "invalid" else if str.StartsWith(lst.Head) then lst.Head else checkForToken (str.Substring lst.Head.Length) lst.Tail let rec tokenize (str:string) (res:List<string>) = let keyRes = (checkForToken str keyW) if not (keyRes.Equals "invalid") then tokenize (str.Substring keyRes.Length) (keyRes :: res) else let oneRes = (checkForToken str oneOps) if not (oneRes.Equals "invalid") then tokenize (str.Substring oneRes.Length) (oneRes :: res) else let twoRes = (checkForToken str twoOps) if not (twoRes.Equals "invalid") then tokenize (str.Substring twoRes.Length) (twoRes :: res) else res [/code][/QUOTE] You can use [I]List.tryFind[/I], then match it against [I]None[/I] and [I]Some keyRes[/I], in which case the latter will capture the result into the [I]keyRes[/I] name.
[QUOTE=ben1066;44819356]What language are you using, I only ever implement this myself in simple cases else I'll just use a library to do it for me since I generally can't be bothered to try and parse strings.[/QUOTE] Java, but my question was more of a design question than compile error. Now the last question I have for now is piping to a Java program. Searching isn't yielding anything fruitful, just running shell commands via Java. How would I gather input via: [CODE] $ cat file.txt | myProgram decompress -p | grep eggs [/CODE] , with myProgram being my work of art in Java? [editline]e[/editline] Foooound it! Anything using System.in gets piped in, System.out pipes out, and System.err...I'm not quite sure where that exactly goes. No wonder it's common to initialize Scanners with System.in.
Are there any good Java Form Designers out there for free, or with alternative methods of obtaining?
How would I go about making Minesweeper? Where would I even start? I'm using [URL="http://monofonik.github.io/scribble/"]Scribble[/URL]. Anyone?
[QUOTE=Just2Rusty;44822118]How would I go about making Minesweeper? Where would I even start? I'm using [URL="http://monofonik.github.io/scribble/"]Scribble[/URL]. Anyone?[/QUOTE] Figure out the basic things you need to do to make a simplified version of minesweeper - make a grid, add mines in random locations, hide those mines untill the user clicks/picks a grid location.. Just simplify it down to it's basics.
I'm imagining the game grid could be done using a list... Like. Say the game grid is 10x10. The list would contain a Horizontal list of 10 and a Vertical list of 10. Then as far as mines go... You could make mines a variable.. then for the list, say generate a random number between 1 and 10.. If the number is greater than say, 7, then that number (within either vertical or horizontal list)= mine. Otherwise it is blank. Then somehow match up the lists so that if Horizontal, 10 = Mine, Vertical 9 = 1.. If Horizontal 10 = mine, and Horizontal 11 = mine, Vertical 10 will = 2. Is that an okay method?
Has anyone used OpenTK? I need to separate some stuff but heres some boilerplate code I came up with, I drew a quad to test it but it is always drawn white. Any idea why? [code] using System; using System.Drawing; using System.IO; using Shared; using OpenTK; using OpenTK.Input; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL4; //Namespace clash with fixed function GL using GL4 = OpenTK.Graphics.OpenGL4.GL; namespace Client { class Display { public Vec2 VisibleStart = new Vec2(0, 0); private readonly Map map; private readonly Vec2 windowSize; public Display(Vec2 wSize, Map _map) { windowSize = wSize; map = _map; using(GameWindow window = new GameWindow(600, 400, new GraphicsMode(), "Game", 0, DisplayDevice.Default, 3, 0, GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug)) Load(window); } public void Load(OpenTK.GameWindow window) { window.VSync = OpenTK.VSyncMode.Adaptive; window.TargetUpdateFrequency = 60; window.Resize += (sender, args) => GL4.Viewport(0, 0, window.Width, window.Height); window.RenderFrame += (sender, e) => Update(window); window.RenderFrame += (sender, e) => Render(window); GL4.ClearColor(Color.Gray); uint[] VBO = new uint[1]; GL4.GenBuffers(1, VBO); GL4.BindBuffer(BufferTarget.ArrayBuffer, VBO[0]); float[] verts = { -0.2f, -0.2f, 1.0f, 0.2f, -0.2f, 1.0f, 0.2f, 0.2f, 1.0f, -0.2f, 0.2f, 1.0f }; GL4.BufferData<float>(BufferTarget.ArrayBuffer, new IntPtr(verts.Length*sizeof (float)), verts, BufferUsageHint.StaticDraw); int vertShaderHandle = GL.CreateShader(ShaderType.VertexShader); int fragShaderHandle = GL.CreateShader(ShaderType.FragmentShader); string vertShaderSource = File.ReadAllText("../../Shaders/Vert.vert"); string fragShaderSource = File.ReadAllText("../../Shaders/Frag.frag"); GL4.ShaderSource(vertShaderHandle, vertShaderSource); GL4.ShaderSource(fragShaderHandle, fragShaderSource); GL.CompileShader(vertShaderHandle); GL.CompileShader(fragShaderHandle); int programHandle = GL4.CreateProgram(); GL.AttachShader(programHandle, vertShaderHandle); GL.AttachShader(programHandle, fragShaderHandle); GL.LinkProgram(programHandle); string log; GL.GetProgramInfoLog(programHandle, out log); Console.WriteLine(log); int posAttrib = GL4.GetAttribLocation(programHandle, "position"); GL4.VertexAttribPointer(posAttrib, 3, VertexAttribPointerType.Float, false, 0, 0); GL4.EnableVertexAttribArray(posAttrib); window.Run(); } public void Update(OpenTK.GameWindow window) { if (window.Keyboard[Key.Escape]) window.Exit(); } public void Render(OpenTK.GameWindow window) { GL4.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL4.DrawArrays(PrimitiveType.Quads, 0, 4); window.SwapBuffers(); } } } [/code] Fragment Shader [code] #version 150 out vec4 Color; void main() { Color = vec4(1.0, 0.0, 0.0, 1.0); } [/code]
Turns out I forgot to call glUSeShader()
[QUOTE=Just2Rusty;44822332]I'm imagining the game grid could be done using a list... Like. Say the game grid is 10x10. The list would contain a Horizontal list of 10 and a Vertical list of 10. Then as far as mines go... You could make mines a variable.. then for the list, say generate a random number between 1 and 10.. If the number is greater than say, 7, then that number (within either vertical or horizontal list)= mine. Otherwise it is blank. Then somehow match up the lists so that if Horizontal, 10 = Mine, Vertical 9 = 1.. If Horizontal 10 = mine, and Horizontal 11 = mine, Vertical 10 will = 2. Is that an okay method?[/QUOTE] Yes, that's pretty much how to do it. Make sure you put in checks so the user can't guess out of bounds (above 10), and set a maximum amount of mines so you don't end up (possibly) with the entire map being mines.
[QUOTE=Just2Rusty;44822332]Then as far as mines go... You could make mines a variable.. then for the list, say generate a random number between 1 and 10.. If the number is greater than say, 7, then that number (within either vertical or horizontal list)= mine. Otherwise it is blank.[/QUOTE] You shouldn't give each tile a random chance of being a mine. A better way would be to randomly select n tiles and make them mines. If you select a tile that is already a mine then select another one. That way you can set the number of mines exactly.
You can also set up the grid as linear array and compute index with Y * W + X, that way you can just generate N mines by randomly generating N random numbers between 0 and W*H
Can someone help me out with a adj matrix? I'm working on a program that reads a input txt in this format [quote] A A: C, D B: A, D C: D, E D: E E: [/quote] Where A is the starting point node, and everything is in a string and the output is comes out to be like this [quote] [B]The output format is as follows "Vertex: the total cost of path: and the vertices that leads to the shortest path"[/B] A: 0: A B: Ifinity: C: 1: A,C …[/quote] [B]I have pretty much written the program which is base of dijstrka, but the problem is that trying to get the input to work and read correctly.[/B] I'm not good with inputting files , and I'm looking for tips
Could you tell us the programming language you're using, and show us the code responsible for handling input?
Okay, so I've gone through two books on game programming in XNA and I understood all the concepts and techniques, but I found myself getting lost quite a lot in the object orientation of it so I want to go back to that and fix that. Any books (preferably with loads of exercises, best way of learning) that are good?
Sorry, you need to Log In to post a reply to this thread.