Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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 4665 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.

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: 45
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.


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: 45
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: 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 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:
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.

[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.
Offline Roquen
« Reply #9 - Posted 2015-08-26 09:55:52 »

First pass of experimental testing of HotSpot transforms:

Some observations (insignificant number of data points so take with grain of salt).  HotSpot is doing the simple thing (nothing wrong with that given the compiler is a work-stealer) and is only handling certain types of primitives in each logical register set.  Integer/pointers in general purpose, float/double in SSE..except when x87 has specialized opcodes for the operation.  In that case it does the simple thing..move SSE to memory, memory to x87 perform op and store...rinse and repeat.  Likewise where an integer op could be performed in SSE..move to the thing, etc.

If an intrinsic math function (Float,Double,Math) has SSE support then the native opcode is generated.  Example:  (float)Math.sqrt(floatValue) generates single opcode sqrtss which is pure single, Math.sqrt(doubleValue) generates single opcode sqrtsd.  Don't know about floor & newish hardware is working hard to melt the polar ice-caps.  For icore2 it's doing typically functionality for performing the ops without changing the rounding mode.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ags1

JGO Kernel

Medals: 167
Projects: 6
Exp: 7 years

Make code not war!

« Reply #10 - Posted 2015-09-08 10:05:47 »

This is an amazing thread!

Pages: [1]
  ignore  |  Print  

basil_ (42 views)
2015-09-30 17:04:40

shadowstryker (21 views)
2015-09-29 15:55:06

TheSpaceHedgehog (27 views)
2015-09-29 01:58:48

GamerC4 (50 views)
2015-09-24 21:10:38

GamerC4 (70 views)
2015-09-24 21:09:48

htuy (27 views)
2015-09-24 04:57:24

htuy (36 views)
2015-09-24 04:56:35

htuy (25 views)
2015-09-24 04:56:09

htuy (26 views)
2015-09-24 04:47:33

Roquen (64 views)
2015-09-21 12:54:28
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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‑
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!