Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JGO Grabbag  (Read 2465 times)
0 Members and 1 Guest are viewing this topic.
Offline Roquen
« Posted 2014-01-16 12:00:30 »

In the spirit of "It's better to ask forgiveness than permission" I'd started an experiment.

https://github.com/roquendm/JGO-Grabbag

The idea is a non-library of java game related code snippets that one could search through in the same manner as one might have searched through <fill-in the blank of some relative>'s attic when one was a kid looking for treasure.
Offline Oskuro

JGO Knight


Medals: 39
Exp: 6 years


Coding in Style


« Reply #1 - Posted 2014-01-16 14:38:03 »

Pretty nice... Considering I myself have a project on my workspace called "CodeSnippets" where I dump all my code experiments, as well as interesting snippets I take from other people.

Smiley

Offline Danny02
« Reply #2 - Posted 2014-01-16 14:45:16 »

Yes there are a lot of little interesting code snippets out there and everyone has a util/misc package in his project. Would be nice if we would have a huge repository with many code-snippets of this category.

here three random snippets from my code base which could be usefull 1, 2 & 3
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Oskuro

JGO Knight


Medals: 39
Exp: 6 years


Coding in Style


« Reply #3 - Posted 2014-01-16 18:46:47 »

Would be nice if we would have a huge repository with many code-snippets of this category.

The Shared Code subforum could probably serve that purpose. In fact, I began my CodeSnippets "project" after reading this thread and realizing all those small pieces of code I had spread through my different projects would better be compiled somewhere.... In fact, after I found out Riven's site, my CondeSnippets project now has it's own src.riven package Tongue

(I like to create a package per author of the original code snippets, helps when looking to ask questions Smiley )

Offline Roquen
« Reply #4 - Posted 2014-01-17 08:15:08 »

@Danny02: There...now you can add stuff

The rough idea is to be complimentary to shared code/pastebin.  I find that there is code that I think about sharing which I don't because it would be awkward as a shared code post and too messy as a pastebin.  Most of the stuff that I do post is drastically paired down from my existing.
Offline Roquen
« Reply #5 - Posted 2014-01-29 14:53:29 »

Hey kids: Sharing is caring!  Make my day and bombard me with requests to be made a contributor.

The PRNG set is now stubbed out...just needs a few tweaks and additions to helper functions.  There 6 main generators which cover all possible use-cases in a game runtime (other than 4K).  Added a novelty generator than runs in both directions.  Added non-progressive Sobol generators...you have to decided in advance the number of points you want to generate...generators are reusable.
Offline Roquen
« Reply #6 - Posted 2014-02-05 15:36:17 »

Given the popularity of cube-world stuff, uniform 2D grids and the like...added in-order 2D/3D cell walking along line segment or ray.  Barely tested.  Oh and some other stuff:

https://github.com/roquendm/JGO-Grabbag/tree/master/src/roquen/interp
Offline Roquen
« Reply #7 - Posted 2014-02-13 13:43:09 »

I know what ya'll really want:  an arbitrary discrete probability distribution function map.

https://github.com/roquendm/JGO-Grabbag/blob/master/src/roquen/math/rng/RandomSelect.java

[start of google translate]
A fixed list of entries each of which has a fixed probability of occurring.  You pass it a pseudo or quasi random number and it selects a matching entry.
[end of translation]

Example usage:  single item drop list or population, fluff text from a unit/NPC, etc.

During the building process instead of providing the extra probabilities you provide "weight" values which indicate relative probabilities.  Example you enter (rock,5) (lint,1) (thing,2).  You're 5 times as likely to get "rock" as a result when compared to "lint" and 2x as likely to get "thing" compared to "lint".  The exact numbers have no meaning.
Offline Roquen
« Reply #8 - Posted 2014-03-20 10:18:08 »

Ray/Grid traversal for all touched cells RayGrid{2,3}D and a generic factory.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (10 views)
2014-10-02 14:36:20

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (48 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!