As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

SELECT * FROM posts WHERE tid = 'PA PROGRAMMING THREAD'

24567100

Posts

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Nope, don't see that anywhere. I see some stuff about images, and some text options, but nothing about published or unpublished. Even did a page search for 'publish', and found nothing.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • InfidelInfidel Heretic Registered User regular
    GnomeTank wrote:
    Nope, don't see that anywhere. I see some stuff about images, and some text options, but nothing about published or unpublished. Even did a page search for 'publish', and found nothing.

    Try now.

    Apparently that is admin-only in Drupal core. :rotate: Had to add a module to allow users to edit it on their own.

    OrokosPA.png
  • Jimmy KingJimmy King Registered User regular
    Jimmy King wrote:
    Jimmy King wrote:
    Well, limiting it at the script level isnt going to help your router any. It's already been through the router and to the web server at that point. For the web server performance, if it's just a small hackjob one off script then using the global may be fine, but if it's something semi-serious I'd look into caching the result of the operation to using memcached or an in memory cache or even to a db table instead.

    You make it sound like my router isn't my web server.
    It's not serious stuff. I'm literally the only legitimate user. There might be some way to do this from lighttpd, though. I'll look into it later, thanks.
    I could be wrong, but in the vast majority of cases it isn't. When you say router I am assuming you mean the little linksys box you picked up at best buy or whatever your isp provided you and the web server is an actual pc behind that running linux or whatnot. Are you using 3rd party firmware and using the web server on the router or something?
    Nope, I was using a belkin router for about a year but the thing kept crashing on me and was just generally unreliable, so I replaced it with this low power linux box, with 2 ethernet ports (and recently also a wireless card running in AP mode to act as my wireless router). eth0 is hooked directly to my cable modem, and eth1 goes to my switch where my desktop and xbox and all that are hooked up. I've got iptable's masquerading working so I can use the internet from inside my LAN or on the wireless, and am using the ufw filewall script that comes with xubuntu to handle the rest of the iptables rules. It also hosts a samba share and acts as a DHCP server, a web server, and a DNS cache.
    Ah ok, cool. I used to do that, too. These days my wrt54gl has been good to me, so I've just been using that.

  • NightslyrNightslyr Registered User regular
    Infidel wrote:
    Nightslyr wrote:
    Not a programming question per se, but a question about CSS sprites:

    I understand how to use sprites for background images - set a block element's size as the same size as the desired sprite, then set its background to the sprite sheet's filepath, positioned so the correct image on the sprite sheet shows through the 'viewport'.

    How would this work for an image that also is a link? I mean, aren't links and images inline elements? And what about accessibility re: alt tag?

    I guess I'm just asking if there's a standard plan of attack here.

    You assign all those kind of properties you normally would to the <img> instead to the <div>, and the div has your width/height/background-position to make it look correct.

    This isn't very clean for accessibility which is why an invisible structure is usually added to give an alternate navigation.

    edit: Actually, it sounds like you could get away with putting this on the <a> tag, which doesn't have the accessibility issues.

    e2: example
    <a id="view_profile" href="/profile/">View Profile</a>
    
    a#view_profile {
      display: block;
      text-indent: -9999px;
      width: 120px;
      height: 20px;
      background: url(sprite.png) no-repeat;
      background-position: -120px 0;
    }
    

    Now your HTML is kosher and text-based, and it is replaced by a sprite image by pure CSS.

    Ah, very nice. :^:

  • Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • StarfuckStarfuck Registered User, ClubPA regular
    Speaking of sprites, I've been using haml/compass/coffeescript (no rails, getting crazy) lately at work and compass has a sweet little spritesheet generation tool. I've had some path issues with it, but it does most of the work.
    http://compass-style.org/help/tutorials/spriting/

    jackfaces
    "If you're going to play tiddly winks, play it with man hole covers."
    - John McCallum
  • Jimmy KingJimmy King Registered User regular
    Yay, new sprint starts today at work. After almost 6 months on the job I have my first official Django dev work which is actually part of the scheduled work of the sprint. I've done a bunch already, but it was all unofficial, no real requirements, "just do something so that there's some sort of progress on this project since the product owners aren't making it happen" work ordered by management. It's nice to actually be doing it for real and officially.

  • GrobianGrobian What's on sale? Pliers!Registered User regular
    edited February 2012
    Welp, I'm currently working on a project with 7 partners (but, including us "only" 5 of those make software) and tomorrow we have the official kickoff with the people that give us money and some other externals. I think there's like 10 presentations planned, it's insane. But that is not my ranting topic. It's that one of those partners now sent everyone a 30 page document at 2PM the day before this meeting. Yeah, I'm not reading that today. And since they didn't even include an abstract or introduction, I can't read those, so I just read the last page for the conclusion.

    (The document my talk is based on was sent 3 weeks ago, btw)

    Grobian on
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    Is there anyone who can explain to me that Socket.IO adds to Node.js that Node didn't already have?

    It's a socket server... but I thought that's what Node was in the first place

  • zeenyzeeny Registered User regular
    Jasconius wrote:
    Is there anyone who can explain to me that Socket.IO adds to Node.js that Node didn't already have?

    It's a socket server... but I thought that's what Node was in the first place

    Hm hm? Socket.IO has browser api, yo.

  • InfidelInfidel Heretic Registered User regular
    zeeny wrote:
    Jasconius wrote:
    Is there anyone who can explain to me that Socket.IO adds to Node.js that Node didn't already have?

    It's a socket server... but I thought that's what Node was in the first place

    Hm hm? Socket.IO has browser api, yo.

    Yeah, it is to support cross-browser Web Sockets.

    Making real socket connections with a browser client.

    OrokosPA.png
  • Mike DangerMike Danger "Diane..." a place both wonderful and strangeRegistered User regular
    edited February 2012
    jQuery/Coldfusion:

    After some Googling and work, I now have a selector that, when it changes, updates a particular record in the database with its changed state. The thing is that I hard-coded in the job ID that I wanted to change for testing purposes.

    How can I make it so that when the variable goes off to the request processor code, it includes the changed state from the selector, and the ID of the job to change?

    Code is below:
    <cfset dbConnection = "#dbConnection#">
    
    <script language="JavaScript" src="jquery.js" type="text/javascript"></script>
    <script type = "text/javascript">jQuery(document).ready(function(){
      $("#idm").change(function() {
      	var formval = { idm:$(this) .val()};
        $.ajax({
         type: "POST",
         url: "request_processor.cfm",
         dataType: "json",
         data: formval,
         success: function(response){
    	  $('#contentdiv').fadeIn(2000).append(check.gif);
    	}
       });
      });
    });
    </script>
    
    <CFQUERY NAME="myJobs" DATASOURCE="#dbConnection#">
    SELECT *
    FROM Jobs
    WHERE ID = 35
    </CFQUERY>
    <CFOUTPUT query="myJobs">
    <div align="center" id="databox">
    	<select id="idm">
    		<CFQUERY NAME = "otherColors" DATASOURCE="#dbConnection#">
    			SELECT *
    			FROM Colors
    			WHERE Color <> "#State#"
    		</CFQUERY>
    		<option value="#State#">#State#</option>
    		<cfloop query="otherColors">
    			<option value="#Color#">#Color#</option>
    		</cfloop>
    	</select>
    	<p id="contentdiv"> </p>
    </div>
    </CFOUTPUT>
    

    I feel like this might not be super-clear, so here's where I want this to end up:
    <TABLE BORDER = "1">
    <CFIF (myJobs.RecordCount GT 0)>
    	<CFOUTPUT QUERY="myJobs">
    	<TR>
    		<CFIF session.admin.equals(True)><TD>#Username#</TD></CFIF>
    		<TD>#Event#</TD>
    		<TD>#PType#</TD>
    		<TD>#OtherDim#</TD>
    		<TD><a href="/Offices/ATIDev/posterprinting/files/#FileName#">#FileName#</a></TD>
    		<TD>
    			<!--- My new selector will go here --->
    		</TD>
    		<TD><a href="delete.cfm?ID=#ID#">Delete this job</a></TD>
    	</TR>
    	</CFOUTPUT>
    </TABLE>
    

    Mike Danger on
    Steam: Mike Danger | PSN/NNID: remadeking | 3DS: 2079-9204-4075
    oE0mva1.jpg
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2012
    Just re-wrote part of my script proxy system. We now represent the .NET objects in the Lua environment as full userdatums, rather than a table with a "hidden" __instance field. This does two things for me: Saves several instructions when making a call of any kind, because I no longer need to do a table lookup. I can simply munge the object id out of the userdata as such:
    var ud = Lua.lua_touserdata(state, 1);
    unsafe {
       var ptr = (int*)ud.ToPointer();
       var id = *ptr;
    }
    

    In addition, it also saves the user from themselves. An end user can't accidentally go:
    objInst.__instance = "Butts"
    

    and screw up scripting state.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • Mike DangerMike Danger "Diane..." a place both wonderful and strangeRegistered User regular
    Hey, I figured some of it out! Here's what I have now:
    <TABLE BORDER = "1">
    <CFIF (myJobs.RecordCount GT 0)>
    	<CFOUTPUT QUERY="myJobs">
    	<TR>
    		<CFIF session.admin.equals(True)><TD>#Username#</TD></CFIF>
    		<TD>#Event#</TD>
    		<TD>#PType#</TD>
    		<TD>#OtherDim#</TD>
    		<TD><a href="/Offices/ATIDev/posterprinting/files/#FileName#">#FileName#</a></TD>
    		<TD>
    			<select id="idm" job=#ID#>
    				<CFQUERY NAME = "otherColors" DATASOURCE="#dbConnection#">
    					SELECT *
    					FROM Colors
    					WHERE Color <> "#State#"
    				</CFQUERY>
    				<option value="#State#">#State#</option>
    				<cfloop query="otherColors">
    					<option value="#Color#">#Color#</option>
    				</cfloop>
    			</select>
    		</TD>
    		<TD><a href="delete.cfm?ID=#ID#">Delete this job</a></TD>
    	</TR>
    	</CFOUTPUT>
    </TABLE>
    <CFELSE>
    	<b>No jobs!</b><br><br>
    </CFIF>
    <a href="menu.cfm">Back to main menu</a>
    </BODY>
    </HTML>
    
    <script language="JavaScript" src="jquery.js" type="text/javascript"></script>
    <script type = "text/javascript">jQuery(document).ready(function(){  
      $("#idm").change(function() {
      	<!--- var formval = { idm:$(this) .val(), 35}; --->
      	var formval = {num: 1, IDM: $(this).val(), id: $(this).attr("job")};
        $.ajax({
         type: "POST",
         url: "request_processor.cfm",
         dataType: "json",
         data: formval,
         success: function(response){
    	  $("p").text(JSON.stringify(response));
    	}
       });
      });
    });
    </script>
    

    So, my new question: I've realized that the jQuery function is only keyed to run off of the "idm" selector. How can I make it so it applies to every selector on the page? (Or a class of selectors (I am pretty sure I can give them all names like "selector_#jobID#"))

    Steam: Mike Danger | PSN/NNID: remadeking | 3DS: 2079-9204-4075
    oE0mva1.jpg
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    GnomeTank wrote:
    Just re-wrote part of my script proxy system. We now represent the .NET objects in the Lua environment as full userdatums, rather than a table with a "hidden" __instance field. This does two things for me: Saves several instructions when making a call of any kind, because I no longer need to do a table lookup. I can simply munge the object id out of the userdata as such:
    var ud = Lua.lua_touserdata(state, 1);
    unsafe {
       var ptr = (int*)ud.ToPointer();
       var id = *ptr;
    }
    

    In addition, it also saves the user from themselves. An end user can't accidentally go:
    objInst.__instance = "Butts"
    

    and screw up scripting state.

    You always want to use full userdata for reasons like that; you can also get notified when Lua cleans userdata up so you can let Lua hold on to references to your stuff and you can make a strong link between native and Lua objects

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited February 2012
    Hey, I figured some of it out! Here's what I have now:
    <TABLE BORDER = "1">
    <CFIF (myJobs.RecordCount GT 0)>
    	<CFOUTPUT QUERY="myJobs">
    	<TR>
    		<CFIF session.admin.equals(True)><TD>#Username#</TD></CFIF>
    		<TD>#Event#</TD>
    		<TD>#PType#</TD>
    		<TD>#OtherDim#</TD>
    		<TD><a href="/Offices/ATIDev/posterprinting/files/#FileName#">#FileName#</a></TD>
    		<TD>
    			<select id="idm" job=#ID#>
    				<CFQUERY NAME = "otherColors" DATASOURCE="#dbConnection#">
    					SELECT *
    					FROM Colors
    					WHERE Color <> "#State#"
    				</CFQUERY>
    				<option value="#State#">#State#</option>
    				<cfloop query="otherColors">
    					<option value="#Color#">#Color#</option>
    				</cfloop>
    			</select>
    		</TD>
    		<TD><a href="delete.cfm?ID=#ID#">Delete this job</a></TD>
    	</TR>
    	</CFOUTPUT>
    </TABLE>
    <CFELSE>
    	<b>No jobs!</b><br><br>
    </CFIF>
    <a href="menu.cfm">Back to main menu</a>
    </BODY>
    </HTML>
    
    <script language="JavaScript" src="jquery.js" type="text/javascript"></script>
    <script type = "text/javascript">jQuery(document).ready(function(){  
      $("#idm").change(function() {
      	<!--- var formval = { idm:$(this) .val(), 35}; --->
      	var formval = {num: 1, IDM: $(this).val(), id: $(this).attr("job")};
        $.ajax({
         type: "POST",
         url: "request_processor.cfm",
         dataType: "json",
         data: formval,
         success: function(response){
    	  $("p").text(JSON.stringify(response));
    	}
       });
      });
    });
    </script>
    

    So, my new question: I've realized that the jQuery function is only keyed to run off of the "idm" selector. How can I make it so it applies to every selector on the page? (Or a class of selectors (I am pretty sure I can give them all names like "selector_#jobID#"))

    I hope I don't come off like a dick here, but your terminology is really mixed up and it's making it hard for me to follow what you're asking.

    id = is an attribute that should uniquely identify an HTML element on a page, as in <select id="idm">

    element = the actual HTML element on the page, i.e. the above select tag is an element with id "idm."

    selector = the string you pass in to the jQuery $() function to select elements. '#idm' is a selector for elements with the id "idm." '.blue' is a selector for elements with the class "blue." "p#idm.blue" would be a selector for elements of the type "p" of id "idm" and class "blue."

    There is no easy way to assign a variable id to elements and select all of them because selectors don't work that way. What you could do is give them all the same class (like "job_element") and then give them varying ids, then use $('.job_element') to select all of them and pull their id from that.

    admanb on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Phyphor wrote:
    GnomeTank wrote:
    Just re-wrote part of my script proxy system. We now represent the .NET objects in the Lua environment as full userdatums, rather than a table with a "hidden" __instance field. This does two things for me: Saves several instructions when making a call of any kind, because I no longer need to do a table lookup. I can simply munge the object id out of the userdata as such:
    var ud = Lua.lua_touserdata(state, 1);
    unsafe {
       var ptr = (int*)ud.ToPointer();
       var id = *ptr;
    }
    

    In addition, it also saves the user from themselves. An end user can't accidentally go:
    objInst.__instance = "Butts"
    

    and screw up scripting state.

    You always want to use full userdata for reasons like that; you can also get notified when Lua cleans userdata up so you can let Lua hold on to references to your stuff and you can make a strong link between native and Lua objects

    Yeah, right now whenever I create a script instance I am actually keeping it in the Lua registry hashed by it's .NET side hashcode...but I may re-think that. I actually don't want Lua to ever control object lifetime, which is why I'm doing it that way. In fact, the map of objects in the Lua state are all weak references. One of them goes "not alive" anymore, I actually wipe the Lua instance out of the registry as well.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    GnomeTank wrote:
    Phyphor wrote:
    GnomeTank wrote:
    Just re-wrote part of my script proxy system. We now represent the .NET objects in the Lua environment as full userdatums, rather than a table with a "hidden" __instance field. This does two things for me: Saves several instructions when making a call of any kind, because I no longer need to do a table lookup. I can simply munge the object id out of the userdata as such:
    var ud = Lua.lua_touserdata(state, 1);
    unsafe {
       var ptr = (int*)ud.ToPointer();
       var id = *ptr;
    }
    

    In addition, it also saves the user from themselves. An end user can't accidentally go:
    objInst.__instance = "Butts"
    

    and screw up scripting state.

    You always want to use full userdata for reasons like that; you can also get notified when Lua cleans userdata up so you can let Lua hold on to references to your stuff and you can make a strong link between native and Lua objects

    Yeah, right now whenever I create a script instance I am actually keeping it in the Lua registry hashed by it's .NET side hashcode...but I may re-think that. I actually don't want Lua to ever control object lifetime, which is why I'm doing it that way. In fact, the map of objects in the Lua state are all weak references. One of them goes "not alive" anymore, I actually wipe the Lua instance out of the registry as well.

    Ah, well it depends on your goals while doing the interface. Mine were to let Lua code use native C++ objects and also to implement native C++ classes while being able to pass the object around in Lua and back to the native code, so userdata use and lifecycle were a must. I actually cheat by defining lua_pushuserdata(), which also lets me ensure a unique userdata per-state.

    One of the issues with destroying objects from the native side is that the Lua side representation might be stashed away somewhere to be used later. How are you handling that?

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2012
    @Phyphor: I sort of rethought my approach on this. I am going to let the userdata's GC from the Lua side, but that will basically have no bearing the .NET side, aside from needing to create a new userdata if I ever push that particular managed instance back to Lua. Basically the lifetime of Lua objects is not tied to the lifetime of managed objects, really at all. Since 99.95% of the manage objects being pushed to Lua scripts will have lifetimes significantly longer than the script instances, I am okay with this.

    I am using my interface quite a bit different than you are, so that's why some of my constraints are different. I'm not allowing class overrding Lua side or anything like that. My scripting system is more event driven, with object instances either being passed as event arguments, or retrieved through some sort of global function (a lot like the WoW API).

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Changed my mind again! I am going to switch the object map from WeakReference to a ref counted reference. Whenever the Lua side GC's itself, it will decref the .NET side object, and when that decref reaches 0, we'll act like a weak reference. So we aren't completely controlling lifetime, but we still have a safety mechanism that says ".NET, please don't get rid of this, a script is still using it".

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    edited February 2012
    Another thing you have to consider is that the Lua GC is (I think) incremental and only occasionally run; if it's important for things to get destructed quickly you make have to invoke it yourself from time to time

    What I do is allow each class binding to specify if Lua is allowed to control lifetime, and even then I let the native code always clean up (since I'm not GCed I have to), I just null out the pointer to my object in the userdata, the glue code then throws errors if it finds a null. This does require you to track every userdata you create though

    Phyphor on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2012
    I already have to track every userdata I create, because unlike a native language, I can't just jam a pointer to my object in to the udata. I have to keep a map of numeric id's that I can map back to .NET objects, which is why I munge the pointer like you see above. In my case, the pointer itself is meaningless, and just points to a number. It's that number that is the actual mapping ID of the object that udata is "pointing" to.

    I think a lot of the difference in approach here is that I am trying to wrangle two different GC's. I need them to play nice, so I have to play a few tricks.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited February 2012
    multi-user 2D gameplay with Canvas and Socket.IO in basically two days!

    if you don't count a halfdozen failed attempts at home-grown 2D rendering engines in a handful of languages over the past years


    this one actually works

    once I add in character naming and make the map a little bigger I will post it

    Jasconius on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    It's amazing how difficult a simple 2D game engine is to engineer. I've been trying for years, and always get to a certain point and quit. There are a thousand ways to put a simple image on the screen, and they all have their advantages and disadvantages.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • Joe KJoe K Registered User regular
    GnomeTank wrote:
    It's amazing how difficult a simple 2D game engine is to engineer. I've been trying for years, and always get to a certain point and quit. There are a thousand ways to put a simple image on the screen, and they all have their advantages and disadvantages.

    http://pygame.org

    It's just soooo easy.

    I had a friend, passed away, who used to learn languages by first making a *solved* tic-tac-toe implementation, then would move on to tetris, and would finally make a rogue-like before he would feel comfortable with his knowledge of a language.

    Whenever he was screwing around with game ideas, it was always with pygame . It just makes all those really monotonous jobs and architectural questions EASY.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2012
    It's a damn shame I hate Python, and won't touch it. There needs to be a Ruby equivalent.

    Also, here is my Frankenstein reference type...behold, a FlexReference!
    public class FlexReference {
    	#region Fields
    
    	private readonly object _refLock = new object ();
    	private object _hardRef;
    	private int _refCount;
    	private GCHandle _weakRef;
    
    	#endregion
    
    	#region Constructors
    
    	public FlexReference (object inst) : this (inst, false) {
    	}
    
    	public FlexReference (object inst, bool takeHardRef) {
    		_weakRef = GCHandle.Alloc (inst, GCHandleType.Weak);
    		if (takeHardRef) {
    			AddRef ();
    		}
    	}
    
    	#endregion
    
    	#region Properties
    
    	public bool IsAlive {
    		get { return _hardRef != null || (_weakRef.AddrOfPinnedObject () != IntPtr.Zero && _weakRef.Target != null); }
    	}
    
    	public object Target {
    		get {
    			if (_hardRef != null) {
    				return _hardRef;
    			}
    
    			if (_weakRef.AddrOfPinnedObject () == IntPtr.Zero || _weakRef.Target == null) {
    				return null;
    			}
    
    			return _weakRef.Target;
    		}
    	}
    
    	#endregion
    
    	#region Public Methods
    
    	public void AddRef () {
    		if (!IsAlive) {
    			throw new InvalidOperationException ("Cannot addref an already dead instance");
    		}
    
    		Interlocked.Increment (ref _refCount);
    		lock (_refLock) {
    			if (_hardRef == null) {
    				_hardRef = _weakRef.Target;
    			}
    		}
    	}
    
    	public void DecRef () {
    		if (_refCount == 0) {
    			return;
    		}
    
    		Interlocked.Decrement (ref _refCount);
    		if (_refCount < 1) {
    			lock (_refLock) {
    				_hardRef = null;
    			}
    		}
    	}
    
    	#endregion
    }
    

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    GnomeTank wrote:
    It's a damn shame I hate Python, and won't touch it. There needs to be a Ruby equivalent.

    Event though you are wrong and scum you should check out:

    http://www.libgosu.org/
    http://rubygame.org/

    They are recommended when people ask for Ruby pygame equivalents

    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • bowenbowen How you doin'? Registered User regular
    I like how gosu has a C++ library.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • JasconiusJasconius sword criminal mad onlineRegistered User regular
    edited February 2012
    GnomeTank wrote:
    It's amazing how difficult a simple 2D game engine is to engineer. I've been trying for years, and always get to a certain point and quit. There are a thousand ways to put a simple image on the screen, and they all have their advantages and disadvantages.

    In my opinion the hardest aspects are always

    1) The concept of a camera and rendering offset for all actors on the stage
    2) Spritesheets because no matter how many people try, spritesheets are always clunky and annoying to build and implement
    3) Anchor points for rendered objects other than top-left

    I've got #1 down. #2 in Canvas is going to be... something

    Jasconius on
  • bowenbowen How you doin'? Registered User regular
    Collision and maths is usually the most annoying part. Moving shit around on screen is easy.

    Geometry calcs are a bit of a dick in the butt unless you're used to doing it all the time.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • BarrakkethBarrakketh Registered User regular
    bowen wrote: »
    I like how gosu has a C++ library.
    Well, it's a C++ library with a Ruby wrapper (looks like it uses SWIG to generate it).

    Rollers are red, chargers are blue....omae wa mou shindeiru
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Eh, there are so many good libraries will all the difficult vector and matrix math done for you, that you really just need to understand the basics of geometry. You don't actually need to know how to calculate a cross product, just what to do with one.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    edited February 2012
    Oh, we're talking game engines now? I made one with some other group members over a couple semesters last year, we ended up hosting it via Github. It was a great learning experience, even if I've never gone back to fix up some of the more annoying facets. It was written in Java for an OOP class, and so we implemented our own Eventing system using crappy message passing.

    Pretty fun overall, but my professor these days expects me to work on it and add features for my semester projects and I'd just rather not work on it anymore.

    Moved on to processor simulations!

    baronfel on
  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited February 2012
    Making your own game engine these days, as much as I hate to say this, is almost pointless. With things like pygame/rubygame/Ogre3D on the open source end, and UDK / Unity on the "freemium" end, it makes way more sense to just use someone else's code base.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    Oh, I know! This was entirely for educational purposes, and it was a fun task leading a group of developers, most of whom had never made anything of this scale before.

  • SeolSeol Registered User regular
    Well, that depends on why you're doing it, of course. I'm finding building my own 2D physics system incredibly satisfying. But then, I'm not doing it because I need to to make my game, I'm doing it because it's one of the reasons I wanted to make a game in the first place.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Seol wrote:
    Well, that depends on why you're doing it, of course. I'm finding building my own 2D physics system incredibly satisfying. But then, I'm not doing it because I need to to make my game, I'm doing it because it's one of the reasons I wanted to make a game in the first place.

    Right. If you are just doing the work of creating a game engine to make a game engine, then absolutely, have a blast. If you actually want to make a game, there are better options to actually make a game available to you.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • baronfelbaronfel Would you say I have a _plethora_?Registered User regular
    Our reason for doing it was to experiment with AI. We implemented a fuzzy logic system that the individual bots would use to choose what weapon was best in a given instant against their current target, as well as a more thought-out goal-tree-based brain for the bot's overall actions, like fleeing, looking for weapons/health/targets.

    The AI was some of the most fun for me, but I have recurring dreams of going back and making the entire thing

    a) some type of MVC
    b) more readable/understandable from an architectural standpoint.

  • GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    Why would you use MVC for an AI system? That confuses the shit out of me.

    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited February 2012
    They were writing the AI for a game. He wants to rebuild the game(/engine) in MVC.

    admanb on
This discussion has been closed.