• What do you need help with? Version 5
    5,752 replies, posted
  • The best way is practice really. You can look stuff up by just searching on them and try out the stuff by yourself.
  • I'm making a java applet that should connect to a MySQL database. It works perfectly when I run the applet locally in a browser. but once I upload it to the ftp server to run it, it can't connect to the database. No exceptions, no nothing. Just a non-responding applet. I have digitally self signed the applet. [cpp] public static void initConnection(Settings info) throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); //Freezes on next line. Connection conn = DriverManager.getConnection("jdbc:mysql://" + info.getHost() + ":3306/" + info.getDbName(), info.getUser(), info.getPass()); stmt = conn.createStatement(); } [/cpp]
  • Just messing about with standalone lua. I've got a .bat that runs the .lua file in 'interactive mode'. How do i go about stopping it from closing when there's an error. Makes debugging one hell of a process.
  • [QUOTE=Ehmmett;36850512]Just messing about with standalone lua. I've got a .bat that runs the .lua file in 'interactive mode'. How do i go about stopping it from closing when there's an error. Makes debugging one hell of a process.[/QUOTE] Put pause at the end of the .bat?
  • Trying to optimize my bloom effect. I currently have: Window 1024x576, FBO1 1024x576, FBO2 1024x576, displayImage 1024x576, [cpp] #version 120 varying vec2 uv; uniform sampler2D Texture; const float rt_w = 1024; // render target width const float rt_h = 576; // render target height const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); const int iter = 3; void main() { vec4 tc = texture2D(Texture, uv).rgba * weight[0]; for (int i=1; i<iter; i++) { tc += texture2D(Texture, uv + vec2(0.0, offset[i])/rt_h).rgba * weight[i]; tc += texture2D(Texture, uv - vec2(0.0, offset[i])/rt_h).rgba * weight[i]; } gl_FragColor = tc; } [/cpp] [cpp] #version 120 varying vec2 uv; uniform sampler2D Texture; const float rt_w = 1024; // render target width const float rt_h = 576; // render target height const int iter = 3; const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); void main() { vec4 tc = texture2D(Texture, uv).rgba * weight[0]; for (int i=1; i<iter; i++) { tc += texture2D(Texture, uv + vec2(offset[i])/rt_w, 0.0).rgba * weight[i]; tc += texture2D(Texture, uv - vec2(offset[i])/rt_w, 0.0).rgba * weight[i]; } gl_FragColor = tc; } [/cpp] Notice the rt_w & rt_h variables there. and I: Draw things to the window, Draw things that need blooming to FBO1 with normal shader. Draw FBO1 to FBO2 using the first shader. Draw FBO2 to window using second shader. So my idea was to reduce the size of the FBO's by 4 giving me FBO's of size 256x144 but when I use the same code but simply reducing the FBO size doesnt draw it, can someone help me out with what values the FBO's, Perspective & Ortho matrixes and displayImage's should use in terms of height and width?
  • I thought you were supposed to render your scene out to the Backbuffer/a Texture2D, downsize it in steps (halving each time until it's a certain size), apply a gaussian blur to the downsampled image, then upscale that and apply it over the original backbuffer with certain blending modes. [b]Edit:[/b] My implementation sounds like cheap bloom.
  • Yea thaats what im trying to do but i cant get my head around the matrices & coordinates
  • [QUOTE=Darkwater124;36851260]Put pause at the end of the .bat?[/QUOTE] Worked, thanks. :)
  • Having problems with GLuint and GLint with C++/OpenGL. Just getting errors like, GLuint was not declared in this scope GLint was not declared in this scope Everything else is working perfectly and when I replace GLuint and GLint with unsigned int and int then my program runs (it doesn't work properly but I assume that's something to do with my vertex and fragment shader code being fucked up.) Am I missing some prerequisite library?
  • I'm making a 2D side scroller in XNA as my first ever project and I've fallen at the first hurdle. I'd like to make maps in a neat fashion so I can also place crates and buildings on them, however the only way I have been managing to do this is by giving eat block a value (ei 1 = block 0 = air) and filling in a grid, which works to an extent, but its nothing pretty and I can't place anything else on it. [code] [0],[0],[0] [0],[0],[0] [1],[1],[1][/code]
  • [QUOTE=FreddiRox!;36872191]I'm making a 2D side scroller in XNA as my first ever project and I've fallen at the first hurdle. I'd like to make maps in a neat fashion so I can also place crates and buildings on them, however the only way I have been managing to do this is by giving eat block a value (ei 1 = block 0 = air) and filling in a grid, which works to an extent, but its nothing pretty and I can't place anything else on it. [code] [0],[0],[0] [0],[0],[0] [1],[1],[1][/code][/QUOTE] Congratulations, you're making a tile-based game. For objects that you can move around / shoot at / are dynamic in any other way I'd recommend making an additional array for them with x and y values. If they're just static, use other numbers, like 0 = air, 1 = dirt, 2 = crate, 3 = building-left wall, 4 = building-right wall, 5 = building-top wall etc.
  • OK, so lets say I still want to make a 2D side scroller, how else could I make the maps for the levels?
  • Would this: [cpp] bool t = inputs[0]->getConnection()->output(); for(int i = 1; i < inputs.size(); i++) { if(!inputs[i]->getInverted()) { t = t && inputs[i]->getConnection()->output(); } else { t = t && !inputs[i]->getConnection()->output(); } } if(t) { return true; } else { return false; } [/cpp] work for getting a correct output from an AND gate with 2-Many inputs, which any one of them can be inverted? [cpp] inputs[i]->getConnection()->output(); [/cpp] is used for getting the output of another gate. For testing I have two types of non-standard gates: GateType::HIGH and GateType::LOW. These output true and false respectively.
  • I'm analyzing the source code for a DOS game, specifically, [url=https://github.com/id-Software/wolf3d/tree/master/WOLFSRC]Wolfenstein 3D[/url]. It keeps referring to "tics" as a unit of time. DOS does time to a resolution of 1 centisecond, apparently. Is it a good bet that's it? I don't know shit about C++.
  • [QUOTE=Elecbullet;36876474]I'm analyzing the source code for a DOS game, specifically, [url=https://github.com/id-Software/wolf3d/tree/master/WOLFSRC]Wolfenstein 3D[/url]. It keeps referring to "tics" as a unit of time. DOS does time to a resolution of 1 centisecond, apparently. Is it a good bet that's it? I don't know shit about C++.[/QUOTE] One tick generally seems to refer to one time a certain game loop is run.
  • I could be wrong about any of this. I'm an admin on the Wolfenstein Wiki and I'm trying to make animated GIFs of all the enemies moving from extracted sprites. This file seems to give the time for each sprite: [url]https://github.com/id-Software/wolf3d/blob/master/WOLFSRC/WL_ACT2.C[/url] example [code]statetype s_willstand = {false,SPR_WILL_W1,0,T_Stand,NULL,&s_willstand}; statetype s_willchase1 = {false,SPR_WILL_W1,10,T_Will,NULL,&s_willchase1s}; statetype s_willchase1s = {false,SPR_WILL_W1,3,NULL,NULL,&s_willchase2}; statetype s_willchase2 = {false,SPR_WILL_W2,8,T_Will,NULL,&s_willchase3}; statetype s_willchase3 = {false,SPR_WILL_W3,10,T_Will,NULL,&s_willchase3s}; statetype s_willchase3s = {false,SPR_WILL_W3,3,NULL,NULL,&s_willchase4}; statetype s_willchase4 = {false,SPR_WILL_W4,8,T_Will,NULL,&s_willchase1}; statetype s_willdeathcam = {false,SPR_WILL_W1,1,NULL,NULL,&s_willdie1}; statetype s_willdie1 = {false,SPR_WILL_W1,1,NULL,A_DeathScream,&s_willdie2}; statetype s_willdie2 = {false,SPR_WILL_W1,10,NULL,NULL,&s_willdie3}; statetype s_willdie3 = {false,SPR_WILL_DIE1,10,NULL,NULL,&s_willdie4}; statetype s_willdie4 = {false,SPR_WILL_DIE2,10,NULL,NULL,&s_willdie5}; statetype s_willdie5 = {false,SPR_WILL_DIE3,10,NULL,NULL,&s_willdie6}; statetype s_willdie6 = {false,SPR_WILL_DEAD,20,NULL,NULL,&s_willdie6}; statetype s_willshoot1 = {false,SPR_WILL_SHOOT1,30,NULL,NULL,&s_willshoot2}; statetype s_willshoot2 = {false,SPR_WILL_SHOOT2,10,NULL,T_Launch,&s_willshoot3}; statetype s_willshoot3 = {false,SPR_WILL_SHOOT3,10,NULL,T_Shoot,&s_willshoot4}; statetype s_willshoot4 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willshoot5}; statetype s_willshoot5 = {false,SPR_WILL_SHOOT3,10,NULL,T_Shoot,&s_willshoot6}; statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willchase1}; [/code] I interpret the third thing after the equals as a number of units of time. Assuming the unit is one centisecond, it seems too fast! Other files have said things about 70 Hertz. I might try that, but it's a weird ass number. [editline]21st July 2012[/editline] I shall perform an experiment with 50Hz bases, 60Hz bases, and 70Hz bases to see which is the most fitting to Wolfenstein 3D. [editline]21st July 2012[/editline] 70Hz seems to fit. Jesus, what an odd number.
  • Is there any way to simplify this regex? I'm trying to verify an identifier that's 4 characters long A-Z and allow for padding only at the end with the "." character. The regex string: [code]([A-Z]{4})|([A-Z]{3}\.{1})|([A-Z]{2}\.{2})|([A-Z]{1}\.{3})[/code] Valid: [code] TEST TES. TE.. T... [/code] Invalid: [code] test TESt TEst Test tEST teST tesT T..T T.S. .E.T .EST ..ST ...T .... [/code]
  • Is there an API somewhere for getting current sales tax for my state? [editline]21st July 2012[/editline] (I live in the US in case you don't have Overv's Flagdog script for some reason)
  • [QUOTE=Elecbullet;36881538]Your other icons you've got down there make anything seem dubious you know[/QUOTE] i don't get it
  • [QUOTE=Elecbullet;36876895]70Hz seems to fit. Jesus, what an odd number.[/QUOTE] Are you sure it's not 75Hz? That was the usual refresh rate of CRTs back in the day.
  • [QUOTE=robmaister12;36877576]Is there any way to simplify this regex? I'm trying to verify an identifier that's 4 characters long A-Z and allow for padding only at the end with the "." character. The regex string: [code]([A-Z]{4})|([A-Z]{3}\.{1})|([A-Z]{2}\.{2})|([A-Z]{1}\.{3})[/code] Valid: [code] TEST TES. TE.. T... [/code] Invalid: [code] test TESt TEst Test tEST teST tesT T..T T.S. .E.T .EST ..ST ...T .... [/code][/QUOTE] ^([A-Z]+)(\.*)$
  • [QUOTE=ECrownofFire;36900710]^([A-Z]+)(\.*)$[/QUOTE] Matches TESTER, which is wrong.
  • I'm learning Java on Android by making a very simple game, but my touch isn't working correctly. It only registers the ACTION_DOWN event and nothing else. Ideas? MainActivity: [code] package com.novaember.blockrunner; import android.app.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new MainGamePanel(this)); } @Override public void onBackPressed() { return; } } [/code] MainGamePanel: [code] package com.novaember.blockrunner; import android.app.*; import android.content.*; import android.graphics.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback { private String avgFps; public void setAvgFps(String avgFps) { this.avgFps = avgFps; } private MainThread thread;; private Player player; private Map map; private Menu menu; public MainGamePanel(Context context) { super(context); // adding the callback (this) to the surface holder to intercept events getHolder().addCallback(this); player = new Player(BitmapFactory.decodeResource(getResources(), R.drawable.player), 50, 50); menu = new MainMenu(); this.thread = new MainThread(getHolder(), this); // make the GamePanel focusable so it can handle events setFocusable(true); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceCreated(SurfaceHolder holder) { thread.setRunning(true); thread.start(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { boolean retry = true; while (retry) { try { thread.join(); retry = false; } catch (InterruptedException e) { // try again shutting down the thread } } }; @Override public boolean onTouchEvent(MotionEvent event) { boolean ret = super.onTouchEvent(event); int action = event.getAction() & MotionEvent.ACTION_MASK; float ex = event.getX(); float ey = event.getY(); Log.d("BR", "Coords: x=" + ex + ",y=" + ey + ",action=" + event.getAction()); switch (action) { case MotionEvent.ACTION_DOWN: // thread.setRunning(false); // ((Activity) getContext()).finish(); try { for(Iterator i = menu.getButtons().iterator(); i.hasNext();) { Button btn = (Button) i.next(); Rect rect = btn.getRect(); if(rect.contains((int) ex, (int) ey)) { if(!btn.isDown()) { btn.touchDown(); } } } } catch (Exception e) { } break; case MotionEvent.ACTION_UP: try { for(Iterator i = menu.getButtons().iterator(); i.hasNext();) { Button btn = (Button) i.next(); Rect rect = btn.getRect(); //if(!rect.contains((int) ex, (int) ey)) { if(btn.isDown()) { btn.touchUp(); } //} } } catch (Exception e) { } break; } return ret; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { try { } catch(Exception e) { } return super.onKeyDown(keyCode, event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { Log.d("BR", "Key "+keyCode); try { } catch(Exception e) { } return super.onKeyUp(keyCode, event); } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.BLACK); } public void update() { } public void render(Canvas canvas) { canvas.drawColor(Color.BLACK); player.draw(canvas); menu.draw(canvas); displayFps(canvas, avgFps); } private void displayFps(Canvas canvas, String fps) { if (canvas != null && fps != null) { Paint paint = new Paint(); paint.setARGB(255, 255, 255, 255); canvas.drawText(fps, this.getWidth() - 50, 20, paint); } } } [/code] Also, some critique on the code in general would be welcome as I'm still learning it.
  • This question has probably been asked to death already, but what would be the best combination of libraries/toolkits for a 2d clone of tron for Linux/Windows. I made a couple of small applications with GTK+, and I just started into GLFW but I realized quickly that I was in over my head with OpenGL and before I knew it I was already doing everything bass ackwards (in that deprecated sort of way). Should I just make a simple gui within glfw and forgo trying to integrate GTK with it? Should I look into any other OpenGL helper libraries? And what would be the best place to learn the most up-to-date OpenGL? I have already written a version of the game with NCurses so I just need to translate that to a more graphical interface.